npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dd-nodom

v1.1.0

Published

Util library (no DOM code).

Downloads

944

Readme

dd-nodom

Util library (no DOM code).

/array

Array utilities (mostly based on partial application).

| name | info | | ---------------------------------- | ---- | | arrayConcat | | | arrayEach, arrayForEach | | | arrayEvery, arrayForEvery | | | arrayExtractDistinctValuesOfKey | | | arrayFilterNotEmpty | | | arrayFilter, arrayForFilter | | | arrayFind, arrayForFind | | | arrayFlat | | | arrayIncludes, arrayForInclude | | | arrayJoin, arrayForJoin | | | arrayMap, arrayForMap | | | arrayReduce, arrayForReduce | | | arrayRemove, arrayForRemove | | | arraySome, arrayForSome | | | arraySortByKey | | | arraySort, arrayForSort | | | arrayUnique | |

/common

Simple utilities.

| name | info | | ------------------ | ---------- | | isNullUndefined | type guard | | jsonCopy | | | jsonDiff | | | jsonEqual | | | notNullUndefined | type guard |

/date

Date utilities (mostly based on partial application).

FYI Most operators have an additional as-prefixed variant which can be applied directly to a date-like value e.g. alongside dateToIso there is also asIso.

FYI operators with Local infix always have an additional Utc variant e.g. dateToLocalDatePart and dateToUtcDatePart.

Building own operators

Most operators in the library are based on function composition and partial application. You can build your own operators based on the same principles. For example the operator dateMoveToEndOfLocalYear is implemented as:

// const dateMoveToEndOfLocalYear: (arg: Date) => Date
export const dateMoveToEndOfLocalYear = compose(addLocalMs(-1), addLocalYears(1), dateMoveToStartOfLocalYear);
  • compose builds a function which applies the handlers inside to an incoming argument from right to left:
    • from incoming date move to start of year
    • add 1 year
    • subtract a single millisecond
    • result: end of year

Util

| name | info | | --------------- | ----------------------- | | DateDiffLevel | (type) diff levels | | IsoWeekday | (enum) Mo-Su: 1-7 | | Weekday | (enum) Su-Sa: 0-6 | | dateZero | Date zero-ms instance |

ms constants

| name | info | | ---------------------- | ----------------------------------------------- | | avgDaysPerMonth | wikipedia average | | avgDaysPerYear | wikipedia average | | msLocalTimezoneToUtc | ms offset between local client timezone and UTC | | msSecond | second in ms | | msMinute | minute in ms | | msHour | hour in ms | | msDay | day in ms | | msWeek | week in ms | | msMonth | month in ms (average) | | msYear | year in ms (average) |

Parse

FYI when using compose prefer using asDateNonNull over asDate for better type-safety i.e. handle null beforehand.

| name | info | | --------------- | ------------------------------------------- | | isValidDate | checks Date instance and it's value | | asDate | parses as Date instance or null | | asDateNonNull | parses as Date instance, throws if null | | dateCopy | |

Getter

| name | info | as... | Utc | | --------------------------- | --------------------------------- | ------- | ------- | | dateToTimeValue | Date javascript ms value | ✓ | | | dateToLocalMs | milliseconds (0-999) | | ✓ | | dateToLocalMsString | milliseconds ("000"-"999") | ✓ | ✓ | | dateToLocalSeconds | seconds (0-59) | | ✓ | | dateToLocalSecondsString | seconds ("00"-"59") | ✓ | ✓ | | dateToLocalMinutes | minutes (0-59) | | ✓ | | dateToLocalMinutesString | minutes ("00"-"59") | ✓ | ✓ | | dateToLocalHours | hours (0-23) | | ✓ | | dateToLocalHoursString | hours ("00"-"23") | ✓ | ✓ | | dateToLocalWeekday | Su-Sa: 0-6 | ✓ | ✓ | | dateToLocalDayDate | date of the month (1-31) | ✓ | ✓ | | dateToLocalDayDateString | date of the month ("01"-"31") | ✓ | ✓ | | isWeekendDay | Su-Sa: 0-6 | | | | dateIsLocalWeekendDay | Su-Sa: 0-6 | ✓ | ✓ | | isWeekWorkDay | Su-Sa: 0-6 | | | | dateIsLocalWeekWorkDay | Su-Sa: 0-6 | ✓ | ✓ | | dateToLocalIsoWeekday | Mo-Su: 1-7 | ✓ | ✓ | | isIsoWeekWorkDay | Mo-Su: 1-7 | | | | dateIsLocalIsoWeekWorkDay | Mo-Su: 1-7 | ✓ | ✓ | | dateToLocalMonth | month (1-12) | | | | dateToLocalMonthString | month ("01"-"12") | ✓ | ✓ | | dateToLocalYear | full year | | ✓ | | dateToLocalYearString | full year (e.g. "0980") | ✓ | ✓ |

Stringify

| name | info | as... | Utc | | --------------------- | --------------------------------- | ------- | ------- | | dateToIso | "2000-01-01T00:00:00.000Z" | ✓ | | | dateToLocalDatePart | "yyyy-mm-dd" | ✓ | ✓ | | dateToLocalHhMmPart | "hh:mm" | ✓ | ✓ | | dateToLocalTimePart | "hh:mm:ss" | ✓ | ✓ | | dateToLocalDateTime | "yyyy-mm-ddThh:mm:ss" | ✓ | ✓ | | isoToDatePart | "yyyy-mm-dd" part of ISO string | | | | dateToIsoDatePart | to ISO part "yyyy-mm-dd" | ✓ | | | isoToHhMmPart | "hh:mm" part of ISO string | | | | dateToIsoToHhMmPart | | ✓ |

Compare

| name | info | | ----------- | ---- | | dateEqual | | | dateMax | | | dateMin | |

Diff

| name | info | | ------------------------- | ------------------------------- | | dateDiffMs | signed | | dateDiffMsDurationLevel | returns object with diff values | | removeDateDiffLevels | removes unwanted diff levels | | dateDiffSeconds | | | dateDiffMinutes | | | dateDiffHours | | | dateDiffDays | | | dateDiffWeeks | | | dateDiffMonths | | | dateDiffYears | |

Duration

FYI Uses Intl API or a non-flexible fallback.

| name | info | | ---------------------------- | ------------------------------------------- | | dateDurationLevel | returns object with duration values | | dateDurationMs | | | dateDurationSeconds | | | dateDurationMinutes | | | dateDurationHours | | | dateDurationDays | | | dateDurationWeeks | | | dateDurationMonths | | | dateDurationYears | | | DurationFormat | (type) format mode | | stringifyDuration | see also prepared DurationFormat variants | | stringifyShortestDuration | see also prepared DurationFormat variants | | stringifyDurationUpToHours | see also prepared DurationFormat variants |

ISO Year Week

| name | info | as... | Utc | | ------------------------------- | --------------------------------------------------- | ------- | --- | | dateToLocalIsoYearWeek | identifies [year, week] | ✓ | | | dateToLocalIsoWeek | | ✓ | | | dateToLocalIsoYear | | ✓ | | | dateToLocalIsoWeekString | 2000-W01 ISO format | ✓ | | | dateMoveToStartOfLocalIsoWeek | using a reference Date moves to start of ISO week | | | | dateStartOfLocalIsoYearWeek | [year, week] to start of week as Date | | |

Mutate

FYI All operators use immutability approach except for explicit dateMutate function.

Based on ms value (adds as duration)

These operators add value as duration (not usable for calendar based semantic mutations).

| name | info | | ------------ | ---- | | addMs | | | addSeconds | | | addMinutes | | | addHours | | | addDays | | | addWeeks | |

Based on semantic value

These operators add calendar based value semantically (not usable for duration mutations).

| name | info | Utc | | ----------------- | ---- | ------- | | addLocalMs | | ✓ | | addLocalSeconds | | ✓ | | addLocalMinutes | | ✓ | | addLocalHours | | ✓ | | addLocalDays | | ✓ | | addLocalWeeks | | ✓ | | addLocalMonths | | ✓ | | addLocalYears | | ✓ |

Moving

FYI These operators have MoveToStart and MoveToEnd infix variants.

| name | info | ToEnd | Utc | | -------------------------------- | ---------------------- | ------- | ------- | | dateMoveToStartOfLocalSecond | | ✓ | ✓ | | dateMoveToStartOfLocalMinute | | ✓ | ✓ | | dateMoveToStartOfLocalHour | | ✓ | ✓ | | dateMoveToStartOfLocalDay | | ✓ | ✓ | | dateMoveToStartOfLocalWeek | starts with Sunday (0) | ✓ | ✓ | | dateMoveToStartOfLocalWorkWeek | starts with Monday (1) | ✓ | ✓ | | dateMoveToStartOfLocalMonth | | ✓ | ✓ | | dateMoveToStartOfLocalQuarter | | ✓ | ✓ | | dateMoveToStartOfLocalHalfYear | | ✓ | ✓ | | dateMoveToStartOfLocalYear | | ✓ | ✓ |

/fp

Functional programming utilities.

| name | info | | --------------- | --------------------------------------------------------------------- | | add | mathematical addition | | ceil | mathematical | | coalesce | coalesce(a)(b) ~> b ?? a | | compose | right-to-left function composition | | curry | (a, b) => r ~> (a) => (b) => r | | div | mathematical division | | findOrDefault | handler finder (returns first fn that returns not-null or default fn) | | flip | (a) => (b) => r ~> (b) => (a) => r | | floor | mathematical | | max | mathematical | | min | mathematical | | mult | mathematical multiplication | | not | boolean | | round | mathematical | | sub | mathematical subtraction |

/str

String utilities (mostly based on partial application).

| name | info | | ------------------------------------------------------------- | ---------------------------------- | | strCompareAlphanumeric | | | strCompare | | | strIncludes, strForIncludes | | | strLower, strLowerLocale | | | strNonNull | stringify (always a string result) | | strPadLeft, strPadLeftWithZero, strPadLeftWithZero2/3/4 | | | strSplit, strForSplit | | | strTrim | | | strUpper, strUpperLocale | | | str | stringify |