Package #runtime/util/object

Provides JavaScript and TypeScript utilities for validating, inspecting, traversing, comparing, cloning, and modifying object structures. The API is designed for general-purpose object handling while preserving strong TypeScript inference and predictable runtime behavior.

The package includes runtime assertions and type guards for objects, plain objects, records, property keys, array indexes, and iterable protocols. The property-path / PropertyPath API supports both dotted strings and exact PropertyKey arrays, allowing strongly typed access to string, numeric, symbol, empty-string, and literal-period keys. Utilities are provided for path validation, normalization, concatenation, comparison, traversal, property lookup, descriptor and owner inspection, hardened assignment, and deletion.

Additional capabilities include deep cloning, merging, freezing, and sealing; prototype and accessor inspection; symbol-aware object traversal and structural comparison; and utilities for safely handling synchronous and asynchronous iterables. Trie-backed PropertyPathMap and WeakPropertyPathMap collections provide structural path storage, candidate-object matching, bounded subtree queries, and weakly held root associations. Configurable depth, entry, trie-node, result, and visit limits provide defensive controls for broad or untrusted property structures.

Note

Inspects getter and setter descriptors and evaluates constructor prototype relationships.

hasAccessor — Determines whether a property descriptor provides both a getter and setter.

hasGetter — Determines whether a property descriptor provides a getter.

hasPrototype — Determines whether a constructor matches or inherits from another constructor's prototype.

hasSetter — Determines whether a property descriptor provides a setter.

hasAccessor
hasGetter
hasPrototype
hasSetter
Note

Clones, combines, freezes, or seals complete object structures.

deepFreeze — Recursively freezes traversed objects and arrays.

deepMerge — Recursively merges one or more source objects into a target with inferred result typing.

deepSeal — Recursively seals traversed objects and arrays.

klona — Creates a deep clone using the re-exported klona/full implementation.

deepFreeze
deepMerge
deepSeal
klona
Note

Provides small object-oriented convenience operations that do not belong to the more specialized API categories.

objectKeys — Returns typed object keys with safe fallback behavior.

objectSize — Determines the size of objects, arrays, maps, sets, and strings.

objectKeys
objectSize
Note

Detects iterable protocols and safely prepares non-empty synchronous or asynchronous iterables.

ensureNonEmptyAsyncIterable — Produces a non-empty asynchronous iterable from asynchronous or synchronous iterable input.

ensureNonEmptyIterable — Peeks at a synchronous iterable and returns a replaying iterable when at least one value is available.

isAsyncIterable — Determines whether a value implements the asynchronous iterable protocol.

isIterable — Determines whether a value implements the synchronous iterable protocol while excluding strings.

ensureNonEmptyAsyncIterable
ensureNonEmptyIterable
isAsyncIterable
isIterable
Note

Provides TypeScript type aliases for identifying and projecting writable, readonly, and non-callable object properties.

ReadonlyDataProperties<T> — Projects T to an object containing only its readonly non-callable properties.

ReadonlyDataPropertyKeys<T> — Produces the readonly property keys of T whose value types contain no callable member.

ReadonlyProperties<T> — Projects T to an object containing only its readonly properties.

ReadonlyPropertyKeys<T> — Produces the readonly property keys of T whose value types contain no callable member.

WritableDataProperties<T> — Projects T to an object containing only its writable non-callable properties.

WritableDataPropertyKeys<T> — Produces the writable property keys of T whose value types contain no callable member.

WritableProperties<T> — Projects T to an object containing only its writable properties.

WritablePropertyKeys<T> — Produces the property keys of T that support assignment.

ReadonlyDataProperties
ReadonlyDataPropertyKeys
ReadonlyProperties
ReadonlyPropertyKeys
WritableDataProperties
WritableDataPropertyKeys
WritableProperties
WritablePropertyKeys
Note

Traverses object structures as exact property-key paths and compares corresponding values between objects.

PathKeyIteratorOptions — Defines object traversal, property ownership, path-bound, and resource-limit options for pathKeyIterator.

PropertyPathTraversalLimits — Defines common maximum depth, result, and visit controls for bounded property-path traversal.

pathKeyIterator — Traverses a bounded object branch and yields exact property-key paths, including symbols and optionally numeric array indexes.

safeEqual — Determines whether enumerable source paths and values are present and equal in a target object.

pathKeyIterator
safeEqual
PathKeyIteratorOptions
PropertyPathTraversalLimits
Note

Validates runtime object shapes through assertions and type guards while preserving or refining TypeScript types.

assertNonNullObject — Asserts a non-null object, including arrays, while preserving the value’s existing static type.

assertObject — Asserts a non-null, non-array object while preserving the value's existing static type.

assertObjectOrFunction — Asserts a non-null, non-array object or function while preserving the value's existing static type.

assertOrdinaryObject — Asserts a non-null, non-callable object for which Object.prototype.toString.call(value) returns '[object Object]' while preserving the value's existing static type.

assertPlainObject — Asserts an object whose prototype is Object.prototype or null.

assertRecord — Asserts a non-null, non-array object that can be treated as a string-keyed record.

isNonNullObject — Tests for a non-null object, including arrays, while preserving known object types where possible.

isObject — Tests for a non-null, non-array object while preserving known object types where possible.

isObjectOrFunction — Tests for a non-null, non-array object or function while preserving known object types where possible.

isOrdinaryObject — Tests for a non-null, non-callable object for which Object.prototype.toString.call(value) returns '[object Object]'.

isPlainObject — Tests for a plain dictionary-style object with no custom prototype.

isRecord — Tests for a non-null, non-array object and narrows it to Record<string, unknown>.

NonNullObject — Extracts the non-null, non-callable object members of a type, including arrays and specialized built-in objects.

assertNonNullObject
assertObject
assertObjectOrFunction
assertOrdinaryObject
assertPlainObject
assertRecord
isNonNullObject
isObject
isObjectOrFunction
isOrdinaryObject
isPlainObject
isRecord
NonNullObject
Note

Resolves structural property paths and inspects property existence, ownership, values, and descriptors.

getProperty — Resolves a property value while preserving present undefined and null values.

getPropertyDescriptor — Returns the descriptor defining the terminal property without invoking its getter.

getPropertyOwner — Returns the object or prototype that owns the terminal property.

hasProperty — Determines whether a complete property path exists without reading the terminal property value.

safeAccess — Resolves a property path with optional default-value semantics for missing or nullish values.

getProperty
getPropertyDescriptor
getPropertyOwner
hasProperty
safeAccess
Note

Defines, validates, compares, and transforms property keys and structural property-path representations without accessing an object.

concatPropertyPath — Concatenates multiple property paths into a newly allocated exact property-key path.

isArrayIndex — Determines whether a number is a valid ECMAScript array index.

isJSONPropertyPath — Validates a dotted string or array of string and finite-number segments that can be represented losslessly as a property path by JSON.

isPropertyKey — Determines whether a value is a string, number, or symbol property key.

isPropertyPathEqual — Determines whether two normalized property paths contain the same segments in the same order using SameValueZero comparison semantics.

isPropertyPath — Validates a dotted string or exact property-key array as a property path.

isPropertyPathPrefix — Determines whether one normalized property path is a structural prefix of another.

joinPropertyPath — Converts an exact property-key path to dotted-string form when the conversion is lossless.

JSONPropertyPath — Defines a non-empty property path that can be represented losslessly through ordinary JSON serialization.

normalizePropertyPath — Converts a property path to its canonical property-key array representation.

PropertyPath — Defines a dotted string path or exact readonly PropertyKey array accepted by path-aware APIs.

propertyPathIterator — Produces a validating iterator from a single property path or iterable of property paths, giving valid single paths precedence over iterable interpretation.

concatPropertyPath
isArrayIndex
isJSONPropertyPath
isPropertyKey
isPropertyPath
isPropertyPathEqual
isPropertyPathPrefix
joinPropertyPath
normalizePropertyPath
propertyPathIterator
JSONPropertyPath
PropertyPath
Note

Performs hardened object mutation through structural property paths.

deleteProperty — Deletes a configurable terminal property with explicit inherited-property handling and prototype-pollution protection.

safeSet — Sets or updates a property-path value with optional missing-path creation and supported arithmetic operations.

deleteProperty
safeSet
Note

Provides trie-backed collections keyed by structural property paths rather than array identity.

PropertyPathMap — Map-like collection with structural path lookup, bounded iteration, subtree traversal, candidate-object matching, and configurable storage / traversal limits.

WeakPropertyPathMap — Associates independently limited property-path maps with weakly held object roots.

PropertyPathMap
WeakPropertyPathMap
PropertyPathMap