Skip to content

Releases: andreww2012/utilery

utilery@0.3.0

Choose a tag to compare

@github-actions github-actions released this 26 Oct 13:43
Immutable release. Only release title and notes can be modified.
f857c84

Minor Changes

  • 2ffeb62 - Added new pathExists, readJsonFileSafe and readFilesInDirectorySafe server utilities: check whether a path exists, and read a JSON file or all files of a directory, getting null when it does not exist

  • 07e9ad8 - Added new string utilities:

  • 02db2b7 - Added new findExecutable and findExecutableSync utilities (which from which, giving undefined instead of throwing), a new quoteShellArgument utility (quoteForShell from puka) and a new isProcessAlive utility

  • 1d699b1 - colors returns plain text when colors are not supported (output that is not a terminal, NO_COLOR, FORCE_COLOR=0), and a new isColorSupported utility tells whether they are

  • 5c043e8 - Added a new semver group for semantic versions: compareSemver, isSemverInRange, isValidSemver and parseSemver (compare, satisfies, isValid and tryParse from verkit), and the ParsedSemver type

  • 14f9bbc - Added a new bitwise group for bit flags and other bit manipulation of 32-bit integers. Bit indexes are typed as BitIndex (an integer from 0 to 31), so out-of-range literals and enum members fail at compile time, and isBitIndex checks dynamic numbers:

  • 54f7fff - Added a new createSeededRandom utility: a seeded Math.random replacement from a number or a string seed, for reproducible results

  • 9db3b5c - Added a new glob group: globToRegex, isGlobMatch and isGlobPattern (makeRe, isMatch and scan from picomatch), and createPathFilter, a filter from include and exclude patterns

  • 161bee0 - Added a new getBuiltinModule utility: a typed process.getBuiltinModule that gives undefined outside Node.js

  • 80150d3 - Renamed the package from @andreww2012/unutils to utilery, so install it and import from utilery instead

  • a6d367d - arrayShuffle, arraySample, random, randomIntInclusive and randomIntExclusive get a random option for another generator, like one from createSeededRandom

  • d8b0c25 - Added a new parseNpmPackageSpecifier utility (parse from parse-package-name) that splits a specifier like @scope/package@1.2.3/sub/path into the name, the version and the path

  • 2eb3659 - createSingletonPromise no longer keeps a rejection by default, so the next call tries again (pass {cacheRejections: true} for the old behavior), and gets a ttlMs option

  • 8de06c0 - Added new utilities:

    • downloadFile in a new browser group: saves a string, bytes, a Blob, a fetch response or a stream as a file, like a download link, or through a "Save as" dialog in browsers that support it
    • formatDateForFileName: formats a date and time for file names, like 2026-10-25_14-30-05, with a choice of precision, UTC and separators
  • 42e7cec - Added new findUp and findUpSync utilities (findUp and findUpSync from find-up-simple) that find a file or directory in parent directories, and a new isPathInside utility

  • 60b94fa - Added a new sleepAbortable utility: like sleep, but rejects with the reason of the aborted signal and has an unref option to not keep the Node.js process alive

  • 83b38c1 - Added new getErrorMessage and interopDefault utilities: get a message from a caught value of any type, and resolve a module (or a dynamic import()) to its default export when it has one

  • 32e6ccc - Updated remeda from v2.51.0 to v2.53.0, which affected:

    • arrayMapWithAccumulator:
      • BREAKING: the callback now gets the source array as its fourth argument instead of the elements processed so far
  • 5951301 - Added new stripAnsi, getStringWidth and wrapText utilities (stripAnsi, stringWidth and wrapAnsi from strip-ansi, string-width and wrap-ansi): remove ANSI escape codes, measure the terminal width of a string and wrap styled text

  • 22b4cae - Added a new MaybeReadonlyArray type: a value or a readonly array of it. generateMailtoLink now uses it, so its recipient options also accept readonly arrays

  • 22b4cae - Added a new isArray utility from remeda: unlike Array.isArray, it also narrows readonly arrays

  • 23be320 - omit: a * deep path segment now matches every element of an array or property of an object, e.g. users.*.password removes password from every user. Deep paths also no longer mutate the input when they go through an array, e.g. omit(object, ['users.0.password'])

  • 4d59645 - Added a new path group for file paths on any platform, with isSafeRelativePath and parseNodeModulesPath. toForwardSlashes moved there from string, so import it from utilery/path instead of utilery/string

  • 03565c6 - Added new isPromiseLike, isValidDate and isUnsafeObjectKey utilities

  • 5d9e54f - Added a new topologicalSort utility (toposort.array from toposort) and the CyclicDependencyError it throws for a ...

Read more

v0.2.0

Choose a tag to compare

@andreww2012 andreww2012 released this 06 Oct 18:34
Immutable release. Only release title and notes can be modified.
bbdbe93

Minor Changes

  • 47be3d5 Thanks @andreww2012! - Narrowed the supported Node.js versions to ^22.23.1 || ^24.18.0 || >=26.4.0 (was ^22.23.1 || >=24) and exported package.json as /package.json subpath

  • 9fe6fdb Thanks @andreww2012! - Added the following new utilities from ms-ts package:

    • ms (misc group)
    • Ms (types group)
  • 2fecdaf Thanks @andreww2012! - Added a new misc/generateMailtoLink utility

  • ca6a52c Thanks @andreww2012! - Added a new array/arrayHasMaxElements utility - the "at most" counterpart to array/arrayHasMinElements - together with the types/ArrayWithMaxLength type powering its narrowing

  • 280d41e Thanks @andreww2012! - Added the following new utilities from typed-query-selector package, belonging to the new dom group:

    • querySelectorTyped
    • querySelectorAllTyped
    • closestTyped
    • ElementFromSelector (type)
    • ElementFromSelectorStrict (type)
    • ElementFromTagName (type)

    Added two opt-in side-effect entrypoints that type the native DOM lookup methods from the selector:

    • unutils/dom/query-selector-typed.global
    • unutils/dom/query-selector-typed-strict.global

    You should import at most one of the two.

  • 19ad83a Thanks @andreww2012! - Added the following new utilities from nanoid package, belonging to the new id group:

    • nanoid
    • nanoidFactory
    • NANOID_URL_ALPHABET (constant)
  • 625e1a3 Thanks @andreww2012! - Added two new map utilities that mirror the native Map#getOrInsert and Map#getOrInsertComputed methods, which are not yet widely available:

    • mapGetOrInsert - returns the value stored under a key, inserting an eagerly built default first when the key is missing
    • mapGetOrInsertComputed - the lazy counterpart, building the default only on a miss

    Both return a non-optional value, so mapGetOrInsertComputed(map, key, () => []).push(item) replaces the usual read-check-insert dance.

  • 2c764a4 Thanks @andreww2012! - Updated type-fest from v5.8.0 to v5.10.0:

    • Added RenameKeys (as-is) and MaxNumberInUnion (renamed from UnionMax) utilities
  • 17d62ef Thanks @andreww2012! - Updated es-toolkit from v1.49.0 to v1.52.0:

    • Added the following utilities:
      • object group:
      • function group:
        • flowAsync (flowAsync from es-toolkit/fp, taking the functions as an array like flow)
        • toDisposable (consolidates defer and deferAsync)
      • iterable group, from the new es-toolkit/iterator entrypoint (all of them accept any iterable, not only iterators):
        • generateSequence (renamed from iterate)
        • iterableCartesianProduct (renamed from cartesianProduct)
        • iterableChunks (renamed from chunk)
        • iterableCount (renamed from count)
        • iterableDropWhile (renamed from dropWhile)
        • iterableFirst (renamed from head)
        • iterablePartition (renamed from partition)
        • iterableRange (renamed from range)
        • iterableScan (renamed from scan)
        • iterableTakeWhile (renamed from takeWhile)
        • iterableTranspose (renamed from zip)
        • iterableUnique (renamed from uniqBy)
      • math group, from the new es-toolkit/bigint entrypoint:
    • The following utilities now also accept bigints, consolidated with their counterparts from the new es-toolkit/bigint entrypoint:
    • toConstantCaseKeysDeep, toKebabCaseKeysDeep and toPascalCaseKeysDeep are now based on the new toConstantCaseKeys, toKebabCaseKeys and toPascalCaseKeys: non-ASCII letters are no longer treated as word boundaries, and class instances are kept as-is
  • 3c743b5 Thanks @andreww2012! - Updated devalue from v5.8.1 to v6.0.2

    Added the following new utilities from devalue package (json group):

    • structuredStringifyAsync (renamed from stringifyAsync) - the promise-awaiting counterpart of structuredStringify
    • StructuredStringifyError (renamed from DevalueError) - thrown by structuredStringify and structuredStringifyAsync
    • structuredFilterArrayIndexes (renamed from filterArrayIndices) - for custom StructuredStringifyOperations
    • STRUCTURED_STRINGIFY_DEFAULT_OPERATIONS (constant, renamed from defaultStringifyOperations) - default operations of structuredStringify and structuredStringifyAsync
    • STRUCTURED_PARSE_DEFAULT_OPERATIONS (constant, renamed from defaultParseOperations) - default operations of structuredParse
    • StructuredStringifyOptions (type, renamed from StringifyOptions) - options of structuredStringify and structuredStringifyAsync
    • StructuredStringifyOperations (type, renamed from StringifyOperations) - operations option of structuredStringify and structuredStringifyAsync
    • StructuredParseOptions (type, renamed from ParseOptions) - options of structuredParse
    • StructuredParseOperations (type, renamed from ParseOperations) - operations option of structuredParse

Patch Changes

  • 4154dfd Thanks @andreww2012! - Updated nanoid from v6.0.1 to v6.0.2

  • 36aec3b Thanks @andreww2012! - Updated arkregex from v0.0.8 to v0.0.12

  • 9de1274 Thanks @andreww2012! - Fixed jsonParseAsync and jsonStringifyAsync:

    • jsonParseAsync no longer rejects every input with ReferenceError: chunk is not defined
    • jsonStringifyAsync now matches JSON.stringify in more cases:
      • nested objects and arrays are indented correctly with space
      • space is limited like in JSON.stringify: strings are cut to 10 characters, and numbers are truncated
      • values with toJSON (like Date) no longer get extra whitespace, and the replacer gets them after toJSON is called
      • the replacer gets array indexes as strings, and a replacer array accepts numbers and skips duplicates
      • control characters are escaped
    • jsonStringifyAsync now respects intensity instead of always using 1
    • Concurrent jsonStringifyAsync calls no longer mix up long strings or fail with "Circular Structure Detected"
  • 1e232d0 Thanks [@andreww...

Read more

v0.1.0

Choose a tag to compare

@github-actions github-actions released this 13 Jul 16:13
Immutable release. Only release title and notes can be modified.
161374d

Minor Changes

  • 68b46d2: Nullable: new type utility that wides the given type with null and undefined

  • b16aa66: Updated es-toolkit from v1.47.1 to v1.49.0:

    • arrayChunks now accepts a function as the second parameter, using chunkBy from es-toolkit/fp in this case
  • 6afcd0e: Updated ts-extras from v1.0.0 to v1.2.0:

    • Added object/object{Assign,Update} utilities as-is
  • df7f800: Updated type-fest from v5.7.0 to v5.8.0:

    • Added ExtractExactly, StringLength, StringToArray and StringToNumber utilities as-is
  • fb67815: Falsy, Truthy: new type utilities to represent "falsy" and "truthy" runtime values respectively, to the degree TypeScript allows that

  • 8ef2d03: Added a new group of object traversing utilities (called traverse) from neotraverse package: traverse{Every,Filter,Find,ForEach,Map,Nodes,Paths,Reduce,Some}

Patch Changes

  • 34da115: arrayify now correctly flattens heterogeneous array types ((T | T[])[] becomes T[])
  • a554170: Added missing type parameter to jsonParseSafe, allowing to cast the output to the given type
  • 6de873b: arraySwapIndices utility was renamed to arraySwapIndexes

v0.0.1

Choose a tag to compare

@github-actions github-actions released this 07 Jul 10:43
Immutable release. Only release title and notes can be modified.
4c0b799

Patch Changes