Skip to content

src/object

Dependency-free object + iterable utilities and the canonical repository owner for stable identity, loose scalar coercion, record guards, sequences, and common object transforms. Reuse these helpers across packages instead of adding local equivalents with different edge-case behavior.

Value guards / coercions / shape types: isRecord narrows parsed JSON to a record, toNumber coerces a hand-typed numeral, toBoolean coerces loose truthy/falsy values, toDuration parses 1h30m / 2 milliseconds to millis, toDate coerces a date/ISO string/epoch number/relative duration (toDate and toDuration fall back to each other, so either accepts both readings), optional spreads a field only when it is present, deepEqual compares structurally, isSerializableValue rejects anything a JSON round trip would lose or coerce, toStableKey canonicalizes a value so an identity can be derived from it, and NameLike/NonFunctionKeys describe object shapes.

Iterable helpers: sequence wraps source(s) in a lazy, Array-compatible Sequence. Every transform/terminal is a standalone function operating on plain Containers (see map, filter, group, …); the Sequence methods are thin forwarders over them so the same logic backs both the free-function and the fluent/chained styles.