@hyperfrontend/data-utils
Advanced tools
| 'use strict'; | ||
| const _Array = globalThis.Array; | ||
| const isArray = _Array.isArray; | ||
| const from = _Array.from; | ||
| exports.from = from; | ||
| exports.isArray = isArray; |
| const _Array = globalThis.Array; | ||
| const isArray = _Array.isArray; | ||
| const from = _Array.from; | ||
| export { from, isArray }; |
| 'use strict'; | ||
| const _Date = globalThis.Date; | ||
| const _Reflect = globalThis.Reflect; | ||
| function createDate(...args) { | ||
| return _Reflect.construct(_Date, args); | ||
| } | ||
| exports.createDate = createDate; |
| const _Date = globalThis.Date; | ||
| const _Reflect = globalThis.Reflect; | ||
| function createDate(...args) { | ||
| return _Reflect.construct(_Date, args); | ||
| } | ||
| export { createDate }; |
| 'use strict'; | ||
| const _Error = globalThis.Error; | ||
| const _Reflect = globalThis.Reflect; | ||
| const createError = (message, options) => _Reflect.construct(_Error, [message, options]); | ||
| exports.createError = createError; |
| const _Error = globalThis.Error; | ||
| const _Reflect = globalThis.Reflect; | ||
| const createError = (message, options) => _Reflect.construct(_Error, [message, options]); | ||
| export { createError }; |
| 'use strict'; | ||
| const _Map = globalThis.Map; | ||
| const _Reflect = globalThis.Reflect; | ||
| const createMap = (iterable) => _Reflect.construct(_Map, iterable ? [iterable] : []); | ||
| exports.createMap = createMap; |
| const _Map = globalThis.Map; | ||
| const _Reflect = globalThis.Reflect; | ||
| const createMap = (iterable) => _Reflect.construct(_Map, iterable ? [iterable] : []); | ||
| export { createMap }; |
| 'use strict'; | ||
| const _Math = globalThis.Math; | ||
| const round = _Math.round; | ||
| const random = _Math.random; | ||
| exports.random = random; | ||
| exports.round = round; |
| const _Math = globalThis.Math; | ||
| const round = _Math.round; | ||
| const random = _Math.random; | ||
| export { random, round }; |
| 'use strict'; | ||
| const _Object = globalThis.Object; | ||
| const freeze = _Object.freeze; | ||
| const keys = _Object.keys; | ||
| exports.freeze = freeze; | ||
| exports.keys = keys; |
| const _Object = globalThis.Object; | ||
| const freeze = _Object.freeze; | ||
| const keys = _Object.keys; | ||
| export { freeze, keys }; |
| 'use strict'; | ||
| const _Set = globalThis.Set; | ||
| const _Reflect = globalThis.Reflect; | ||
| const createSet = (iterable) => _Reflect.construct(_Set, iterable ? [iterable] : []); | ||
| exports.createSet = createSet; |
| const _Set = globalThis.Set; | ||
| const _Reflect = globalThis.Reflect; | ||
| const createSet = (iterable) => _Reflect.construct(_Set, iterable ? [iterable] : []); | ||
| export { createSet }; |
+919
-664
@@ -5,2 +5,83 @@ var HyperfrontendDataUtils = (function (exports) { | ||
| /** | ||
| * Safe copies of Array built-in static methods. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/array | ||
| */ | ||
| const _Array = globalThis.Array; | ||
| /** | ||
| * (Safe copy) Determines whether the passed value is an Array. | ||
| */ | ||
| const isArray = _Array.isArray; | ||
| /** | ||
| * (Safe copy) Creates an array from an array-like or iterable object. | ||
| */ | ||
| const from = _Array.from; | ||
| /** | ||
| * Safe copies of Error built-ins via factory functions. | ||
| * | ||
| * Since constructors cannot be safely captured via Object.assign, this module | ||
| * provides factory functions that use Reflect.construct internally. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/error | ||
| */ | ||
| const _Error = globalThis.Error; | ||
| const _Reflect$3 = globalThis.Reflect; | ||
| /** | ||
| * (Safe copy) Creates a new Error using the captured Error constructor. | ||
| * Use this instead of `new Error()`. | ||
| * | ||
| * @param message - Optional error message. | ||
| * @param options - Optional error options. | ||
| * @returns A new Error instance. | ||
| * | ||
| * @example Creating Error instances | ||
| * ```typescript | ||
| * const error = createError('Operation failed') | ||
| * // With cause for error chaining | ||
| * const wrapped = createError('Request failed', { cause: originalError }) | ||
| * ``` | ||
| */ | ||
| const createError = (message, options) => _Reflect$3.construct(_Error, [message, options]); | ||
| /** | ||
| * Represents a detected circular reference in an object graph. | ||
| * Tracks the location where the reference was found and its target. | ||
| * | ||
| * @example Creating a circular reference instance | ||
| * ```typescript | ||
| * const ref = new CircularReference(['root', 'child'], ['root']) | ||
| * console.log(ref.depth) // 1 | ||
| * ``` | ||
| */ | ||
| class CircularReference { | ||
| location; | ||
| target; | ||
| keyDelimiter = '\u00B7'; | ||
| delimiter = ' \u2192 '; | ||
| constructor(location, target) { | ||
| if (!isArray(location) || location.length === 0) { | ||
| throw createError(`Expected location to be a list with at list one string value.`); | ||
| } | ||
| if (!isArray(target)) { | ||
| throw createError(`Expected target to be a list.`); | ||
| } | ||
| this.location = { path: location }; | ||
| this.target = { path: target }; | ||
| } | ||
| get depth() { | ||
| return this.location.path.length - this.target.path.length; | ||
| } | ||
| toString = () => `${this.join(this.location)}${this.delimiter}${this.join(this.target)}`; | ||
| toJSON = () => this.toString(); | ||
| join = ({ path }) => path.join(this.keyDelimiter); | ||
| } | ||
| /** | ||
| * Safe copies of Object built-in methods. | ||
@@ -13,3 +94,2 @@ * | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Object = globalThis.Object; | ||
@@ -26,2 +106,15 @@ /** | ||
| /** | ||
| * Checks if a string is a valid marker format. | ||
| * | ||
| * @param text - The string to check | ||
| * @returns True if the string matches the marker pattern | ||
| * | ||
| * @example Validating marker format | ||
| * ```typescript | ||
| * isMarker('__$0') // true | ||
| * isMarker('__$123') // true | ||
| * isMarker('regular') // false | ||
| * ``` | ||
| */ | ||
| const isMarker = (text) => { | ||
@@ -70,2 +163,7 @@ if (typeof text !== 'string' || !text.startsWith('__$')) | ||
| * @param config - Partial configuration object to merge with current settings | ||
| * | ||
| * @example Configuring settings | ||
| * ```typescript | ||
| * setConfig({ detectCircularReferences: true }) | ||
| * ``` | ||
| */ | ||
@@ -82,2 +180,7 @@ const setConfig = (config) => { | ||
| * @returns The current global configuration object | ||
| * | ||
| * @example Retrieving configuration | ||
| * ```typescript | ||
| * const { detectCircularReferences } = getConfig() | ||
| * ``` | ||
| */ | ||
@@ -90,110 +193,25 @@ const getConfig = () => ({ | ||
| /** | ||
| * Registers one or more classes which will be used to identify values as distinct data types. | ||
| * Gets the keys from an iterable target based on its data type. | ||
| * | ||
| * @param classRefs - One or more class references to register. | ||
| * @returns The result of the forEach operation (void) | ||
| */ | ||
| const registerClassTypes = (...classRefs) => classRefs.forEach((classRef) => !registeredClasses.includes(classRef) && registeredClasses.push(classRef)); | ||
| /** | ||
| * Registers a custom class as iterable, allowing the data utilities API to treat instances | ||
| * as map-like objects with their own unique data type. | ||
| * @param target - The target to get the keys from. | ||
| * @param dataType - The data type of the target. | ||
| * @returns The keys from the iterable target. | ||
| * | ||
| * @param classRef - The class constructor to register | ||
| * @param getKeys - Function that returns all keys from an instance | ||
| * @param read - Function to read a value from an instance by key | ||
| * @param write - Function to write a value to an instance (with optional key) | ||
| * @param remove - Function to remove a key from an instance | ||
| * @param instantiate - Factory function to create new instances (defaults to calling constructor) | ||
| * @remarks | ||
| * If the class is already registered, its entry will be updated with the new handlers. | ||
| * @example Extracting keys from object | ||
| * ```typescript | ||
| * getKeysFromIterable({ a: 1, b: 2 }, 'object') // ['a', 'b'] | ||
| * ``` | ||
| */ | ||
| const registerIterableClass = (classRef, getKeys, read, write, remove, instantiate = () => new classRef()) => { | ||
| const existingEntryLocation = registeredIterableClasses.findIndex((entry) => entry.classRef === classRef); | ||
| const GetKeys = (target) => getConfig().detectCircularReferences ? [...getKeys(target)].filter((key) => !isMarker(key)) : getKeys(target); | ||
| const entry = { | ||
| classRef, | ||
| getKeys: GetKeys, | ||
| read, | ||
| write, | ||
| remove, | ||
| instantiate, | ||
| }; | ||
| if (existingEntryLocation >= 0) { | ||
| registeredIterableClasses[existingEntryLocation] = entry; | ||
| return; | ||
| } | ||
| registeredIterableClasses.unshift(entry); | ||
| registerClassTypes(classRef); | ||
| const getKeysFromIterable = (target, dataType) => { | ||
| if (dataType === 'array') | ||
| dataType = Array.name; | ||
| if (dataType === 'object') | ||
| dataType = Object.name; | ||
| const iterableClass = registeredIterableClasses.find(({ classRef }) => dataType === classRef.name); | ||
| if (iterableClass === undefined) | ||
| return []; | ||
| return iterableClass.getKeys(target); | ||
| }; | ||
| /** | ||
| * Removes one or more registered classes used to identify values as distinct data types. | ||
| * | ||
| * @param classRefs - One or more class references to deregister. If none provided, all registered classes will be deregistered. | ||
| */ | ||
| const deregisterClassTypes = (...classRefs) => { | ||
| if (classRefs.length === 0) { | ||
| while (registeredClasses.length !== 0) | ||
| registeredClasses.shift(); | ||
| return; | ||
| } | ||
| const indexes = classRefs | ||
| .map((classRef) => registeredClasses.indexOf(classRef)) | ||
| .filter((index) => index >= 0) | ||
| .sort(); | ||
| while (indexes.length !== 0) { | ||
| registeredClasses.splice(indexes[indexes.length - 1], 1); | ||
| indexes.pop(); | ||
| } | ||
| }; | ||
| /** | ||
| * Removes one or more registered iterable classes. | ||
| * Removes all registered iterable classes except built-ins (Array and Object) when no references are provided. | ||
| * | ||
| * @param classRefs - The class constructors to deregister | ||
| */ | ||
| const deregisterIterableClass = (...classRefs) => { | ||
| if (classRefs.length === 0) { | ||
| for (let i = registeredIterableClasses.length - 1; i >= 0; i--) { | ||
| const classRef = registeredIterableClasses[i].classRef; | ||
| if (![Array, Object].includes(classRef)) { | ||
| registeredIterableClasses.splice(i, 1); | ||
| } | ||
| } | ||
| } | ||
| else { | ||
| const indexes = classRefs | ||
| .map((classRef) => registeredIterableClasses.findIndex((entry) => entry.classRef === classRef)) | ||
| .filter((index) => index >= 0) | ||
| .sort(); | ||
| while (indexes.length > 0) { | ||
| registeredIterableClasses.splice(indexes[indexes.length - 1], 1); | ||
| indexes.pop(); | ||
| } | ||
| } | ||
| deregisterClassTypes(...classRefs); | ||
| }; | ||
| /** | ||
| * Safe copies of Array built-in static methods. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/array | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Array = globalThis.Array; | ||
| /** | ||
| * (Safe copy) Determines whether the passed value is an Array. | ||
| */ | ||
| const isArray = _Array.isArray; | ||
| /** | ||
| * (Safe copy) Creates an array from an array-like or iterable object. | ||
| */ | ||
| const from = _Array.from; | ||
| /** | ||
| * Returns the data type of the target. | ||
@@ -205,2 +223,9 @@ * Uses native `typeof` operator, however, makes distinction between `null`, `array`, and `object`. | ||
| * @returns The data type of the target. | ||
| * | ||
| * @example Determining data types | ||
| * ```typescript | ||
| * getType([1, 2]) // 'array' | ||
| * getType({ a: 1 }) // 'object' | ||
| * getType(null) // 'null' | ||
| * ``` | ||
| */ | ||
@@ -223,33 +248,2 @@ const getType = (target) => { | ||
| /** | ||
| * Checks if two targets are of the same data type. | ||
| * | ||
| * @param targetA The first target to compare | ||
| * @param targetB The second target to compare | ||
| * @returns The common data type if both targets are of the same type; otherwise, false. | ||
| */ | ||
| const sameType = (targetA, targetB) => { | ||
| const firstType = getType(targetA); | ||
| const secondType = getType(targetB); | ||
| return firstType === secondType ? firstType : false; | ||
| }; | ||
| /** | ||
| * Gets the keys from an iterable target based on its data type. | ||
| * | ||
| * @param target - The target to get the keys from. | ||
| * @param dataType - The data type of the target. | ||
| * @returns The keys from the iterable target. | ||
| */ | ||
| const getKeysFromIterable = (target, dataType) => { | ||
| if (dataType === 'array') | ||
| dataType = Array.name; | ||
| if (dataType === 'object') | ||
| dataType = Object.name; | ||
| const iterableClass = registeredIterableClasses.find(({ classRef }) => dataType === classRef.name); | ||
| if (iterableClass === undefined) | ||
| return []; | ||
| return iterableClass.getKeys(target); | ||
| }; | ||
| /** | ||
| * Returns a list of iterable data types. By default 'array' and 'object' are included., | ||
@@ -259,2 +253,7 @@ * but can be extended by using `registerIterableClass`. | ||
| * @returns Array of iterable data types. | ||
| * | ||
| * @example Listing registered iterable types | ||
| * ```typescript | ||
| * getIterableTypes() // ['array', 'object', ...registered types] | ||
| * ``` | ||
| */ | ||
@@ -275,2 +274,9 @@ const getIterableTypes = () => registeredIterableClasses.map(({ classRef }) => { | ||
| * @returns `true` if the data type is iterable, otherwise `false` | ||
| * | ||
| * @example Checking iterable types | ||
| * ```typescript | ||
| * isIterableType('array') // true | ||
| * isIterableType('object') // true | ||
| * isIterableType('string') // false | ||
| * ``` | ||
| */ | ||
@@ -280,114 +286,94 @@ const isIterableType = (dataType) => getIterableTypes().includes(dataType); | ||
| /** | ||
| * Checks whether two targets have the same structure. | ||
| * Checks if the target contains all specified keys. | ||
| * | ||
| * @param target - The target to check. | ||
| * @param keys - The keys to check for. | ||
| * @returns True if the target contains all specified keys, false otherwise. | ||
| * @remarks | ||
| * For iterable types (arrays, sets, maps, and objects), it checks whether they have the same keys. | ||
| * For other types, it simply checks whether they are of the same type. | ||
| * It supports configuration via `getConfig().samePositionOfOwnProperties` to determine whether the order of keys matters for objects. | ||
| * If supports other registered iterable classes as well. See `registerIterableClass`. | ||
| * @param targetA data to compare | ||
| * @param targetB data to compare | ||
| * @returns The data type if both targets have the same structure, otherwise `false`. | ||
| * Works with objects, arrays, and registered iterable classes. | ||
| * An empty keys array will always return `false`. | ||
| * | ||
| * @example Checking if object contains specific keys | ||
| * ```typescript | ||
| * containsKeys({ a: 1, b: 2 }, ['a', 'b']) // true | ||
| * containsKeys({ a: 1 }, ['a', 'b']) // false | ||
| * ``` | ||
| */ | ||
| const sameStructure = (targetA, targetB) => { | ||
| const typeMatch = sameType(targetA, targetB); | ||
| if (typeMatch === false) | ||
| const containsKeys = (target, keys) => { | ||
| if (keys.length === 0) | ||
| return false; | ||
| if (isIterableType(typeMatch)) { | ||
| const aKeys = getKeysFromIterable(targetA, typeMatch); | ||
| const bKeys = getKeysFromIterable(targetB, typeMatch); | ||
| const aKeyCount = aKeys.length; | ||
| const bKeyCount = bKeys.length; | ||
| if (aKeyCount !== bKeyCount) | ||
| return false; | ||
| if (aKeyCount === 0) | ||
| return typeMatch; | ||
| if (getConfig().samePositionOfOwnProperties) { | ||
| for (let i = 0; i < aKeyCount; i += 1) { | ||
| if (aKeys[i] !== bKeys[i]) | ||
| return false; | ||
| } | ||
| } | ||
| else { | ||
| for (let i = 0; i < aKeyCount; i += 1) { | ||
| if (!bKeys.includes(aKeys[i])) | ||
| return false; | ||
| } | ||
| } | ||
| } | ||
| return typeMatch; | ||
| const dataType = getType(target); | ||
| if (isIterableType(dataType) === false) | ||
| return false; | ||
| const targetKeys = getKeysFromIterable(target, dataType); | ||
| return !keys.some((k) => !targetKeys.includes(k)); | ||
| }; | ||
| /** | ||
| * Checks if the target is iterable. | ||
| * Removes one or more registered classes used to identify values as distinct data types. | ||
| * | ||
| * @param target - The target to check. | ||
| * @returns `true` if the target is iterable, `false` otherwise. | ||
| * @param classRefs - One or more class references to deregister. If none provided, all registered classes will be deregistered. | ||
| * | ||
| * @example Deregistering class types | ||
| * ```typescript | ||
| * deregisterClassTypes(MyCustomClass) | ||
| * deregisterClassTypes() // clears all | ||
| * ``` | ||
| */ | ||
| const isIterable = (target) => isIterableType(getType(target)); | ||
| const deregisterClassTypes = (...classRefs) => { | ||
| if (classRefs.length === 0) { | ||
| while (registeredClasses.length !== 0) | ||
| registeredClasses.shift(); | ||
| return; | ||
| } | ||
| const indexes = classRefs | ||
| .map((classRef) => registeredClasses.indexOf(classRef)) | ||
| .filter((index) => index >= 0) | ||
| .sort(); | ||
| while (indexes.length !== 0) { | ||
| registeredClasses.splice(indexes[indexes.length - 1], 1); | ||
| indexes.pop(); | ||
| } | ||
| }; | ||
| /** | ||
| * Safe copies of Error built-ins via factory functions. | ||
| * Removes one or more registered iterable classes. | ||
| * Removes all registered iterable classes except built-ins (Array and Object) when no references are provided. | ||
| * | ||
| * Since constructors cannot be safely captured via Object.assign, this module | ||
| * provides factory functions that use Reflect.construct internally. | ||
| * @param classRefs - The class constructors to deregister | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/error | ||
| * @example Deregistering iterable classes | ||
| * ```typescript | ||
| * deregisterIterableClass(MyCollection) | ||
| * deregisterIterableClass() // clears all except Array/Object | ||
| * ``` | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Error = globalThis.Error; | ||
| const _Reflect$3 = globalThis.Reflect; | ||
| /** | ||
| * (Safe copy) Creates a new Error using the captured Error constructor. | ||
| * Use this instead of `new Error()`. | ||
| * | ||
| * @param message - Optional error message. | ||
| * @param options - Optional error options. | ||
| * @returns A new Error instance. | ||
| */ | ||
| const createError = (message, options) => _Reflect$3.construct(_Error, [message, options]); | ||
| class CircularReference { | ||
| location; | ||
| target; | ||
| keyDelimiter = '\u00B7'; // Middle dot | ||
| delimiter = ' \u2192 '; // Right arrow | ||
| constructor(location, target) { | ||
| if (!isArray(location) || location.length === 0) { | ||
| throw createError(`Expected location to be a list with at list one string value.`); | ||
| const deregisterIterableClass = (...classRefs) => { | ||
| if (classRefs.length === 0) { | ||
| for (let i = registeredIterableClasses.length - 1; i >= 0; i--) { | ||
| const classRef = registeredIterableClasses[i].classRef; | ||
| if (![Array, Object].includes(classRef)) { | ||
| registeredIterableClasses.splice(i, 1); | ||
| } | ||
| } | ||
| if (!isArray(target)) { | ||
| throw createError(`Expected target to be a list.`); | ||
| } | ||
| else { | ||
| const indexes = classRefs | ||
| .map((classRef) => registeredIterableClasses.findIndex((entry) => entry.classRef === classRef)) | ||
| .filter((index) => index >= 0) | ||
| .sort(); | ||
| while (indexes.length > 0) { | ||
| registeredIterableClasses.splice(indexes[indexes.length - 1], 1); | ||
| indexes.pop(); | ||
| } | ||
| this.location = { path: location }; | ||
| this.target = { path: target }; | ||
| } | ||
| get depth() { | ||
| return this.location.path.length - this.target.path.length; | ||
| } | ||
| toString = () => `${this.join(this.location)}${this.delimiter}${this.join(this.target)}`; | ||
| toJSON = () => this.toString(); | ||
| join = ({ path }) => path.join(this.keyDelimiter); | ||
| } | ||
| const getIterableOperators = (dataType) => { | ||
| const { getKeys, read, write, remove, instantiate } = (registeredIterableClasses.find((e) => e.classRef.name.toLowerCase() === dataType.toLowerCase())); | ||
| return { getKeys, read, write, remove, instantiate }; | ||
| deregisterClassTypes(...classRefs); | ||
| }; | ||
| /** | ||
| * Safe copies of Map built-in via factory function. | ||
| * Safe Map factory with optional groupBy for ES2024+. | ||
| * | ||
| * Since constructors cannot be safely captured via Object.assign, this module | ||
| * provides a factory function that uses Reflect.construct internally. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/map | ||
| */ | ||
| // Capture references at module initialization time | ||
| /* eslint-disable workspace/lib-require-jsdoc-example */ | ||
| const _Map = globalThis.Map; | ||
@@ -405,15 +391,38 @@ const _Reflect$2 = globalThis.Reflect; | ||
| /** | ||
| * Safe copies of Date built-in via factory function and static methods. | ||
| * Checks if the target is iterable. | ||
| * | ||
| * Since constructors cannot be safely captured via Object.assign, this module | ||
| * provides a factory function that uses Reflect.construct internally. | ||
| * @param target - The target to check. | ||
| * @returns `true` if the target is iterable, `false` otherwise. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * @example Checking if value is iterable | ||
| * ```typescript | ||
| * isIterable([1, 2]) // true | ||
| * isIterable({ a: 1 }) // true | ||
| * isIterable('string') // false | ||
| * ``` | ||
| */ | ||
| const isIterable = (target) => isIterableType(getType(target)); | ||
| /** | ||
| * Safe copies of Date built-in via factory function and static methods. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/date | ||
| */ | ||
| // Capture references at module initialization time | ||
| /* eslint-disable jsdoc/require-param */ | ||
| const _Date = globalThis.Date; | ||
| const _Reflect$1 = globalThis.Reflect; | ||
| /** | ||
| * (Safe copy) Creates a new Date using the captured Date constructor. | ||
| * Use this instead of `new Date()`. Accepts all standard Date constructor signatures. | ||
| * | ||
| * @returns A new Date instance. | ||
| * | ||
| * @example Creating Date instances | ||
| * ```typescript | ||
| * const now = createDate() | ||
| * const fromTimestamp = createDate(1704067200000) | ||
| * const fromString = createDate('2024-01-01T00:00:00Z') | ||
| * const fromParts = createDate(2024, 0, 1, 12, 30, 0) // Jan 1, 2024 12:30:00 | ||
| * ``` | ||
| */ | ||
| function createDate(...args) { | ||
@@ -431,3 +440,2 @@ return _Reflect$1.construct(_Date, args); | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Math = globalThis.Math; | ||
@@ -438,5 +446,2 @@ /** | ||
| const round = _Math.round; | ||
| // ============================================================================ | ||
| // Random | ||
| // ============================================================================ | ||
| /** | ||
@@ -449,2 +454,12 @@ * (Safe copy) Returns a pseudo-random number between 0 and 1. | ||
| /** | ||
| * Generates a unique marker string for object tagging. | ||
| * | ||
| * @returns A unique marker string prefixed with __$ | ||
| * | ||
| * @example Generating unique marker | ||
| * ```typescript | ||
| * const tag = marker() // '__$16789012345001234567890' | ||
| * ``` | ||
| */ | ||
| const marker = () => { | ||
@@ -465,2 +480,9 @@ const randomValue = round(random() * 10000000000000); | ||
| * @returns A new ReferenceStack instance. | ||
| * | ||
| * @example Tracking object references | ||
| * ```typescript | ||
| * const stack = referenceStack() | ||
| * stack.add(myObject) | ||
| * stack.exists(myObject) // true | ||
| * ``` | ||
| */ | ||
@@ -498,2 +520,268 @@ const referenceStack = () => { | ||
| const errorMessage = (thing, type) => `Expected ${thing} to be ${type}.`; | ||
| const nextIterationDetails = (path, key, value) => ({ | ||
| nextPath: [...path, key], | ||
| nextValue: value[key], | ||
| }); | ||
| const circularDependencyTraversal = (condition, callback, config, key, path, value, parent, state, stack, root = false) => { | ||
| if (stack.exists(value)) | ||
| return state; | ||
| const ok = condition(config, key, value, path, parent); | ||
| /* istanbul ignore next */ | ||
| if (config.exitEarly) | ||
| return state; | ||
| if (ok) | ||
| callback(key, value, path, state, parent); | ||
| stack.add(value); | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return state; | ||
| const keys = getKeysFromIterable(value, type); | ||
| keys.forEach((key) => { | ||
| const { nextPath, nextValue } = nextIterationDetails(path, key, value); | ||
| circularDependencyTraversal(condition, callback, config, key, nextPath, nextValue, value, state, stack); | ||
| }); | ||
| if (root) | ||
| stack.clear(); | ||
| return state; | ||
| }; | ||
| const nonCircularDependencyTraversal = (condition, callback, config, key, path, value, parent, state) => { | ||
| const ok = condition(config, key, value, path, parent); | ||
| /* istanbul ignore next */ | ||
| if (config.exitEarly) | ||
| return state; | ||
| if (ok) | ||
| callback(key, value, path, state, parent); | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return state; | ||
| const keys = getKeysFromIterable(value, type); | ||
| keys.forEach((key) => { | ||
| const { nextPath, nextValue } = nextIterationDetails(path, key, value); | ||
| nonCircularDependencyTraversal(condition, callback, config, key, nextPath, nextValue, value, state); | ||
| }); | ||
| return state; | ||
| }; | ||
| const traversal = (target, condition, callback, options, state) => { | ||
| if (typeof callback !== 'function') | ||
| throw createError(errorMessage('callback', 'a function')); | ||
| if (!(typeof options === 'object' && !isArray(options))) | ||
| throw createError(errorMessage('options', 'an object')); | ||
| if (!isArray(options.depth)) | ||
| throw createError(errorMessage('options.depth', 'an array')); | ||
| const [startDepth, maxDepth] = options.depth; | ||
| if (startDepth !== void 0 && typeof startDepth !== 'number') | ||
| throw createError(errorMessage('options.depth.0', 'a number')); | ||
| if (maxDepth !== void 0) { | ||
| const maxDepthType = typeof maxDepth; | ||
| if (!['number', 'string'].includes(maxDepthType)) | ||
| throw createError(errorMessage('options.depth.1', 'a number or a string')); | ||
| if (maxDepthType === 'string' && maxDepth !== '*') | ||
| throw createError("Only valid string value in options.depth.1 is '*'."); | ||
| } | ||
| const config = { | ||
| depth: freeze([options.depth[0] ?? 0, options.depth[1] ?? '*']), | ||
| exitEarly: false, | ||
| }; | ||
| const initialArgs = [condition, callback, config, '', [], target, void 0, state]; | ||
| if (getConfig().detectCircularReferences) | ||
| return circularDependencyTraversal(...initialArgs, referenceStack(), true); | ||
| return nonCircularDependencyTraversal(...initialArgs); | ||
| }; | ||
| /** | ||
| * A higher-order function that takes a single predicate function to generate an algorithm that traverses data points | ||
| * on a data structure. See traverse. | ||
| * | ||
| * @param condition - Predicate function to determine whether to traverse a data point | ||
| * @returns A traversal function configured with the condition | ||
| * | ||
| * @example Creating custom traversal | ||
| * ```typescript | ||
| * const customTraverse = createTraversal((config, key, value) => value !== null) | ||
| * customTraverse(data, callback, options) | ||
| * ``` | ||
| */ | ||
| const createTraversal = (condition) => (target, callback, options, state) => traversal(target, condition, callback, options ?? { depth: [0, '*'] }, state ?? {}); | ||
| const condition = (config, key, value, path) => !(path.length < config.depth[0] || config.depth[1] < path.length); | ||
| const traverseBetweenDepthRange = createTraversal(condition); | ||
| /** | ||
| * Invokes a callback function for every data point in the data structure of the target value to let you do read and write operations. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * | ||
| * @param target - The value to traverse | ||
| * @param callback - Function to invoke for each data point | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @param state - Optional state object to maintain across traversal callbacks | ||
| * @returns The state object after traversal completes | ||
| * | ||
| * @example Traversing data structure | ||
| * ```typescript | ||
| * traverse({ a: { b: 1 } }, (key, value, path) => { | ||
| * console.log(path.join('.'), '=', value) | ||
| * }) | ||
| * ``` | ||
| */ | ||
| const traverse = (target, callback, options, state) => traverseBetweenDepthRange(target, callback, options, state); | ||
| /** | ||
| * Returns the total depth of a value's data structure, | ||
| * and returns a list of locations that are the most deeply nested. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to analyze for depth | ||
| * @returns A tuple containing the maximum depth and an array of paths to the deepest locations | ||
| * | ||
| * @example Getting depth of nested object | ||
| * ```typescript | ||
| * getDepth({ a: { b: { c: 1 } } }) // [3, [['a', 'b', 'c']]] | ||
| * ``` | ||
| */ | ||
| const getDepth = (target) => { | ||
| const trackDepth = (key, value, path, state) => { | ||
| if (state.depth < path.length) { | ||
| state.depth = path.length; | ||
| state.locations = [path]; | ||
| return; | ||
| } | ||
| if (state.depth === path.length) { | ||
| state.locations.push(path); | ||
| } | ||
| }; | ||
| const options = { depth: [0, '*'] }; | ||
| const state = { depth: 0, locations: [] }; | ||
| const { depth, locations } = traverse(target, trackDepth, options, state); | ||
| return [depth, locations]; | ||
| }; | ||
| /** | ||
| * Retrieves iterable operators for a given data type. | ||
| * | ||
| * @param dataType - The type of data to get operators for | ||
| * @returns Object containing getKeys, read, write, remove, and instantiate operators | ||
| * | ||
| * @example Retrieving operators for array type | ||
| * ```typescript | ||
| * const ops = getIterableOperators('array') | ||
| * const keys = ops.getKeys([1, 2, 3]) // ['0', '1', '2'] | ||
| * ``` | ||
| */ | ||
| const getIterableOperators = (dataType) => { | ||
| const { getKeys, read, write, remove, instantiate } = (registeredIterableClasses.find((e) => e.classRef.name.toLowerCase() === dataType.toLowerCase())); | ||
| return { getKeys, read, write, remove, instantiate }; | ||
| }; | ||
| /** | ||
| * Safe Set factory for protected set construction. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/set | ||
| */ | ||
| /* eslint-disable workspace/lib-require-jsdoc-example */ | ||
| const _Set = globalThis.Set; | ||
| const _Reflect = globalThis.Reflect; | ||
| /** | ||
| * (Safe copy) Creates a new Set using the captured Set constructor. | ||
| * Use this instead of `new Set()`. | ||
| * | ||
| * @param iterable - Optional iterable of values. | ||
| * @returns A new Set instance. | ||
| */ | ||
| const createSet = (iterable) => _Reflect.construct(_Set, iterable ? [iterable] : []); | ||
| /** | ||
| * Returns a list of unique key names that match a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against key names (defaults to matching all keys) | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of unique key names that match the pattern | ||
| * | ||
| * @example Finding unique keys by pattern | ||
| * ```typescript | ||
| * getUniqueKeys({ a: { b: 1 }, c: { b: 2 } }, 'b') // ['b'] | ||
| * getUniqueKeys(data, /^user/) // keys starting with 'user' | ||
| * ``` | ||
| */ | ||
| const getUniqueKeys = (target, pattern = /.+/, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => match(nextKey) && state.names.add(nextKey)); | ||
| }; | ||
| return from(traverse(target, callback, { depth: [0, '*'], ...options }, { | ||
| names: createSet(), | ||
| }).names.values()); | ||
| }; | ||
| /** | ||
| * Gets the value at the specified path from the target. | ||
| * | ||
| * @param target - The target to get the value from. | ||
| * @param path - The path to the value. | ||
| * @param defaultValue - The default value to return if the path does not exist or an error occurs. | ||
| * @returns The value at the specified path or the default value. | ||
| * @throws {Error} Will throw an error if the path is not a non-empty array of strings and no default value for errors is provided. | ||
| * @remarks | ||
| * - If `defaultValue.onMissingKey` is provided, it will be returned when a key in the path is missing. | ||
| * - If `defaultValue.onError` is provided, it will be returned when any error occurs during the retrieval process. | ||
| * | ||
| * @example Retrieving nested values | ||
| * ```typescript | ||
| * getValue({ a: { b: 1 } }, ['a', 'b']) // 1 | ||
| * getValue({ a: 1 }, ['x'], { onMissingKey: 0 }) // 0 | ||
| * ``` | ||
| */ | ||
| const getValue = (target, path, defaultValue) => { | ||
| if (isArray(path) === false) { | ||
| throw createError('Expected path to be a non-empty array of strings.'); | ||
| } | ||
| if (path.length === 0) | ||
| return target; | ||
| const hasOnMissingKeyDefault = !!(defaultValue && 'onMissingKey' in defaultValue); | ||
| const hasOnErrorDefault = !!(defaultValue && 'onError' in defaultValue); | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| let scope; | ||
| let scopeType; | ||
| let scopeIterable; | ||
| let scopeOperators; | ||
| try { | ||
| scope = target; | ||
| for (let index = 0; index < path.length; index += 1) { | ||
| const key = path[index]; | ||
| if (typeof key !== 'string') { | ||
| throw createError(`Expected path[${index}] to be a string, got ${typeof key}.`); | ||
| } | ||
| scopeType = getType(scope); | ||
| scopeIterable = isIterableType(scopeType); | ||
| /* instanbul ignore next */ | ||
| if (!scopeIterable && hasOnMissingKeyDefault) { | ||
| scope = defaultValue.onMissingKey; | ||
| break; | ||
| } | ||
| scopeOperators = getIterableOperators(scopeType); | ||
| if (scopeIterable && !scopeOperators.getKeys(scope).includes(key) && hasOnMissingKeyDefault) { | ||
| scope = defaultValue.onMissingKey; | ||
| break; | ||
| } | ||
| scope = scopeOperators.read(scope, key); | ||
| } | ||
| } | ||
| catch (error) { | ||
| if (hasOnErrorDefault) { | ||
| scope = defaultValue.onError; | ||
| } | ||
| else { | ||
| throw error; | ||
| } | ||
| } | ||
| return scope; | ||
| }; | ||
| const hasCircularReferenceRecursive = (target, stack, root = false) => { | ||
@@ -519,2 +807,10 @@ if (stack.exists(target)) | ||
| * @returns True if the value contains circular references, false otherwise | ||
| * | ||
| * @example Detecting circular references | ||
| * ```typescript | ||
| * const obj = { a: {} } | ||
| * obj.a.self = obj | ||
| * hasCircularReference(obj) // true | ||
| * hasCircularReference({ a: 1 }) // false | ||
| * ``` | ||
| */ | ||
@@ -533,46 +829,66 @@ const hasCircularReference = (target) => { | ||
| const invalidmaxResults = 'Invalid maxResults argument.'; | ||
| const locateCircularReferenceRecursive = (target, maxResults, path, stack, result, root = false) => { | ||
| if (result.length === maxResults) | ||
| return result; | ||
| if (stack.exists(target)) { | ||
| result.push(new CircularReference(path, path.slice(0, stack.lastSeen(target)))); | ||
| return result; | ||
| } | ||
| const type = getType(target); | ||
| if (!isIterableType(type)) | ||
| return result; | ||
| stack.add(target); | ||
| const { getKeys, read } = getIterableOperators(type); | ||
| const keys = getKeys(target); | ||
| keys.forEach((key) => locateCircularReferenceRecursive(read(target, key), maxResults, [...path, key], stack, result)); | ||
| if (root) | ||
| stack.clear(); | ||
| return result; | ||
| /** | ||
| * Checks if two targets are of the same data type. | ||
| * | ||
| * @param targetA The first target to compare | ||
| * @param targetB The second target to compare | ||
| * @returns The common data type if both targets are of the same type; otherwise, false. | ||
| * | ||
| * @example Comparing data types | ||
| * ```typescript | ||
| * sameType([1], [2]) // 'array' | ||
| * sameType({}, []) // false | ||
| * ``` | ||
| */ | ||
| const sameType = (targetA, targetB) => { | ||
| const firstType = getType(targetA); | ||
| const secondType = getType(targetB); | ||
| return firstType === secondType ? firstType : false; | ||
| }; | ||
| /** | ||
| * Returns a list of locations where circular references occur. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * Checks whether two targets have the same structure. | ||
| * | ||
| * @param target - The value to search for circular references | ||
| * @param maxResults - Maximum number of circular references to find (number or '*' for all) | ||
| * @returns An array of CircularReference objects indicating locations of circular references | ||
| * @remarks | ||
| * For iterable types (arrays, sets, maps, and objects), it checks whether they have the same keys. | ||
| * For other types, it simply checks whether they are of the same type. | ||
| * It supports configuration via `getConfig().samePositionOfOwnProperties` to determine whether the order of keys matters for objects. | ||
| * If supports other registered iterable classes as well. See `registerIterableClass`. | ||
| * @param targetA data to compare | ||
| * @param targetB data to compare | ||
| * @returns The data type if both targets have the same structure, otherwise `false`. | ||
| * | ||
| * @example Comparing structures | ||
| * ```typescript | ||
| * sameStructure({ a: 1, b: 2 }, { a: 'x', b: 'y' }) // 'object' | ||
| * sameStructure({ a: 1 }, { b: 1 }) // false | ||
| * ``` | ||
| */ | ||
| const locateCircularReference = (target, maxResults = 1) => { | ||
| const resultsType = typeof maxResults; | ||
| if (!['string', 'number'].includes(resultsType)) | ||
| throw createError(invalidmaxResults); | ||
| if (resultsType === 'string' && maxResults !== '*') | ||
| throw createError(invalidmaxResults); | ||
| if (resultsType === 'number' && (maxResults < 1 || [NaN, Infinity].includes(maxResults))) | ||
| throw createError(invalidmaxResults); | ||
| const originalSupportStatus = getConfig().detectCircularReferences; | ||
| if (!originalSupportStatus) { | ||
| setConfig({ detectCircularReferences: true }); | ||
| const sameStructure = (targetA, targetB) => { | ||
| const typeMatch = sameType(targetA, targetB); | ||
| if (typeMatch === false) | ||
| return false; | ||
| if (isIterableType(typeMatch)) { | ||
| const aKeys = getKeysFromIterable(targetA, typeMatch); | ||
| const bKeys = getKeysFromIterable(targetB, typeMatch); | ||
| const aKeyCount = aKeys.length; | ||
| const bKeyCount = bKeys.length; | ||
| if (aKeyCount !== bKeyCount) | ||
| return false; | ||
| if (aKeyCount === 0) | ||
| return typeMatch; | ||
| if (getConfig().samePositionOfOwnProperties) { | ||
| for (let i = 0; i < aKeyCount; i += 1) { | ||
| if (aKeys[i] !== bKeys[i]) | ||
| return false; | ||
| } | ||
| } | ||
| else { | ||
| for (let i = 0; i < aKeyCount; i += 1) { | ||
| if (!bKeys.includes(aKeys[i])) | ||
| return false; | ||
| } | ||
| } | ||
| } | ||
| const result = locateCircularReferenceRecursive(target, maxResults, [], referenceStack(), [], true); | ||
| if (!originalSupportStatus) { | ||
| setConfig({ detectCircularReferences: false }); | ||
| } | ||
| return result; | ||
| return typeMatch; | ||
| }; | ||
@@ -678,2 +994,9 @@ | ||
| * @returns True if the values are identical, false otherwise | ||
| * | ||
| * @example Comparing values for identity | ||
| * ```typescript | ||
| * isIdentical({ a: 1 }, { a: 1 }) // true | ||
| * isIdentical([1, 2], [1, 2]) // true | ||
| * isIdentical({ a: 1 }, { a: 2 }) // false | ||
| * ``` | ||
| */ | ||
@@ -688,23 +1011,321 @@ const isIdentical = (targetA, targetB) => { | ||
| const invalidmaxResults = 'Invalid maxResults argument.'; | ||
| /** | ||
| * Checks if the target contains all specified keys. | ||
| * Recursively searches for circular references in an object graph. | ||
| * | ||
| * @param target - The target to check. | ||
| * @param keys - The keys to check for. | ||
| * @returns True if the target contains all specified keys, false otherwise. | ||
| * @param target - The value to search | ||
| * @param maxResults - Maximum number of results to find | ||
| * @param path - Current path in the object graph | ||
| * @param stack - Reference stack for tracking visited objects | ||
| * @param result - Array to collect found circular references | ||
| * @param root - Whether this is the root call | ||
| * @returns Array of CircularReference objects found | ||
| * | ||
| * @example Recursively locating circular references | ||
| * ```typescript | ||
| * const stack = referenceStack() | ||
| * locateCircularReferenceRecursive(obj, 1, [], stack, [], true) | ||
| * ``` | ||
| */ | ||
| const locateCircularReferenceRecursive = (target, maxResults, path, stack, result, root = false) => { | ||
| if (result.length === maxResults) | ||
| return result; | ||
| if (stack.exists(target)) { | ||
| result.push(new CircularReference(path, path.slice(0, stack.lastSeen(target)))); | ||
| return result; | ||
| } | ||
| const type = getType(target); | ||
| if (!isIterableType(type)) | ||
| return result; | ||
| stack.add(target); | ||
| const { getKeys, read } = getIterableOperators(type); | ||
| const keys = getKeys(target); | ||
| keys.forEach((key) => locateCircularReferenceRecursive(read(target, key), maxResults, [...path, key], stack, result)); | ||
| if (root) | ||
| stack.clear(); | ||
| return result; | ||
| }; | ||
| /** | ||
| * Returns a list of locations where circular references occur. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The value to search for circular references | ||
| * @param maxResults - Maximum number of circular references to find (number or '*' for all) | ||
| * @returns An array of CircularReference objects indicating locations of circular references | ||
| * | ||
| * @example Locating circular references | ||
| * ```typescript | ||
| * const obj = { a: {} } | ||
| * obj.a.self = obj | ||
| * locateCircularReference(obj) // [CircularReference { location: ['a', 'self'], target: [] }] | ||
| * ``` | ||
| */ | ||
| const locateCircularReference = (target, maxResults = 1) => { | ||
| const resultsType = typeof maxResults; | ||
| if (!['string', 'number'].includes(resultsType)) | ||
| throw createError(invalidmaxResults); | ||
| if (resultsType === 'string' && maxResults !== '*') | ||
| throw createError(invalidmaxResults); | ||
| if (resultsType === 'number' && (maxResults < 1 || [NaN, Infinity].includes(maxResults))) | ||
| throw createError(invalidmaxResults); | ||
| const originalSupportStatus = getConfig().detectCircularReferences; | ||
| if (!originalSupportStatus) { | ||
| setConfig({ detectCircularReferences: true }); | ||
| } | ||
| const result = locateCircularReferenceRecursive(target, maxResults, [], referenceStack(), [], true); | ||
| if (!originalSupportStatus) { | ||
| setConfig({ detectCircularReferences: false }); | ||
| } | ||
| return result; | ||
| }; | ||
| /** | ||
| * Returns a list of locations where the key name matches a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against key names | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where the key pattern was found | ||
| * | ||
| * @example Locating keys in nested structure | ||
| * ```typescript | ||
| * locateKey({ a: { b: 1 }, c: { b: 2 } }, 'b') // [['a', 'b'], ['c', 'b']] | ||
| * ``` | ||
| */ | ||
| const locateKey = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => match(nextKey) && state.locations.push([...path, nextKey])); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Returns a list of locations where a text value matches a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against text values | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where the text pattern was found | ||
| * | ||
| * @example Locating text values in structure | ||
| * ```typescript | ||
| * locateText({ a: 'hello', b: { c: 'hello' } }, 'hello') // [['a'], ['b', 'c']] | ||
| * ``` | ||
| */ | ||
| const locateText = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (text) => text === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => getType(value) === 'string' && match(value) && state.locations.push(path); | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Registers one or more classes which will be used to identify values as distinct data types. | ||
| * | ||
| * @param classRefs - One or more class references to register. | ||
| * @returns The result of the forEach operation (void) | ||
| * | ||
| * @example Registering custom class types | ||
| * ```typescript | ||
| * registerClassTypes(MyCustomClass, AnotherClass) | ||
| * getType(new MyCustomClass()) // 'MyCustomClass' | ||
| * ``` | ||
| */ | ||
| const registerClassTypes = (...classRefs) => classRefs.forEach((classRef) => !registeredClasses.includes(classRef) && registeredClasses.push(classRef)); | ||
| /** | ||
| * Registers a custom class as iterable, allowing the data utilities API to treat instances | ||
| * as map-like objects with their own unique data type. | ||
| * | ||
| * @param classRef - The class constructor to register | ||
| * @param getKeys - Function that returns all keys from an instance | ||
| * @param read - Function to read a value from an instance by key | ||
| * @param write - Function to write a value to an instance (with optional key) | ||
| * @param remove - Function to remove a key from an instance | ||
| * @param instantiate - Factory function to create new instances (defaults to calling constructor) | ||
| * @remarks | ||
| * Works with objects, arrays, and registered iterable classes. | ||
| * An empty keys array will always return `false`. | ||
| * If the class is already registered, its entry will be updated with the new handlers. | ||
| * | ||
| * @example Registering custom iterable class | ||
| * ```typescript | ||
| * registerIterableClass( | ||
| * MyMap, | ||
| * (m) => [...m.keys()], | ||
| * (m, k) => m.get(k), | ||
| * (m, v, k) => m.set(k, v), | ||
| * (m, k) => m.delete(k) | ||
| * ) | ||
| * ``` | ||
| */ | ||
| const containsKeys = (target, keys) => { | ||
| if (keys.length === 0) | ||
| return false; | ||
| const dataType = getType(target); | ||
| if (isIterableType(dataType) === false) | ||
| return false; | ||
| const targetKeys = getKeysFromIterable(target, dataType); | ||
| return !keys.some((k) => !targetKeys.includes(k)); | ||
| const registerIterableClass = (classRef, getKeys, read, write, remove, instantiate = () => new classRef()) => { | ||
| const existingEntryLocation = registeredIterableClasses.findIndex((entry) => entry.classRef === classRef); | ||
| const GetKeys = (target) => getConfig().detectCircularReferences ? [...getKeys(target)].filter((key) => !isMarker(key)) : getKeys(target); | ||
| const entry = { | ||
| classRef, | ||
| getKeys: GetKeys, | ||
| read, | ||
| write, | ||
| remove, | ||
| instantiate, | ||
| }; | ||
| if (existingEntryLocation >= 0) { | ||
| registeredIterableClasses[existingEntryLocation] = entry; | ||
| return; | ||
| } | ||
| registeredIterableClasses.unshift(entry); | ||
| registerClassTypes(classRef); | ||
| }; | ||
| /** | ||
| * Removes any key names that match a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of keys that were removed. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against key names for removal | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where keys were removed | ||
| * | ||
| * @example Removing keys by pattern | ||
| * ```typescript | ||
| * const obj = { a: 1, temp: 2, b: { temp: 3 } } | ||
| * removeKey(obj, 'temp') // [['temp'], ['b', 'temp']] | ||
| * ``` | ||
| */ | ||
| const removeKey = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, remove } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| if (!match(nextKey)) | ||
| return; | ||
| remove(value, nextKey); | ||
| state.locations.push([...path, nextKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Renames any key names that match a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of keys that were edited. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against key names | ||
| * @param name - The new name to assign to matching keys | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where keys were renamed | ||
| * | ||
| * @example Renaming keys in structure | ||
| * ```typescript | ||
| * const obj = { old: 1, nested: { old: 2 } } | ||
| * renameKey(obj, 'old', 'new') // [['new'], ['nested', 'new']] | ||
| * ``` | ||
| */ | ||
| const renameKey = (target, pattern, name, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| if (typeof name !== 'string') | ||
| throw createError('Expected name to be a string.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const rename = patternIsString ? () => name : (key) => key.replace(pattern, name); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, read, write, remove } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| if (!match(nextKey)) | ||
| return; | ||
| const newKey = rename(nextKey); | ||
| write(value, read(value, nextKey), newKey); | ||
| remove(value, nextKey); | ||
| state.locations.push([...path, newKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Edits any text by replacing any string or substring that matches a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of the original text that were edited. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against text values | ||
| * @param text - The replacement text for matching values | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where text was replaced | ||
| * | ||
| * @example Replacing text in structure | ||
| * ```typescript | ||
| * const obj = { a: 'hello world', b: { c: 'hello' } } | ||
| * replaceText(obj, 'hello', 'hi') // [['a'], ['b', 'c']] | ||
| * ``` | ||
| */ | ||
| const replaceText = (target, pattern, text, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| if (typeof text !== 'string') | ||
| throw createError('Expected name to be a string.'); | ||
| const match = patternIsString ? (text) => text.includes(pattern) : (text) => pattern.test(text); | ||
| const replace = (original) => original.replace(pattern, text); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, read, write } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| const nextValue = read(value, nextKey); | ||
| if (getType(nextValue) !== 'string' || !match(nextValue)) | ||
| return; | ||
| write(value, replace(nextValue), nextKey); | ||
| state.locations.push([...path, nextKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /* eslint-disable @typescript-eslint/no-unused-vars */ | ||
| /** | ||
| * Recursively creates a selective copy of an object based on predicate conditions. | ||
| * | ||
| * @param target - The object to copy | ||
| * @param path - Current path in the object | ||
| * @param includeKey - Predicate to determine if a key should be included | ||
| * @param skipFunctions - Whether to skip function values | ||
| * @param recordSkip - Callback to record skipped data points | ||
| * @returns Partial copy of the target based on predicate | ||
| * | ||
| * @example Basic recursive copy | ||
| * ```typescript | ||
| * selectiveCopyRecursive(obj, [], () => true, false, () => {}) | ||
| * ``` | ||
| */ | ||
| const selectiveCopyRecursive = (target, path, includeKey, skipFunctions, recordSkip) => { | ||
@@ -719,3 +1340,2 @@ const type = getType(target); | ||
| const nextKey = keys[i]; | ||
| // Filter out __proto__ to prevent prototype pollution attacks | ||
| if (nextKey === '__proto__') | ||
@@ -747,2 +1367,7 @@ continue; | ||
| * @returns A partial clone of the target object | ||
| * | ||
| * @example Copying with circular reference handling | ||
| * ```typescript | ||
| * selectiveCopyForCircularReferencesRecursive(obj, [], () => true, false, () => {}, referenceStack(), [], true) | ||
| * ``` | ||
| */ | ||
@@ -761,3 +1386,2 @@ const selectiveCopyForCircularReferencesRecursive = (target, path, includeKey, skipFunctions, recordSkip, stack, circularRefs, root = false) => { | ||
| const nextKey = keys[i]; | ||
| // Filter out __proto__ to prevent prototype pollution attacks | ||
| if (nextKey === '__proto__') | ||
@@ -798,3 +1422,2 @@ continue; | ||
| } | ||
| // Set the circular reference | ||
| const lastKey = startPath[startPath.length - 1]; | ||
@@ -814,3 +1437,3 @@ /* istanbul ignore else -- __proto__ is already filtered during iteration, this is defensive */ | ||
| * This algorithm instead copies function references by default instead. For the same reason getters and setters are not replicate, only their | ||
| * return values. This algorithm can replicate circular references, when configured to do so. | ||
| * return values. This algorithm can replicate circular references, when configured. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
@@ -821,2 +1444,8 @@ * | ||
| * @returns An object containing the cloned value and array of skipped data points | ||
| * | ||
| * @example Selective copying with options | ||
| * ```typescript | ||
| * const { clone, skipped } = selectiveCopy({ a: 1, b: 2 }, { includeKeys: ['a'] }) | ||
| * // clone = { a: 1 }, skipped = [{ path: ['b'], ... }] | ||
| * ``` | ||
| */ | ||
@@ -867,375 +1496,2 @@ const selectiveCopy = (target, options) => { | ||
| const errorMessage = (thing, type) => `Expected ${thing} to be ${type}.`; | ||
| const nextIterationDetails = (path, key, value) => ({ | ||
| nextPath: [...path, key], | ||
| nextValue: value[key], | ||
| }); | ||
| const circularDependencyTraversal = (condition, callback, config, key, path, value, parent, state, stack, root = false) => { | ||
| if (stack.exists(value)) | ||
| return state; | ||
| const ok = condition(config, key, value, path, parent); | ||
| /* istanbul ignore next */ | ||
| if (config.exitEarly) | ||
| return state; | ||
| if (ok) | ||
| callback(key, value, path, state, parent); | ||
| stack.add(value); | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return state; | ||
| const keys = getKeysFromIterable(value, type); | ||
| keys.forEach((key) => { | ||
| const { nextPath, nextValue } = nextIterationDetails(path, key, value); | ||
| circularDependencyTraversal(condition, callback, config, key, nextPath, nextValue, value, state, stack); | ||
| }); | ||
| if (root) | ||
| stack.clear(); | ||
| return state; | ||
| }; | ||
| const nonCircularDependencyTraversal = (condition, callback, config, key, path, value, parent, state) => { | ||
| const ok = condition(config, key, value, path, parent); | ||
| /* istanbul ignore next */ | ||
| if (config.exitEarly) | ||
| return state; | ||
| if (ok) | ||
| callback(key, value, path, state, parent); | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return state; | ||
| const keys = getKeysFromIterable(value, type); | ||
| keys.forEach((key) => { | ||
| const { nextPath, nextValue } = nextIterationDetails(path, key, value); | ||
| nonCircularDependencyTraversal(condition, callback, config, key, nextPath, nextValue, value, state); | ||
| }); | ||
| return state; | ||
| }; | ||
| const traversal = (target, condition, callback, options, state) => { | ||
| if (typeof callback !== 'function') | ||
| throw createError(errorMessage('callback', 'a function')); | ||
| if (!(typeof options === 'object' && !isArray(options))) | ||
| throw createError(errorMessage('options', 'an object')); | ||
| if (!isArray(options.depth)) | ||
| throw createError(errorMessage('options.depth', 'an array')); | ||
| const [startDepth, maxDepth] = options.depth; | ||
| if (startDepth !== void 0 && typeof startDepth !== 'number') | ||
| throw createError(errorMessage('options.depth.0', 'a number')); | ||
| if (maxDepth !== void 0) { | ||
| const maxDepthType = typeof maxDepth; | ||
| if (!['number', 'string'].includes(maxDepthType)) | ||
| throw createError(errorMessage('options.depth.1', 'a number or a string')); | ||
| if (maxDepthType === 'string' && maxDepth !== '*') | ||
| throw createError("Only valid string value in options.depth.1 is '*'."); | ||
| } | ||
| const config = { | ||
| depth: freeze([options.depth[0] ?? 0, options.depth[1] ?? '*']), | ||
| exitEarly: false, | ||
| }; | ||
| const initialArgs = [condition, callback, config, '', [], target, void 0, state]; | ||
| if (getConfig().detectCircularReferences) | ||
| return circularDependencyTraversal(...initialArgs, referenceStack(), true); | ||
| return nonCircularDependencyTraversal(...initialArgs); | ||
| }; | ||
| /** | ||
| * A higher-order function that takes a single predicate function to generate an algorithm that traverses data points | ||
| * on a data structure. See traverse. | ||
| * | ||
| * @param condition - Predicate function to determine whether to traverse a data point | ||
| * @returns A traversal function configured with the condition | ||
| */ | ||
| const createTraversal = (condition) => (target, callback, options, state) => traversal(target, condition, callback, options ?? { depth: [0, '*'] }, state ?? {}); | ||
| const condition = (config, key, value, path) => !(path.length < config.depth[0] || config.depth[1] < path.length); | ||
| const traverseBetweenDepthRange = createTraversal(condition); | ||
| /** | ||
| * Invokes a callback function for every data point in the data structure of the target value to let you do read and write operations. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * | ||
| * @param target - The value to traverse | ||
| * @param callback - Function to invoke for each data point | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @param state - Optional state object to maintain across traversal callbacks | ||
| * @returns The state object after traversal completes | ||
| */ | ||
| const traverse = (target, callback, options, state) => traverseBetweenDepthRange(target, callback, options, state); | ||
| /** | ||
| * Gets the value at the specified path from the target. | ||
| * | ||
| * @param target - The target to get the value from. | ||
| * @param path - The path to the value. | ||
| * @param defaultValue - The default value to return if the path does not exist or an error occurs. | ||
| * @returns The value at the specified path or the default value. | ||
| * @throws {Error} Will throw an error if the path is not a non-empty array of strings and no default value for errors is provided. | ||
| * @remarks | ||
| * - If `defaultValue.onMissingKey` is provided, it will be returned when a key in the path is missing. | ||
| * - If `defaultValue.onError` is provided, it will be returned when any error occurs during the retrieval process. | ||
| */ | ||
| const getValue = (target, path, defaultValue) => { | ||
| if (isArray(path) === false) { | ||
| throw createError('Expected path to be a non-empty array of strings.'); | ||
| } | ||
| if (path.length === 0) | ||
| return target; | ||
| const hasOnMissingKeyDefault = !!(defaultValue && 'onMissingKey' in defaultValue); | ||
| const hasOnErrorDefault = !!(defaultValue && 'onError' in defaultValue); | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| let scope; | ||
| let scopeType; | ||
| let scopeIterable; | ||
| let scopeOperators; | ||
| try { | ||
| scope = target; | ||
| for (let index = 0; index < path.length; index += 1) { | ||
| const key = path[index]; | ||
| if (typeof key !== 'string') { | ||
| throw createError(`Expected path[${index}] to be a string, got ${typeof key}.`); | ||
| } | ||
| scopeType = getType(scope); | ||
| scopeIterable = isIterableType(scopeType); | ||
| /* instanbul ignore next */ | ||
| if (!scopeIterable && hasOnMissingKeyDefault) { | ||
| scope = defaultValue.onMissingKey; | ||
| break; | ||
| } | ||
| scopeOperators = getIterableOperators(scopeType); | ||
| if (scopeIterable && !scopeOperators.getKeys(scope).includes(key) && hasOnMissingKeyDefault) { | ||
| scope = defaultValue.onMissingKey; | ||
| break; | ||
| } | ||
| scope = scopeOperators.read(scope, key); | ||
| } | ||
| } | ||
| catch (error) { | ||
| if (hasOnErrorDefault) { | ||
| scope = defaultValue.onError; | ||
| } | ||
| else { | ||
| throw error; | ||
| } | ||
| } | ||
| return scope; | ||
| }; | ||
| /** | ||
| * Returns the total depth of a value's data structure, | ||
| * and returns a list of locations that are the most deeply nested. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to analyze for depth | ||
| * @returns A tuple containing the maximum depth and an array of paths to the deepest locations | ||
| */ | ||
| const getDepth = (target) => { | ||
| const trackDepth = (key, value, path, state) => { | ||
| if (state.depth < path.length) { | ||
| state.depth = path.length; | ||
| state.locations = [path]; | ||
| return; | ||
| } | ||
| if (state.depth === path.length) { | ||
| state.locations.push(path); | ||
| } | ||
| }; | ||
| const options = { depth: [0, '*'] }; | ||
| const state = { depth: 0, locations: [] }; | ||
| const { depth, locations } = traverse(target, trackDepth, options, state); | ||
| return [depth, locations]; | ||
| }; | ||
| /** | ||
| * Returns a list of locations where the key name matches a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against key names | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where the key pattern was found | ||
| */ | ||
| const locateKey = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => match(nextKey) && state.locations.push([...path, nextKey])); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Safe copies of Set built-in via factory function. | ||
| * | ||
| * Since constructors cannot be safely captured via Object.assign, this module | ||
| * provides a factory function that uses Reflect.construct internally. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/set | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Set = globalThis.Set; | ||
| const _Reflect = globalThis.Reflect; | ||
| /** | ||
| * (Safe copy) Creates a new Set using the captured Set constructor. | ||
| * Use this instead of `new Set()`. | ||
| * | ||
| * @param iterable - Optional iterable of values. | ||
| * @returns A new Set instance. | ||
| */ | ||
| const createSet = (iterable) => _Reflect.construct(_Set, iterable ? [iterable] : []); | ||
| /** | ||
| * Returns a list of unique key names that match a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against key names (defaults to matching all keys) | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of unique key names that match the pattern | ||
| */ | ||
| const getUniqueKeys = (target, pattern = /.+/, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => match(nextKey) && state.names.add(nextKey)); | ||
| }; | ||
| return from(traverse(target, callback, { depth: [0, '*'], ...options }, { | ||
| names: createSet(), | ||
| }).names.values()); | ||
| }; | ||
| /** | ||
| * Returns a list of locations where a text value matches a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against text values | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where the text pattern was found | ||
| */ | ||
| const locateText = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (text) => text === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => getType(value) === 'string' && match(value) && state.locations.push(path); | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Renames any key names that match a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of keys that were edited. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against key names | ||
| * @param name - The new name to assign to matching keys | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where keys were renamed | ||
| */ | ||
| const renameKey = (target, pattern, name, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| if (typeof name !== 'string') | ||
| throw createError('Expected name to be a string.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const rename = patternIsString ? () => name : (key) => key.replace(pattern, name); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, read, write, remove } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| if (!match(nextKey)) | ||
| return; | ||
| const newKey = rename(nextKey); | ||
| write(value, read(value, nextKey), newKey); | ||
| remove(value, nextKey); | ||
| state.locations.push([...path, newKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Removes any key names that match a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of keys that were removed. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against key names for removal | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where keys were removed | ||
| */ | ||
| const removeKey = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, remove } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| if (!match(nextKey)) | ||
| return; | ||
| remove(value, nextKey); | ||
| state.locations.push([...path, nextKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Edits any text by replacing any string or substring that matches a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of the original text that were edited. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against text values | ||
| * @param text - The replacement text for matching values | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where text was replaced | ||
| */ | ||
| const replaceText = (target, pattern, text, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| if (typeof text !== 'string') | ||
| throw createError('Expected name to be a string.'); | ||
| const match = patternIsString ? (text) => text.includes(pattern) : (text) => pattern.test(text); | ||
| const replace = (original) => original.replace(pattern, text); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, read, write } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| const nextValue = read(value, nextKey); | ||
| if (getType(nextValue) !== 'string' || !match(nextValue)) | ||
| return; | ||
| write(value, replace(nextValue), nextKey); | ||
| state.locations.push([...path, nextKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| exports.CircularReference = CircularReference; | ||
@@ -1283,2 +1539,1 @@ exports.containsKeys = containsKeys; | ||
| })({}); | ||
| //# sourceMappingURL=index.iife.js.map |
@@ -1,2 +0,1 @@ | ||
| var HyperfrontendDataUtils=function(e){"use strict";const t=globalThis.Object,r=t.freeze,n=t.keys,s=e=>!("string"!=typeof e||!e.startsWith("__$"))&&/^__\$[0-9]+$/.test(e),o=[],i=[{classRef:Array,instantiate:()=>[],getKeys:e=>{const t=n(e);return f().detectCircularReferences?t.filter(e=>!s(e)):t},read:(e,t)=>e[t],write:(e,t,r)=>e[r]=t,remove:(e,t)=>e.splice(t,1)},{classRef:Object,instantiate:()=>({}),getKeys:e=>{const t=n(e);return f().detectCircularReferences?t.filter(e=>!s(e)):t},read:(e,t)=>e[t],write:(e,t,r)=>e[r]=t,remove:(e,t)=>delete e[t]}];let c=!1,a=!1;const l=e=>{c="boolean"==typeof e.samePositionOfOwnProperties?e.samePositionOfOwnProperties:c||!1,a="boolean"==typeof e.detectCircularReferences?e.detectCircularReferences:a||!1},f=()=>({samePositionOfOwnProperties:c,detectCircularReferences:a}),u=(...e)=>e.forEach(e=>!o.includes(e)&&o.push(e)),h=(...e)=>{if(0===e.length){for(;0!==o.length;)o.shift();return}const t=e.map(e=>o.indexOf(e)).filter(e=>e>=0).sort();for(;0!==t.length;)o.splice(t[t.length-1],1),t.pop()},p=globalThis.Array,d=p.isArray,g=p.from,y=e=>{if(null===e)return"null";const t=typeof e;if("object"===t){if(d(e))return"array";for(const t of o)if(e instanceof t)return t.name}return t},b=(e,t)=>{const r=y(e);return r===y(t)&&r},m=(e,t)=>{"array"===t&&(t=Array.name),"object"===t&&(t=Object.name);const r=i.find(({classRef:e})=>t===e.name);return void 0===r?[]:r.getKeys(e)},x=()=>i.map(({classRef:e})=>{const t=e.name;return t===Object.name?"object":t===Array.name?"array":t}),w=e=>x().includes(e),R=(e,t)=>{const r=b(e,t);if(!1===r)return!1;if(w(r)){const n=m(e,r),s=m(t,r),o=n.length;if(o!==s.length)return!1;if(0===o)return r;if(f().samePositionOfOwnProperties){for(let e=0;e<o;e+=1)if(n[e]!==s[e])return!1}else for(let e=0;e<o;e+=1)if(!s.includes(n[e]))return!1}return r},E=e=>w(y(e)),v=globalThis.Error,C=globalThis.Reflect,K=(e,t)=>C.construct(v,[e,t]);class _{location;target;keyDelimiter="·";delimiter=" → ";constructor(e,t){if(!d(e)||0===e.length)throw K("Expected location to be a list with at list one string value.");if(!d(t))throw K("Expected target to be a list.");this.location={path:e},this.target={path:t}}get depth(){return this.location.path.length-this.target.path.length}toString=()=>`${this.join(this.location)}${this.delimiter}${this.join(this.target)}`;toJSON=()=>this.toString();join=({path:e})=>e.join(this.keyDelimiter)}const T=e=>{const{getKeys:t,read:r,write:n,remove:s,instantiate:o}=i.find(t=>t.classRef.name.toLowerCase()===e.toLowerCase());return{getKeys:t,read:r,write:n,remove:s,instantiate:o}},O=globalThis.Map,k=globalThis.Reflect,S=globalThis.Date,$=globalThis.Reflect;const j=globalThis.Math,P=j.round,I=j.random,z=()=>`__$${`${P(1e13*I())}${function(...e){return $.construct(S,e)}().getTime()}`}`,A=()=>{const e=k.construct(O,t?[t]:[]);var t;const r=z(),n=t=>!!E(t)&&(r in t&&e.has(t[r]));return{add:t=>(t=>{E(t)&&!n(t)&&(t[r]=Symbol(),e.set(t[r],[r,t,e.size]))})(t),exists:e=>n(e),lastSeen:t=>(t=>{if(!E(t))return null;const n=e.get(t[r]);return n?n[2]-e.size:null})(t),clear:()=>(e.forEach(([e,t])=>{delete t[e]}),e.clear()),get size(){return e.size}}},M=(e,t,r=!1)=>{if(t.exists(e))return!0;const n=y(e);if(!w(n))return!1;t.add(e);const{getKeys:s,read:o}=T(n),i=s(e).some(r=>M(o(e,r),t));return r&&t.clear(),i},D="Invalid maxResults argument.",F=(e,t,r,n,s,o=!1)=>{if(s.length===t)return s;if(n.exists(e))return s.push(new _(r,r.slice(0,n.lastSeen(e)))),s;const i=y(e);if(!w(i))return s;n.add(e);const{getKeys:c,read:a}=T(i);return c(e).forEach(o=>F(a(e,o),t,[...r,o],n,s)),o&&n.clear(),s},V=(e,t)=>{if(e===t)return!0;const r=R(e,t);if(!1===r)return r;if("function"===r)return e.toString()===t.toString();if(!w(r))return e===t;const{getKeys:n,read:s}=T(r),o=n(e),i=o.length;for(let r=0;r<i;r+=1){const n=o[r];if(!V(s(e,n),s(t,n)))return!1}return!0},N=()=>{},L=(e,t,...r)=>{const n=()=>(r[0].add(e),r[1].add(t)),s=(e=>e.every(e=>!e.size))(r)?(n(),()=>(e=>e.forEach(e=>e.clear()))(r)):N;if(e===t)return s(),!0;const o=R(e,t);if(!1===o)return s(),o;if("function"===o)return s(),e.toString()===t.toString();if(!w(o))return s(),e===t;const{getKeys:i,read:c}=T(o),a=i(e),l=a.length;for(let o=0;o<l;o+=1){const i=a[o],l=c(e,i),f=c(t,i),u=r[0].exists(l);if(u!==r[1].exists(f))return s(),!1;if(u){if(r[0].lastSeen(l)!==r[1].lastSeen(f))return s(),!1}else if(n(),!L(l,f,...r))return s(),!1}return s(),!0},U=(e,t,r,n,s)=>{const o=y(e);if(!w(o))return e;const{instantiate:i,getKeys:c,read:a,write:l}=T(o),f=i(),u=c(e);for(let o=0;o<u.length;o+=1){const i=u[o];if("__proto__"===i)continue;const c=a(e,i),h=t.concat(i),p=y(c);!r(c,h,i,p)||n&&"function"===p?s(c,h,i,p):l(f,U(c,h,r,n,s),i)}return f},q=(e,t,r,n,s,o,i,c=!1)=>{c&&o.add(e);const a=y(e);if(!w(a))return e;const{instantiate:l,getKeys:f,read:u,write:h}=T(a),p=l(),d=f(e);for(let c=0;c<d.length;c+=1){const a=d[c];if("__proto__"===a)continue;const l=u(e,a),f=t.concat(a),g=y(l);if(!r(l,f,a,g)||n&&"function"===g){s(l,f,a,g);continue}o.exists(l)?i.push({startPath:f,destinationPath:f.slice(0,o.lastSeen(l))}):(o.add(l),h(p,q(l,f,r,n,s,o,i),a))}return c&&(i.forEach(({startPath:e,destinationPath:t})=>{let[r,n]=[p,p];for(let t=0;t<e.length-1;t+=1)"__proto__"!==e[t]&&(r=r[e[t]]);for(let e=0;e<t.length;e+=1)"__proto__"!==t[e]&&(n=n[t[e]]);const s=e[e.length-1];"__proto__"!==s&&(r[s]=n)}),o.clear()),p},H=(e,t)=>`Expected ${e} to be ${t}.`,J=(e,t,r)=>({nextPath:[...e,t],nextValue:r[t]}),W=(e,t,r,n,s,o,i,c,a,l=!1)=>{if(a.exists(o))return c;const f=e(r,n,o,s,i);if(r.exitEarly)return c;f&&t(n,o,s,c,i),a.add(o);const u=y(o);if(!w(u))return c;return m(o,u).forEach(n=>{const{nextPath:i,nextValue:l}=J(s,n,o);W(e,t,r,n,i,l,o,c,a)}),l&&a.clear(),c},B=(e,t,r,n,s,o,i,c)=>{const a=e(r,n,o,s,i);if(r.exitEarly)return c;a&&t(n,o,s,c,i);const l=y(o);if(!w(l))return c;return m(o,l).forEach(n=>{const{nextPath:i,nextValue:a}=J(s,n,o);B(e,t,r,n,i,a,o,c)}),c},G=e=>(t,n,s,o)=>((e,t,n,s,o)=>{if("function"!=typeof n)throw K(H("callback","a function"));if("object"!=typeof s||d(s))throw K(H("options","an object"));if(!d(s.depth))throw K(H("options.depth","an array"));const[i,c]=s.depth;if(void 0!==i&&"number"!=typeof i)throw K(H("options.depth.0","a number"));if(void 0!==c){const e=typeof c;if(!["number","string"].includes(e))throw K(H("options.depth.1","a number or a string"));if("string"===e&&"*"!==c)throw K("Only valid string value in options.depth.1 is '*'.")}const a=[t,n,{depth:r([s.depth[0]??0,s.depth[1]??"*"]),exitEarly:!1},"",[],e,void 0,o];return f().detectCircularReferences?W(...a,A(),!0):B(...a)})(t,e,n,s??{depth:[0,"*"]},o??{}),Q=G((e,t,r,n)=>!(n.length<e.depth[0]||e.depth[1]<n.length)),X=(e,t,r,n)=>Q(e,t,r,n),Y=globalThis.Set,Z=globalThis.Reflect;return e.CircularReference=_,e.containsKeys=(e,t)=>{if(0===t.length)return!1;const r=y(e);if(!1===w(r))return!1;const n=m(e,r);return!t.some(e=>!n.includes(e))},e.createTraversal=G,e.deregisterClassTypes=h,e.deregisterIterableClass=(...e)=>{if(0===e.length)for(let e=i.length-1;e>=0;e--){const t=i[e].classRef;[Array,Object].includes(t)||i.splice(e,1)}else{const t=e.map(e=>i.findIndex(t=>t.classRef===e)).filter(e=>e>=0).sort();for(;t.length>0;)i.splice(t[t.length-1],1),t.pop()}h(...e)},e.getConfig=f,e.getDepth=e=>{const{depth:t,locations:r}=X(e,(e,t,r,n)=>{if(n.depth<r.length)return n.depth=r.length,void(n.locations=[r]);n.depth===r.length&&n.locations.push(r)},{depth:[0,"*"]},{depth:0,locations:[]});return[t,r]},e.getIterableOperators=T,e.getIterableTypes=x,e.getKeysFromIterable=m,e.getType=y,e.getUniqueKeys=(e,t=/.+/,r)=>{const n="string"==typeof t;if(!(n||t instanceof RegExp))throw K("Expected pattern to be either a string of a regular expression.");const s=n?e=>e===t:e=>t.test(e);return g(X(e,(e,t,r,n)=>{const o=y(t);if(!w(o))return;const{getKeys:i}=T(o);i(t).forEach(e=>s(e)&&n.names.add(e))},{depth:[0,"*"],...r},{names:Z.construct(Y,o?[o]:[])}).names.values());var o},e.getValue=(e,t,r)=>{if(!1===d(t))throw K("Expected path to be a non-empty array of strings.");if(0===t.length)return e;const n=!(!r||!("onMissingKey"in r)),s=!(!r||!("onError"in r));let o,i,c,a;try{o=e;for(let e=0;e<t.length;e+=1){const s=t[e];if("string"!=typeof s)throw K(`Expected path[${e}] to be a string, got ${typeof s}.`);if(i=y(o),c=w(i),!c&&n){o=r.onMissingKey;break}if(a=T(i),c&&!a.getKeys(o).includes(s)&&n){o=r.onMissingKey;break}o=a.read(o,s)}}catch(e){if(!s)throw e;o=r.onError}return o},e.hasCircularReference=e=>{const t=f().detectCircularReferences;t||l({detectCircularReferences:!0});const r=M(e,A(),!0);return t||l({detectCircularReferences:!1}),r},e.isIdentical=(e,t)=>{const r=[e,t];return f().detectCircularReferences?L(...r,A(),A()):V(...r)},e.isIterable=E,e.isIterableType=w,e.isMarker=s,e.locateCircularReference=(e,t=1)=>{const r=typeof t;if(!["string","number"].includes(r))throw K(D);if("string"===r&&"*"!==t)throw K(D);if("number"===r&&(t<1||[NaN,1/0].includes(t)))throw K(D);const n=f().detectCircularReferences;n||l({detectCircularReferences:!0});const s=F(e,t,[],A(),[],!0);return n||l({detectCircularReferences:!1}),s},e.locateCircularReferenceRecursive=F,e.locateKey=(e,t,r)=>{const n="string"==typeof t;if(!(n||t instanceof RegExp))throw K("Expected pattern to be either a string of a regular expression.");const s=n?e=>e===t:e=>t.test(e);return X(e,(e,t,r,n)=>{const o=y(t);if(!w(o))return;const{getKeys:i}=T(o);i(t).forEach(e=>s(e)&&n.locations.push([...r,e]))},{depth:[0,"*"],...r},{locations:[]}).locations},e.locateText=(e,t,r)=>{const n="string"==typeof t;if(!(n||t instanceof RegExp))throw K("Expected pattern to be either a string of a regular expression.");const s=n?e=>e===t:e=>t.test(e);return X(e,(e,t,r,n)=>"string"===y(t)&&s(t)&&n.locations.push(r),{depth:[0,"*"],...r},{locations:[]}).locations},e.marker=z,e.referenceStack=A,e.registerClassTypes=u,e.registerIterableClass=(e,t,r,n,o,c=()=>new e)=>{const a=i.findIndex(t=>t.classRef===e),l={classRef:e,getKeys:e=>f().detectCircularReferences?[...t(e)].filter(e=>!s(e)):t(e),read:r,write:n,remove:o,instantiate:c};a>=0?i[a]=l:(i.unshift(l),u(e))},e.registeredClasses=o,e.registeredIterableClasses=i,e.removeKey=(e,t,r)=>{const n="string"==typeof t;if(!(n||t instanceof RegExp))throw K("Expected pattern to be either a string of a regular expression.");const s=n?e=>e===t:e=>t.test(e);return X(e,(e,t,r,n)=>{const o=y(t);if(!w(o))return;const{getKeys:i,remove:c}=T(o);i(t).forEach(e=>{s(e)&&(c(t,e),n.locations.push([...r,e]))})},{depth:[0,"*"],...r},{locations:[]}).locations},e.renameKey=(e,t,r,n)=>{const s="string"==typeof t;if(!(s||t instanceof RegExp))throw K("Expected pattern to be either a string of a regular expression.");if("string"!=typeof r)throw K("Expected name to be a string.");const o=s?e=>e===t:e=>t.test(e),i=s?()=>r:e=>e.replace(t,r);return X(e,(e,t,r,n)=>{const s=y(t);if(!w(s))return;const{getKeys:c,read:a,write:l,remove:f}=T(s);c(t).forEach(e=>{if(!o(e))return;const s=i(e);l(t,a(t,e),s),f(t,e),n.locations.push([...r,s])})},{depth:[0,"*"],...n},{locations:[]}).locations},e.replaceText=(e,t,r,n)=>{const s="string"==typeof t;if(!(s||t instanceof RegExp))throw K("Expected pattern to be either a string of a regular expression.");if("string"!=typeof r)throw K("Expected name to be a string.");const o=s?e=>e.includes(t):e=>t.test(e);return X(e,(e,n,s,i)=>{const c=y(n);if(!w(c))return;const{getKeys:a,read:l,write:f}=T(c);a(n).forEach(e=>{const c=l(n,e);"string"===y(c)&&o(c)&&(f(n,c.replace(t,r),e),i.locations.push([...s,e]))})},{depth:[0,"*"],...n},{locations:[]}).locations},e.sameStructure=R,e.sameType=b,e.selectiveCopy=(e,t)=>{if(void 0!==t&&"object"!==y(t))throw K("Invalid options argument.");t||(t={}),t.skipFunctions||(t.skipFunctions=!1);const r=["includeKeys","excludeKeys","include","exclude"];let n="";for(let e=0;e<r.length;e+=1){const s=r[e]in t;if(n&&s)throw K(`Options ${n} and ${r[e]} are mutually exclusive.`);s&&(n=r[e])}const{includeKeys:s,excludeKeys:o,include:i,exclude:c,skipFunctions:a}=t;let l=(e,t,r,n)=>!0;switch(n){case"includeKeys":l=(e,t,r,n)=>1!==t.length||s.includes(r);break;case"excludeKeys":l=(e,t,r,n)=>1!==t.length||!o.includes(r);break;case"include":l=i;break;case"exclude":l=(e,t,r,n)=>!c(e,t,r,n)}const u=[],h=(e,t,r,n)=>u.push({target:e,path:t,key:r,dataType:n});let p;return p=f().detectCircularReferences?q(e,[],l,a,h,A(),[],!0):U(e,[],l,a,h),{clone:p,skipped:u}},e.selectiveCopyForCircularReferencesRecursive=q,e.selectiveCopyRecursive=U,e.setConfig=l,e.traverse=X,e}({}); | ||
| //# sourceMappingURL=index.iife.min.js.map | ||
| var HyperfrontendDataUtils=function(e){"use strict";const t=globalThis.Array,r=t.isArray,n=t.from,s=globalThis.Error,o=globalThis.Reflect,i=(e,t)=>o.construct(s,[e,t]);class c{location;target;keyDelimiter="·";delimiter=" → ";constructor(e,t){if(!r(e)||0===e.length)throw i("Expected location to be a list with at list one string value.");if(!r(t))throw i("Expected target to be a list.");this.location={path:e},this.target={path:t}}get depth(){return this.location.path.length-this.target.path.length}toString=()=>`${this.join(this.location)}${this.delimiter}${this.join(this.target)}`;toJSON=()=>this.toString();join=({path:e})=>e.join(this.keyDelimiter)}const a=globalThis.Object,l=a.freeze,f=a.keys,u=e=>!("string"!=typeof e||!e.startsWith("__$"))&&/^__\$[0-9]+$/.test(e),h=[],p=[{classRef:Array,instantiate:()=>[],getKeys:e=>{const t=f(e);return b().detectCircularReferences?t.filter(e=>!u(e)):t},read:(e,t)=>e[t],write:(e,t,r)=>e[r]=t,remove:(e,t)=>e.splice(t,1)},{classRef:Object,instantiate:()=>({}),getKeys:e=>{const t=f(e);return b().detectCircularReferences?t.filter(e=>!u(e)):t},read:(e,t)=>e[t],write:(e,t,r)=>e[r]=t,remove:(e,t)=>delete e[t]}];let d=!1,g=!1;const y=e=>{d="boolean"==typeof e.samePositionOfOwnProperties?e.samePositionOfOwnProperties:d||!1,g="boolean"==typeof e.detectCircularReferences?e.detectCircularReferences:g||!1},b=()=>({samePositionOfOwnProperties:d,detectCircularReferences:g}),m=(e,t)=>{"array"===t&&(t=Array.name),"object"===t&&(t=Object.name);const r=p.find(({classRef:e})=>t===e.name);return void 0===r?[]:r.getKeys(e)},x=e=>{if(null===e)return"null";const t=typeof e;if("object"===t){if(r(e))return"array";for(const t of h)if(e instanceof t)return t.name}return t},w=()=>p.map(({classRef:e})=>{const t=e.name;return t===Object.name?"object":t===Array.name?"array":t}),R=e=>w().includes(e),E=(...e)=>{if(0===e.length){for(;0!==h.length;)h.shift();return}const t=e.map(e=>h.indexOf(e)).filter(e=>e>=0).sort();for(;0!==t.length;)h.splice(t[t.length-1],1),t.pop()},v=globalThis.Map,C=globalThis.Reflect,K=e=>R(x(e)),_=globalThis.Date,T=globalThis.Reflect;const O=globalThis.Math,k=O.round,S=O.random,$=()=>`__$${`${k(1e13*S())}${function(...e){return T.construct(_,e)}().getTime()}`}`,j=()=>{const e=C.construct(v,t?[t]:[]);var t;const r=$(),n=t=>!!K(t)&&(r in t&&e.has(t[r]));return{add:t=>(t=>{K(t)&&!n(t)&&(t[r]=Symbol(),e.set(t[r],[r,t,e.size]))})(t),exists:e=>n(e),lastSeen:t=>(t=>{if(!K(t))return null;const n=e.get(t[r]);return n?n[2]-e.size:null})(t),clear:()=>(e.forEach(([e,t])=>{delete t[e]}),e.clear()),get size(){return e.size}}},P=(e,t)=>`Expected ${e} to be ${t}.`,I=(e,t,r)=>({nextPath:[...e,t],nextValue:r[t]}),z=(e,t,r,n,s,o,i,c,a,l=!1)=>{if(a.exists(o))return c;const f=e(r,n,o,s,i);if(r.exitEarly)return c;f&&t(n,o,s,c,i),a.add(o);const u=x(o);if(!R(u))return c;return m(o,u).forEach(n=>{const{nextPath:i,nextValue:l}=I(s,n,o);z(e,t,r,n,i,l,o,c,a)}),l&&a.clear(),c},A=(e,t,r,n,s,o,i,c)=>{const a=e(r,n,o,s,i);if(r.exitEarly)return c;a&&t(n,o,s,c,i);const l=x(o);if(!R(l))return c;return m(o,l).forEach(n=>{const{nextPath:i,nextValue:a}=I(s,n,o);A(e,t,r,n,i,a,o,c)}),c},M=e=>(t,n,s,o)=>((e,t,n,s,o)=>{if("function"!=typeof n)throw i(P("callback","a function"));if("object"!=typeof s||r(s))throw i(P("options","an object"));if(!r(s.depth))throw i(P("options.depth","an array"));const[c,a]=s.depth;if(void 0!==c&&"number"!=typeof c)throw i(P("options.depth.0","a number"));if(void 0!==a){const e=typeof a;if(!["number","string"].includes(e))throw i(P("options.depth.1","a number or a string"));if("string"===e&&"*"!==a)throw i("Only valid string value in options.depth.1 is '*'.")}const f=[t,n,{depth:l([s.depth[0]??0,s.depth[1]??"*"]),exitEarly:!1},"",[],e,void 0,o];return b().detectCircularReferences?z(...f,j(),!0):A(...f)})(t,e,n,s??{depth:[0,"*"]},o??{}),D=M((e,t,r,n)=>!(n.length<e.depth[0]||e.depth[1]<n.length)),F=(e,t,r,n)=>D(e,t,r,n),V=e=>{const{getKeys:t,read:r,write:n,remove:s,instantiate:o}=p.find(t=>t.classRef.name.toLowerCase()===e.toLowerCase());return{getKeys:t,read:r,write:n,remove:s,instantiate:o}},N=globalThis.Set,L=globalThis.Reflect,U=(e,t,r=!1)=>{if(t.exists(e))return!0;const n=x(e);if(!R(n))return!1;t.add(e);const{getKeys:s,read:o}=V(n),i=s(e).some(r=>U(o(e,r),t));return r&&t.clear(),i},q=(e,t)=>{const r=x(e);return r===x(t)&&r},H=(e,t)=>{const r=q(e,t);if(!1===r)return!1;if(R(r)){const n=m(e,r),s=m(t,r),o=n.length;if(o!==s.length)return!1;if(0===o)return r;if(b().samePositionOfOwnProperties){for(let e=0;e<o;e+=1)if(n[e]!==s[e])return!1}else for(let e=0;e<o;e+=1)if(!s.includes(n[e]))return!1}return r},J=(e,t)=>{if(e===t)return!0;const r=H(e,t);if(!1===r)return r;if("function"===r)return e.toString()===t.toString();if(!R(r))return e===t;const{getKeys:n,read:s}=V(r),o=n(e),i=o.length;for(let r=0;r<i;r+=1){const n=o[r];if(!J(s(e,n),s(t,n)))return!1}return!0},W=()=>{},B=(e,t,...r)=>{const n=()=>(r[0].add(e),r[1].add(t)),s=(e=>e.every(e=>!e.size))(r)?(n(),()=>(e=>e.forEach(e=>e.clear()))(r)):W;if(e===t)return s(),!0;const o=H(e,t);if(!1===o)return s(),o;if("function"===o)return s(),e.toString()===t.toString();if(!R(o))return s(),e===t;const{getKeys:i,read:c}=V(o),a=i(e),l=a.length;for(let o=0;o<l;o+=1){const i=a[o],l=c(e,i),f=c(t,i),u=r[0].exists(l);if(u!==r[1].exists(f))return s(),!1;if(u){if(r[0].lastSeen(l)!==r[1].lastSeen(f))return s(),!1}else if(n(),!B(l,f,...r))return s(),!1}return s(),!0},G="Invalid maxResults argument.",Q=(e,t,r,n,s,o=!1)=>{if(s.length===t)return s;if(n.exists(e))return s.push(new c(r,r.slice(0,n.lastSeen(e)))),s;const i=x(e);if(!R(i))return s;n.add(e);const{getKeys:a,read:l}=V(i);return a(e).forEach(o=>Q(l(e,o),t,[...r,o],n,s)),o&&n.clear(),s},X=(...e)=>e.forEach(e=>!h.includes(e)&&h.push(e)),Y=(e,t,r,n,s)=>{const o=x(e);if(!R(o))return e;const{instantiate:i,getKeys:c,read:a,write:l}=V(o),f=i(),u=c(e);for(let o=0;o<u.length;o+=1){const i=u[o];if("__proto__"===i)continue;const c=a(e,i),h=t.concat(i),p=x(c);!r(c,h,i,p)||n&&"function"===p?s(c,h,i,p):l(f,Y(c,h,r,n,s),i)}return f},Z=(e,t,r,n,s,o,i,c=!1)=>{c&&o.add(e);const a=x(e);if(!R(a))return e;const{instantiate:l,getKeys:f,read:u,write:h}=V(a),p=l(),d=f(e);for(let c=0;c<d.length;c+=1){const a=d[c];if("__proto__"===a)continue;const l=u(e,a),f=t.concat(a),g=x(l);if(!r(l,f,a,g)||n&&"function"===g){s(l,f,a,g);continue}o.exists(l)?i.push({startPath:f,destinationPath:f.slice(0,o.lastSeen(l))}):(o.add(l),h(p,Z(l,f,r,n,s,o,i),a))}return c&&(i.forEach(({startPath:e,destinationPath:t})=>{let[r,n]=[p,p];for(let t=0;t<e.length-1;t+=1)"__proto__"!==e[t]&&(r=r[e[t]]);for(let e=0;e<t.length;e+=1)"__proto__"!==t[e]&&(n=n[t[e]]);const s=e[e.length-1];"__proto__"!==s&&(r[s]=n)}),o.clear()),p};return e.CircularReference=c,e.containsKeys=(e,t)=>{if(0===t.length)return!1;const r=x(e);if(!1===R(r))return!1;const n=m(e,r);return!t.some(e=>!n.includes(e))},e.createTraversal=M,e.deregisterClassTypes=E,e.deregisterIterableClass=(...e)=>{if(0===e.length)for(let e=p.length-1;e>=0;e--){const t=p[e].classRef;[Array,Object].includes(t)||p.splice(e,1)}else{const t=e.map(e=>p.findIndex(t=>t.classRef===e)).filter(e=>e>=0).sort();for(;t.length>0;)p.splice(t[t.length-1],1),t.pop()}E(...e)},e.getConfig=b,e.getDepth=e=>{const{depth:t,locations:r}=F(e,(e,t,r,n)=>{if(n.depth<r.length)return n.depth=r.length,void(n.locations=[r]);n.depth===r.length&&n.locations.push(r)},{depth:[0,"*"]},{depth:0,locations:[]});return[t,r]},e.getIterableOperators=V,e.getIterableTypes=w,e.getKeysFromIterable=m,e.getType=x,e.getUniqueKeys=(e,t=/.+/,r)=>{const s="string"==typeof t;if(!(s||t instanceof RegExp))throw i("Expected pattern to be either a string of a regular expression.");const o=s?e=>e===t:e=>t.test(e);return n(F(e,(e,t,r,n)=>{const s=x(t);if(!R(s))return;const{getKeys:i}=V(s);i(t).forEach(e=>o(e)&&n.names.add(e))},{depth:[0,"*"],...r},{names:L.construct(N,c?[c]:[])}).names.values());var c},e.getValue=(e,t,n)=>{if(!1===r(t))throw i("Expected path to be a non-empty array of strings.");if(0===t.length)return e;const s=!(!n||!("onMissingKey"in n)),o=!(!n||!("onError"in n));let c,a,l,f;try{c=e;for(let e=0;e<t.length;e+=1){const r=t[e];if("string"!=typeof r)throw i(`Expected path[${e}] to be a string, got ${typeof r}.`);if(a=x(c),l=R(a),!l&&s){c=n.onMissingKey;break}if(f=V(a),l&&!f.getKeys(c).includes(r)&&s){c=n.onMissingKey;break}c=f.read(c,r)}}catch(e){if(!o)throw e;c=n.onError}return c},e.hasCircularReference=e=>{const t=b().detectCircularReferences;t||y({detectCircularReferences:!0});const r=U(e,j(),!0);return t||y({detectCircularReferences:!1}),r},e.isIdentical=(e,t)=>{const r=[e,t];return b().detectCircularReferences?B(...r,j(),j()):J(...r)},e.isIterable=K,e.isIterableType=R,e.isMarker=u,e.locateCircularReference=(e,t=1)=>{const r=typeof t;if(!["string","number"].includes(r))throw i(G);if("string"===r&&"*"!==t)throw i(G);if("number"===r&&(t<1||[NaN,1/0].includes(t)))throw i(G);const n=b().detectCircularReferences;n||y({detectCircularReferences:!0});const s=Q(e,t,[],j(),[],!0);return n||y({detectCircularReferences:!1}),s},e.locateCircularReferenceRecursive=Q,e.locateKey=(e,t,r)=>{const n="string"==typeof t;if(!(n||t instanceof RegExp))throw i("Expected pattern to be either a string of a regular expression.");const s=n?e=>e===t:e=>t.test(e);return F(e,(e,t,r,n)=>{const o=x(t);if(!R(o))return;const{getKeys:i}=V(o);i(t).forEach(e=>s(e)&&n.locations.push([...r,e]))},{depth:[0,"*"],...r},{locations:[]}).locations},e.locateText=(e,t,r)=>{const n="string"==typeof t;if(!(n||t instanceof RegExp))throw i("Expected pattern to be either a string of a regular expression.");const s=n?e=>e===t:e=>t.test(e);return F(e,(e,t,r,n)=>"string"===x(t)&&s(t)&&n.locations.push(r),{depth:[0,"*"],...r},{locations:[]}).locations},e.marker=$,e.referenceStack=j,e.registerClassTypes=X,e.registerIterableClass=(e,t,r,n,s,o=()=>new e)=>{const i=p.findIndex(t=>t.classRef===e),c={classRef:e,getKeys:e=>b().detectCircularReferences?[...t(e)].filter(e=>!u(e)):t(e),read:r,write:n,remove:s,instantiate:o};i>=0?p[i]=c:(p.unshift(c),X(e))},e.registeredClasses=h,e.registeredIterableClasses=p,e.removeKey=(e,t,r)=>{const n="string"==typeof t;if(!(n||t instanceof RegExp))throw i("Expected pattern to be either a string of a regular expression.");const s=n?e=>e===t:e=>t.test(e);return F(e,(e,t,r,n)=>{const o=x(t);if(!R(o))return;const{getKeys:i,remove:c}=V(o);i(t).forEach(e=>{s(e)&&(c(t,e),n.locations.push([...r,e]))})},{depth:[0,"*"],...r},{locations:[]}).locations},e.renameKey=(e,t,r,n)=>{const s="string"==typeof t;if(!(s||t instanceof RegExp))throw i("Expected pattern to be either a string of a regular expression.");if("string"!=typeof r)throw i("Expected name to be a string.");const o=s?e=>e===t:e=>t.test(e),c=s?()=>r:e=>e.replace(t,r);return F(e,(e,t,r,n)=>{const s=x(t);if(!R(s))return;const{getKeys:i,read:a,write:l,remove:f}=V(s);i(t).forEach(e=>{if(!o(e))return;const s=c(e);l(t,a(t,e),s),f(t,e),n.locations.push([...r,s])})},{depth:[0,"*"],...n},{locations:[]}).locations},e.replaceText=(e,t,r,n)=>{const s="string"==typeof t;if(!(s||t instanceof RegExp))throw i("Expected pattern to be either a string of a regular expression.");if("string"!=typeof r)throw i("Expected name to be a string.");const o=s?e=>e.includes(t):e=>t.test(e);return F(e,(e,n,s,i)=>{const c=x(n);if(!R(c))return;const{getKeys:a,read:l,write:f}=V(c);a(n).forEach(e=>{const c=l(n,e);"string"===x(c)&&o(c)&&(f(n,c.replace(t,r),e),i.locations.push([...s,e]))})},{depth:[0,"*"],...n},{locations:[]}).locations},e.sameStructure=H,e.sameType=q,e.selectiveCopy=(e,t)=>{if(void 0!==t&&"object"!==x(t))throw i("Invalid options argument.");t||(t={}),t.skipFunctions||(t.skipFunctions=!1);const r=["includeKeys","excludeKeys","include","exclude"];let n="";for(let e=0;e<r.length;e+=1){const s=r[e]in t;if(n&&s)throw i(`Options ${n} and ${r[e]} are mutually exclusive.`);s&&(n=r[e])}const{includeKeys:s,excludeKeys:o,include:c,exclude:a,skipFunctions:l}=t;let f=(e,t,r,n)=>!0;switch(n){case"includeKeys":f=(e,t,r,n)=>1!==t.length||s.includes(r);break;case"excludeKeys":f=(e,t,r,n)=>1!==t.length||!o.includes(r);break;case"include":f=c;break;case"exclude":f=(e,t,r,n)=>!a(e,t,r,n)}const u=[],h=(e,t,r,n)=>u.push({target:e,path:t,key:r,dataType:n});let p;return p=b().detectCircularReferences?Z(e,[],f,l,h,j(),[],!0):Y(e,[],f,l,h),{clone:p,skipped:u}},e.selectiveCopyForCircularReferencesRecursive=Z,e.selectiveCopyRecursive=Y,e.setConfig=y,e.traverse=F,e}({}); |
+919
-664
@@ -8,2 +8,83 @@ (function (global, factory) { | ||
| /** | ||
| * Safe copies of Array built-in static methods. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/array | ||
| */ | ||
| const _Array = globalThis.Array; | ||
| /** | ||
| * (Safe copy) Determines whether the passed value is an Array. | ||
| */ | ||
| const isArray = _Array.isArray; | ||
| /** | ||
| * (Safe copy) Creates an array from an array-like or iterable object. | ||
| */ | ||
| const from = _Array.from; | ||
| /** | ||
| * Safe copies of Error built-ins via factory functions. | ||
| * | ||
| * Since constructors cannot be safely captured via Object.assign, this module | ||
| * provides factory functions that use Reflect.construct internally. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/error | ||
| */ | ||
| const _Error = globalThis.Error; | ||
| const _Reflect$3 = globalThis.Reflect; | ||
| /** | ||
| * (Safe copy) Creates a new Error using the captured Error constructor. | ||
| * Use this instead of `new Error()`. | ||
| * | ||
| * @param message - Optional error message. | ||
| * @param options - Optional error options. | ||
| * @returns A new Error instance. | ||
| * | ||
| * @example Creating Error instances | ||
| * ```typescript | ||
| * const error = createError('Operation failed') | ||
| * // With cause for error chaining | ||
| * const wrapped = createError('Request failed', { cause: originalError }) | ||
| * ``` | ||
| */ | ||
| const createError = (message, options) => _Reflect$3.construct(_Error, [message, options]); | ||
| /** | ||
| * Represents a detected circular reference in an object graph. | ||
| * Tracks the location where the reference was found and its target. | ||
| * | ||
| * @example Creating a circular reference instance | ||
| * ```typescript | ||
| * const ref = new CircularReference(['root', 'child'], ['root']) | ||
| * console.log(ref.depth) // 1 | ||
| * ``` | ||
| */ | ||
| class CircularReference { | ||
| location; | ||
| target; | ||
| keyDelimiter = '\u00B7'; | ||
| delimiter = ' \u2192 '; | ||
| constructor(location, target) { | ||
| if (!isArray(location) || location.length === 0) { | ||
| throw createError(`Expected location to be a list with at list one string value.`); | ||
| } | ||
| if (!isArray(target)) { | ||
| throw createError(`Expected target to be a list.`); | ||
| } | ||
| this.location = { path: location }; | ||
| this.target = { path: target }; | ||
| } | ||
| get depth() { | ||
| return this.location.path.length - this.target.path.length; | ||
| } | ||
| toString = () => `${this.join(this.location)}${this.delimiter}${this.join(this.target)}`; | ||
| toJSON = () => this.toString(); | ||
| join = ({ path }) => path.join(this.keyDelimiter); | ||
| } | ||
| /** | ||
| * Safe copies of Object built-in methods. | ||
@@ -16,3 +97,2 @@ * | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Object = globalThis.Object; | ||
@@ -29,2 +109,15 @@ /** | ||
| /** | ||
| * Checks if a string is a valid marker format. | ||
| * | ||
| * @param text - The string to check | ||
| * @returns True if the string matches the marker pattern | ||
| * | ||
| * @example Validating marker format | ||
| * ```typescript | ||
| * isMarker('__$0') // true | ||
| * isMarker('__$123') // true | ||
| * isMarker('regular') // false | ||
| * ``` | ||
| */ | ||
| const isMarker = (text) => { | ||
@@ -73,2 +166,7 @@ if (typeof text !== 'string' || !text.startsWith('__$')) | ||
| * @param config - Partial configuration object to merge with current settings | ||
| * | ||
| * @example Configuring settings | ||
| * ```typescript | ||
| * setConfig({ detectCircularReferences: true }) | ||
| * ``` | ||
| */ | ||
@@ -85,2 +183,7 @@ const setConfig = (config) => { | ||
| * @returns The current global configuration object | ||
| * | ||
| * @example Retrieving configuration | ||
| * ```typescript | ||
| * const { detectCircularReferences } = getConfig() | ||
| * ``` | ||
| */ | ||
@@ -93,110 +196,25 @@ const getConfig = () => ({ | ||
| /** | ||
| * Registers one or more classes which will be used to identify values as distinct data types. | ||
| * Gets the keys from an iterable target based on its data type. | ||
| * | ||
| * @param classRefs - One or more class references to register. | ||
| * @returns The result of the forEach operation (void) | ||
| */ | ||
| const registerClassTypes = (...classRefs) => classRefs.forEach((classRef) => !registeredClasses.includes(classRef) && registeredClasses.push(classRef)); | ||
| /** | ||
| * Registers a custom class as iterable, allowing the data utilities API to treat instances | ||
| * as map-like objects with their own unique data type. | ||
| * @param target - The target to get the keys from. | ||
| * @param dataType - The data type of the target. | ||
| * @returns The keys from the iterable target. | ||
| * | ||
| * @param classRef - The class constructor to register | ||
| * @param getKeys - Function that returns all keys from an instance | ||
| * @param read - Function to read a value from an instance by key | ||
| * @param write - Function to write a value to an instance (with optional key) | ||
| * @param remove - Function to remove a key from an instance | ||
| * @param instantiate - Factory function to create new instances (defaults to calling constructor) | ||
| * @remarks | ||
| * If the class is already registered, its entry will be updated with the new handlers. | ||
| * @example Extracting keys from object | ||
| * ```typescript | ||
| * getKeysFromIterable({ a: 1, b: 2 }, 'object') // ['a', 'b'] | ||
| * ``` | ||
| */ | ||
| const registerIterableClass = (classRef, getKeys, read, write, remove, instantiate = () => new classRef()) => { | ||
| const existingEntryLocation = registeredIterableClasses.findIndex((entry) => entry.classRef === classRef); | ||
| const GetKeys = (target) => getConfig().detectCircularReferences ? [...getKeys(target)].filter((key) => !isMarker(key)) : getKeys(target); | ||
| const entry = { | ||
| classRef, | ||
| getKeys: GetKeys, | ||
| read, | ||
| write, | ||
| remove, | ||
| instantiate, | ||
| }; | ||
| if (existingEntryLocation >= 0) { | ||
| registeredIterableClasses[existingEntryLocation] = entry; | ||
| return; | ||
| } | ||
| registeredIterableClasses.unshift(entry); | ||
| registerClassTypes(classRef); | ||
| const getKeysFromIterable = (target, dataType) => { | ||
| if (dataType === 'array') | ||
| dataType = Array.name; | ||
| if (dataType === 'object') | ||
| dataType = Object.name; | ||
| const iterableClass = registeredIterableClasses.find(({ classRef }) => dataType === classRef.name); | ||
| if (iterableClass === undefined) | ||
| return []; | ||
| return iterableClass.getKeys(target); | ||
| }; | ||
| /** | ||
| * Removes one or more registered classes used to identify values as distinct data types. | ||
| * | ||
| * @param classRefs - One or more class references to deregister. If none provided, all registered classes will be deregistered. | ||
| */ | ||
| const deregisterClassTypes = (...classRefs) => { | ||
| if (classRefs.length === 0) { | ||
| while (registeredClasses.length !== 0) | ||
| registeredClasses.shift(); | ||
| return; | ||
| } | ||
| const indexes = classRefs | ||
| .map((classRef) => registeredClasses.indexOf(classRef)) | ||
| .filter((index) => index >= 0) | ||
| .sort(); | ||
| while (indexes.length !== 0) { | ||
| registeredClasses.splice(indexes[indexes.length - 1], 1); | ||
| indexes.pop(); | ||
| } | ||
| }; | ||
| /** | ||
| * Removes one or more registered iterable classes. | ||
| * Removes all registered iterable classes except built-ins (Array and Object) when no references are provided. | ||
| * | ||
| * @param classRefs - The class constructors to deregister | ||
| */ | ||
| const deregisterIterableClass = (...classRefs) => { | ||
| if (classRefs.length === 0) { | ||
| for (let i = registeredIterableClasses.length - 1; i >= 0; i--) { | ||
| const classRef = registeredIterableClasses[i].classRef; | ||
| if (![Array, Object].includes(classRef)) { | ||
| registeredIterableClasses.splice(i, 1); | ||
| } | ||
| } | ||
| } | ||
| else { | ||
| const indexes = classRefs | ||
| .map((classRef) => registeredIterableClasses.findIndex((entry) => entry.classRef === classRef)) | ||
| .filter((index) => index >= 0) | ||
| .sort(); | ||
| while (indexes.length > 0) { | ||
| registeredIterableClasses.splice(indexes[indexes.length - 1], 1); | ||
| indexes.pop(); | ||
| } | ||
| } | ||
| deregisterClassTypes(...classRefs); | ||
| }; | ||
| /** | ||
| * Safe copies of Array built-in static methods. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/array | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Array = globalThis.Array; | ||
| /** | ||
| * (Safe copy) Determines whether the passed value is an Array. | ||
| */ | ||
| const isArray = _Array.isArray; | ||
| /** | ||
| * (Safe copy) Creates an array from an array-like or iterable object. | ||
| */ | ||
| const from = _Array.from; | ||
| /** | ||
| * Returns the data type of the target. | ||
@@ -208,2 +226,9 @@ * Uses native `typeof` operator, however, makes distinction between `null`, `array`, and `object`. | ||
| * @returns The data type of the target. | ||
| * | ||
| * @example Determining data types | ||
| * ```typescript | ||
| * getType([1, 2]) // 'array' | ||
| * getType({ a: 1 }) // 'object' | ||
| * getType(null) // 'null' | ||
| * ``` | ||
| */ | ||
@@ -226,33 +251,2 @@ const getType = (target) => { | ||
| /** | ||
| * Checks if two targets are of the same data type. | ||
| * | ||
| * @param targetA The first target to compare | ||
| * @param targetB The second target to compare | ||
| * @returns The common data type if both targets are of the same type; otherwise, false. | ||
| */ | ||
| const sameType = (targetA, targetB) => { | ||
| const firstType = getType(targetA); | ||
| const secondType = getType(targetB); | ||
| return firstType === secondType ? firstType : false; | ||
| }; | ||
| /** | ||
| * Gets the keys from an iterable target based on its data type. | ||
| * | ||
| * @param target - The target to get the keys from. | ||
| * @param dataType - The data type of the target. | ||
| * @returns The keys from the iterable target. | ||
| */ | ||
| const getKeysFromIterable = (target, dataType) => { | ||
| if (dataType === 'array') | ||
| dataType = Array.name; | ||
| if (dataType === 'object') | ||
| dataType = Object.name; | ||
| const iterableClass = registeredIterableClasses.find(({ classRef }) => dataType === classRef.name); | ||
| if (iterableClass === undefined) | ||
| return []; | ||
| return iterableClass.getKeys(target); | ||
| }; | ||
| /** | ||
| * Returns a list of iterable data types. By default 'array' and 'object' are included., | ||
@@ -262,2 +256,7 @@ * but can be extended by using `registerIterableClass`. | ||
| * @returns Array of iterable data types. | ||
| * | ||
| * @example Listing registered iterable types | ||
| * ```typescript | ||
| * getIterableTypes() // ['array', 'object', ...registered types] | ||
| * ``` | ||
| */ | ||
@@ -278,2 +277,9 @@ const getIterableTypes = () => registeredIterableClasses.map(({ classRef }) => { | ||
| * @returns `true` if the data type is iterable, otherwise `false` | ||
| * | ||
| * @example Checking iterable types | ||
| * ```typescript | ||
| * isIterableType('array') // true | ||
| * isIterableType('object') // true | ||
| * isIterableType('string') // false | ||
| * ``` | ||
| */ | ||
@@ -283,114 +289,94 @@ const isIterableType = (dataType) => getIterableTypes().includes(dataType); | ||
| /** | ||
| * Checks whether two targets have the same structure. | ||
| * Checks if the target contains all specified keys. | ||
| * | ||
| * @param target - The target to check. | ||
| * @param keys - The keys to check for. | ||
| * @returns True if the target contains all specified keys, false otherwise. | ||
| * @remarks | ||
| * For iterable types (arrays, sets, maps, and objects), it checks whether they have the same keys. | ||
| * For other types, it simply checks whether they are of the same type. | ||
| * It supports configuration via `getConfig().samePositionOfOwnProperties` to determine whether the order of keys matters for objects. | ||
| * If supports other registered iterable classes as well. See `registerIterableClass`. | ||
| * @param targetA data to compare | ||
| * @param targetB data to compare | ||
| * @returns The data type if both targets have the same structure, otherwise `false`. | ||
| * Works with objects, arrays, and registered iterable classes. | ||
| * An empty keys array will always return `false`. | ||
| * | ||
| * @example Checking if object contains specific keys | ||
| * ```typescript | ||
| * containsKeys({ a: 1, b: 2 }, ['a', 'b']) // true | ||
| * containsKeys({ a: 1 }, ['a', 'b']) // false | ||
| * ``` | ||
| */ | ||
| const sameStructure = (targetA, targetB) => { | ||
| const typeMatch = sameType(targetA, targetB); | ||
| if (typeMatch === false) | ||
| const containsKeys = (target, keys) => { | ||
| if (keys.length === 0) | ||
| return false; | ||
| if (isIterableType(typeMatch)) { | ||
| const aKeys = getKeysFromIterable(targetA, typeMatch); | ||
| const bKeys = getKeysFromIterable(targetB, typeMatch); | ||
| const aKeyCount = aKeys.length; | ||
| const bKeyCount = bKeys.length; | ||
| if (aKeyCount !== bKeyCount) | ||
| return false; | ||
| if (aKeyCount === 0) | ||
| return typeMatch; | ||
| if (getConfig().samePositionOfOwnProperties) { | ||
| for (let i = 0; i < aKeyCount; i += 1) { | ||
| if (aKeys[i] !== bKeys[i]) | ||
| return false; | ||
| } | ||
| } | ||
| else { | ||
| for (let i = 0; i < aKeyCount; i += 1) { | ||
| if (!bKeys.includes(aKeys[i])) | ||
| return false; | ||
| } | ||
| } | ||
| } | ||
| return typeMatch; | ||
| const dataType = getType(target); | ||
| if (isIterableType(dataType) === false) | ||
| return false; | ||
| const targetKeys = getKeysFromIterable(target, dataType); | ||
| return !keys.some((k) => !targetKeys.includes(k)); | ||
| }; | ||
| /** | ||
| * Checks if the target is iterable. | ||
| * Removes one or more registered classes used to identify values as distinct data types. | ||
| * | ||
| * @param target - The target to check. | ||
| * @returns `true` if the target is iterable, `false` otherwise. | ||
| * @param classRefs - One or more class references to deregister. If none provided, all registered classes will be deregistered. | ||
| * | ||
| * @example Deregistering class types | ||
| * ```typescript | ||
| * deregisterClassTypes(MyCustomClass) | ||
| * deregisterClassTypes() // clears all | ||
| * ``` | ||
| */ | ||
| const isIterable = (target) => isIterableType(getType(target)); | ||
| const deregisterClassTypes = (...classRefs) => { | ||
| if (classRefs.length === 0) { | ||
| while (registeredClasses.length !== 0) | ||
| registeredClasses.shift(); | ||
| return; | ||
| } | ||
| const indexes = classRefs | ||
| .map((classRef) => registeredClasses.indexOf(classRef)) | ||
| .filter((index) => index >= 0) | ||
| .sort(); | ||
| while (indexes.length !== 0) { | ||
| registeredClasses.splice(indexes[indexes.length - 1], 1); | ||
| indexes.pop(); | ||
| } | ||
| }; | ||
| /** | ||
| * Safe copies of Error built-ins via factory functions. | ||
| * Removes one or more registered iterable classes. | ||
| * Removes all registered iterable classes except built-ins (Array and Object) when no references are provided. | ||
| * | ||
| * Since constructors cannot be safely captured via Object.assign, this module | ||
| * provides factory functions that use Reflect.construct internally. | ||
| * @param classRefs - The class constructors to deregister | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/error | ||
| * @example Deregistering iterable classes | ||
| * ```typescript | ||
| * deregisterIterableClass(MyCollection) | ||
| * deregisterIterableClass() // clears all except Array/Object | ||
| * ``` | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Error = globalThis.Error; | ||
| const _Reflect$3 = globalThis.Reflect; | ||
| /** | ||
| * (Safe copy) Creates a new Error using the captured Error constructor. | ||
| * Use this instead of `new Error()`. | ||
| * | ||
| * @param message - Optional error message. | ||
| * @param options - Optional error options. | ||
| * @returns A new Error instance. | ||
| */ | ||
| const createError = (message, options) => _Reflect$3.construct(_Error, [message, options]); | ||
| class CircularReference { | ||
| location; | ||
| target; | ||
| keyDelimiter = '\u00B7'; // Middle dot | ||
| delimiter = ' \u2192 '; // Right arrow | ||
| constructor(location, target) { | ||
| if (!isArray(location) || location.length === 0) { | ||
| throw createError(`Expected location to be a list with at list one string value.`); | ||
| const deregisterIterableClass = (...classRefs) => { | ||
| if (classRefs.length === 0) { | ||
| for (let i = registeredIterableClasses.length - 1; i >= 0; i--) { | ||
| const classRef = registeredIterableClasses[i].classRef; | ||
| if (![Array, Object].includes(classRef)) { | ||
| registeredIterableClasses.splice(i, 1); | ||
| } | ||
| } | ||
| if (!isArray(target)) { | ||
| throw createError(`Expected target to be a list.`); | ||
| } | ||
| else { | ||
| const indexes = classRefs | ||
| .map((classRef) => registeredIterableClasses.findIndex((entry) => entry.classRef === classRef)) | ||
| .filter((index) => index >= 0) | ||
| .sort(); | ||
| while (indexes.length > 0) { | ||
| registeredIterableClasses.splice(indexes[indexes.length - 1], 1); | ||
| indexes.pop(); | ||
| } | ||
| this.location = { path: location }; | ||
| this.target = { path: target }; | ||
| } | ||
| get depth() { | ||
| return this.location.path.length - this.target.path.length; | ||
| } | ||
| toString = () => `${this.join(this.location)}${this.delimiter}${this.join(this.target)}`; | ||
| toJSON = () => this.toString(); | ||
| join = ({ path }) => path.join(this.keyDelimiter); | ||
| } | ||
| const getIterableOperators = (dataType) => { | ||
| const { getKeys, read, write, remove, instantiate } = (registeredIterableClasses.find((e) => e.classRef.name.toLowerCase() === dataType.toLowerCase())); | ||
| return { getKeys, read, write, remove, instantiate }; | ||
| deregisterClassTypes(...classRefs); | ||
| }; | ||
| /** | ||
| * Safe copies of Map built-in via factory function. | ||
| * Safe Map factory with optional groupBy for ES2024+. | ||
| * | ||
| * Since constructors cannot be safely captured via Object.assign, this module | ||
| * provides a factory function that uses Reflect.construct internally. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/map | ||
| */ | ||
| // Capture references at module initialization time | ||
| /* eslint-disable workspace/lib-require-jsdoc-example */ | ||
| const _Map = globalThis.Map; | ||
@@ -408,15 +394,38 @@ const _Reflect$2 = globalThis.Reflect; | ||
| /** | ||
| * Safe copies of Date built-in via factory function and static methods. | ||
| * Checks if the target is iterable. | ||
| * | ||
| * Since constructors cannot be safely captured via Object.assign, this module | ||
| * provides a factory function that uses Reflect.construct internally. | ||
| * @param target - The target to check. | ||
| * @returns `true` if the target is iterable, `false` otherwise. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * @example Checking if value is iterable | ||
| * ```typescript | ||
| * isIterable([1, 2]) // true | ||
| * isIterable({ a: 1 }) // true | ||
| * isIterable('string') // false | ||
| * ``` | ||
| */ | ||
| const isIterable = (target) => isIterableType(getType(target)); | ||
| /** | ||
| * Safe copies of Date built-in via factory function and static methods. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/date | ||
| */ | ||
| // Capture references at module initialization time | ||
| /* eslint-disable jsdoc/require-param */ | ||
| const _Date = globalThis.Date; | ||
| const _Reflect$1 = globalThis.Reflect; | ||
| /** | ||
| * (Safe copy) Creates a new Date using the captured Date constructor. | ||
| * Use this instead of `new Date()`. Accepts all standard Date constructor signatures. | ||
| * | ||
| * @returns A new Date instance. | ||
| * | ||
| * @example Creating Date instances | ||
| * ```typescript | ||
| * const now = createDate() | ||
| * const fromTimestamp = createDate(1704067200000) | ||
| * const fromString = createDate('2024-01-01T00:00:00Z') | ||
| * const fromParts = createDate(2024, 0, 1, 12, 30, 0) // Jan 1, 2024 12:30:00 | ||
| * ``` | ||
| */ | ||
| function createDate(...args) { | ||
@@ -434,3 +443,2 @@ return _Reflect$1.construct(_Date, args); | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Math = globalThis.Math; | ||
@@ -441,5 +449,2 @@ /** | ||
| const round = _Math.round; | ||
| // ============================================================================ | ||
| // Random | ||
| // ============================================================================ | ||
| /** | ||
@@ -452,2 +457,12 @@ * (Safe copy) Returns a pseudo-random number between 0 and 1. | ||
| /** | ||
| * Generates a unique marker string for object tagging. | ||
| * | ||
| * @returns A unique marker string prefixed with __$ | ||
| * | ||
| * @example Generating unique marker | ||
| * ```typescript | ||
| * const tag = marker() // '__$16789012345001234567890' | ||
| * ``` | ||
| */ | ||
| const marker = () => { | ||
@@ -468,2 +483,9 @@ const randomValue = round(random() * 10000000000000); | ||
| * @returns A new ReferenceStack instance. | ||
| * | ||
| * @example Tracking object references | ||
| * ```typescript | ||
| * const stack = referenceStack() | ||
| * stack.add(myObject) | ||
| * stack.exists(myObject) // true | ||
| * ``` | ||
| */ | ||
@@ -501,2 +523,268 @@ const referenceStack = () => { | ||
| const errorMessage = (thing, type) => `Expected ${thing} to be ${type}.`; | ||
| const nextIterationDetails = (path, key, value) => ({ | ||
| nextPath: [...path, key], | ||
| nextValue: value[key], | ||
| }); | ||
| const circularDependencyTraversal = (condition, callback, config, key, path, value, parent, state, stack, root = false) => { | ||
| if (stack.exists(value)) | ||
| return state; | ||
| const ok = condition(config, key, value, path, parent); | ||
| /* istanbul ignore next */ | ||
| if (config.exitEarly) | ||
| return state; | ||
| if (ok) | ||
| callback(key, value, path, state, parent); | ||
| stack.add(value); | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return state; | ||
| const keys = getKeysFromIterable(value, type); | ||
| keys.forEach((key) => { | ||
| const { nextPath, nextValue } = nextIterationDetails(path, key, value); | ||
| circularDependencyTraversal(condition, callback, config, key, nextPath, nextValue, value, state, stack); | ||
| }); | ||
| if (root) | ||
| stack.clear(); | ||
| return state; | ||
| }; | ||
| const nonCircularDependencyTraversal = (condition, callback, config, key, path, value, parent, state) => { | ||
| const ok = condition(config, key, value, path, parent); | ||
| /* istanbul ignore next */ | ||
| if (config.exitEarly) | ||
| return state; | ||
| if (ok) | ||
| callback(key, value, path, state, parent); | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return state; | ||
| const keys = getKeysFromIterable(value, type); | ||
| keys.forEach((key) => { | ||
| const { nextPath, nextValue } = nextIterationDetails(path, key, value); | ||
| nonCircularDependencyTraversal(condition, callback, config, key, nextPath, nextValue, value, state); | ||
| }); | ||
| return state; | ||
| }; | ||
| const traversal = (target, condition, callback, options, state) => { | ||
| if (typeof callback !== 'function') | ||
| throw createError(errorMessage('callback', 'a function')); | ||
| if (!(typeof options === 'object' && !isArray(options))) | ||
| throw createError(errorMessage('options', 'an object')); | ||
| if (!isArray(options.depth)) | ||
| throw createError(errorMessage('options.depth', 'an array')); | ||
| const [startDepth, maxDepth] = options.depth; | ||
| if (startDepth !== void 0 && typeof startDepth !== 'number') | ||
| throw createError(errorMessage('options.depth.0', 'a number')); | ||
| if (maxDepth !== void 0) { | ||
| const maxDepthType = typeof maxDepth; | ||
| if (!['number', 'string'].includes(maxDepthType)) | ||
| throw createError(errorMessage('options.depth.1', 'a number or a string')); | ||
| if (maxDepthType === 'string' && maxDepth !== '*') | ||
| throw createError("Only valid string value in options.depth.1 is '*'."); | ||
| } | ||
| const config = { | ||
| depth: freeze([options.depth[0] ?? 0, options.depth[1] ?? '*']), | ||
| exitEarly: false, | ||
| }; | ||
| const initialArgs = [condition, callback, config, '', [], target, void 0, state]; | ||
| if (getConfig().detectCircularReferences) | ||
| return circularDependencyTraversal(...initialArgs, referenceStack(), true); | ||
| return nonCircularDependencyTraversal(...initialArgs); | ||
| }; | ||
| /** | ||
| * A higher-order function that takes a single predicate function to generate an algorithm that traverses data points | ||
| * on a data structure. See traverse. | ||
| * | ||
| * @param condition - Predicate function to determine whether to traverse a data point | ||
| * @returns A traversal function configured with the condition | ||
| * | ||
| * @example Creating custom traversal | ||
| * ```typescript | ||
| * const customTraverse = createTraversal((config, key, value) => value !== null) | ||
| * customTraverse(data, callback, options) | ||
| * ``` | ||
| */ | ||
| const createTraversal = (condition) => (target, callback, options, state) => traversal(target, condition, callback, options ?? { depth: [0, '*'] }, state ?? {}); | ||
| const condition = (config, key, value, path) => !(path.length < config.depth[0] || config.depth[1] < path.length); | ||
| const traverseBetweenDepthRange = createTraversal(condition); | ||
| /** | ||
| * Invokes a callback function for every data point in the data structure of the target value to let you do read and write operations. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * | ||
| * @param target - The value to traverse | ||
| * @param callback - Function to invoke for each data point | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @param state - Optional state object to maintain across traversal callbacks | ||
| * @returns The state object after traversal completes | ||
| * | ||
| * @example Traversing data structure | ||
| * ```typescript | ||
| * traverse({ a: { b: 1 } }, (key, value, path) => { | ||
| * console.log(path.join('.'), '=', value) | ||
| * }) | ||
| * ``` | ||
| */ | ||
| const traverse = (target, callback, options, state) => traverseBetweenDepthRange(target, callback, options, state); | ||
| /** | ||
| * Returns the total depth of a value's data structure, | ||
| * and returns a list of locations that are the most deeply nested. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to analyze for depth | ||
| * @returns A tuple containing the maximum depth and an array of paths to the deepest locations | ||
| * | ||
| * @example Getting depth of nested object | ||
| * ```typescript | ||
| * getDepth({ a: { b: { c: 1 } } }) // [3, [['a', 'b', 'c']]] | ||
| * ``` | ||
| */ | ||
| const getDepth = (target) => { | ||
| const trackDepth = (key, value, path, state) => { | ||
| if (state.depth < path.length) { | ||
| state.depth = path.length; | ||
| state.locations = [path]; | ||
| return; | ||
| } | ||
| if (state.depth === path.length) { | ||
| state.locations.push(path); | ||
| } | ||
| }; | ||
| const options = { depth: [0, '*'] }; | ||
| const state = { depth: 0, locations: [] }; | ||
| const { depth, locations } = traverse(target, trackDepth, options, state); | ||
| return [depth, locations]; | ||
| }; | ||
| /** | ||
| * Retrieves iterable operators for a given data type. | ||
| * | ||
| * @param dataType - The type of data to get operators for | ||
| * @returns Object containing getKeys, read, write, remove, and instantiate operators | ||
| * | ||
| * @example Retrieving operators for array type | ||
| * ```typescript | ||
| * const ops = getIterableOperators('array') | ||
| * const keys = ops.getKeys([1, 2, 3]) // ['0', '1', '2'] | ||
| * ``` | ||
| */ | ||
| const getIterableOperators = (dataType) => { | ||
| const { getKeys, read, write, remove, instantiate } = (registeredIterableClasses.find((e) => e.classRef.name.toLowerCase() === dataType.toLowerCase())); | ||
| return { getKeys, read, write, remove, instantiate }; | ||
| }; | ||
| /** | ||
| * Safe Set factory for protected set construction. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/set | ||
| */ | ||
| /* eslint-disable workspace/lib-require-jsdoc-example */ | ||
| const _Set = globalThis.Set; | ||
| const _Reflect = globalThis.Reflect; | ||
| /** | ||
| * (Safe copy) Creates a new Set using the captured Set constructor. | ||
| * Use this instead of `new Set()`. | ||
| * | ||
| * @param iterable - Optional iterable of values. | ||
| * @returns A new Set instance. | ||
| */ | ||
| const createSet = (iterable) => _Reflect.construct(_Set, iterable ? [iterable] : []); | ||
| /** | ||
| * Returns a list of unique key names that match a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against key names (defaults to matching all keys) | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of unique key names that match the pattern | ||
| * | ||
| * @example Finding unique keys by pattern | ||
| * ```typescript | ||
| * getUniqueKeys({ a: { b: 1 }, c: { b: 2 } }, 'b') // ['b'] | ||
| * getUniqueKeys(data, /^user/) // keys starting with 'user' | ||
| * ``` | ||
| */ | ||
| const getUniqueKeys = (target, pattern = /.+/, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => match(nextKey) && state.names.add(nextKey)); | ||
| }; | ||
| return from(traverse(target, callback, { depth: [0, '*'], ...options }, { | ||
| names: createSet(), | ||
| }).names.values()); | ||
| }; | ||
| /** | ||
| * Gets the value at the specified path from the target. | ||
| * | ||
| * @param target - The target to get the value from. | ||
| * @param path - The path to the value. | ||
| * @param defaultValue - The default value to return if the path does not exist or an error occurs. | ||
| * @returns The value at the specified path or the default value. | ||
| * @throws {Error} Will throw an error if the path is not a non-empty array of strings and no default value for errors is provided. | ||
| * @remarks | ||
| * - If `defaultValue.onMissingKey` is provided, it will be returned when a key in the path is missing. | ||
| * - If `defaultValue.onError` is provided, it will be returned when any error occurs during the retrieval process. | ||
| * | ||
| * @example Retrieving nested values | ||
| * ```typescript | ||
| * getValue({ a: { b: 1 } }, ['a', 'b']) // 1 | ||
| * getValue({ a: 1 }, ['x'], { onMissingKey: 0 }) // 0 | ||
| * ``` | ||
| */ | ||
| const getValue = (target, path, defaultValue) => { | ||
| if (isArray(path) === false) { | ||
| throw createError('Expected path to be a non-empty array of strings.'); | ||
| } | ||
| if (path.length === 0) | ||
| return target; | ||
| const hasOnMissingKeyDefault = !!(defaultValue && 'onMissingKey' in defaultValue); | ||
| const hasOnErrorDefault = !!(defaultValue && 'onError' in defaultValue); | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| let scope; | ||
| let scopeType; | ||
| let scopeIterable; | ||
| let scopeOperators; | ||
| try { | ||
| scope = target; | ||
| for (let index = 0; index < path.length; index += 1) { | ||
| const key = path[index]; | ||
| if (typeof key !== 'string') { | ||
| throw createError(`Expected path[${index}] to be a string, got ${typeof key}.`); | ||
| } | ||
| scopeType = getType(scope); | ||
| scopeIterable = isIterableType(scopeType); | ||
| /* instanbul ignore next */ | ||
| if (!scopeIterable && hasOnMissingKeyDefault) { | ||
| scope = defaultValue.onMissingKey; | ||
| break; | ||
| } | ||
| scopeOperators = getIterableOperators(scopeType); | ||
| if (scopeIterable && !scopeOperators.getKeys(scope).includes(key) && hasOnMissingKeyDefault) { | ||
| scope = defaultValue.onMissingKey; | ||
| break; | ||
| } | ||
| scope = scopeOperators.read(scope, key); | ||
| } | ||
| } | ||
| catch (error) { | ||
| if (hasOnErrorDefault) { | ||
| scope = defaultValue.onError; | ||
| } | ||
| else { | ||
| throw error; | ||
| } | ||
| } | ||
| return scope; | ||
| }; | ||
| const hasCircularReferenceRecursive = (target, stack, root = false) => { | ||
@@ -522,2 +810,10 @@ if (stack.exists(target)) | ||
| * @returns True if the value contains circular references, false otherwise | ||
| * | ||
| * @example Detecting circular references | ||
| * ```typescript | ||
| * const obj = { a: {} } | ||
| * obj.a.self = obj | ||
| * hasCircularReference(obj) // true | ||
| * hasCircularReference({ a: 1 }) // false | ||
| * ``` | ||
| */ | ||
@@ -536,46 +832,66 @@ const hasCircularReference = (target) => { | ||
| const invalidmaxResults = 'Invalid maxResults argument.'; | ||
| const locateCircularReferenceRecursive = (target, maxResults, path, stack, result, root = false) => { | ||
| if (result.length === maxResults) | ||
| return result; | ||
| if (stack.exists(target)) { | ||
| result.push(new CircularReference(path, path.slice(0, stack.lastSeen(target)))); | ||
| return result; | ||
| } | ||
| const type = getType(target); | ||
| if (!isIterableType(type)) | ||
| return result; | ||
| stack.add(target); | ||
| const { getKeys, read } = getIterableOperators(type); | ||
| const keys = getKeys(target); | ||
| keys.forEach((key) => locateCircularReferenceRecursive(read(target, key), maxResults, [...path, key], stack, result)); | ||
| if (root) | ||
| stack.clear(); | ||
| return result; | ||
| /** | ||
| * Checks if two targets are of the same data type. | ||
| * | ||
| * @param targetA The first target to compare | ||
| * @param targetB The second target to compare | ||
| * @returns The common data type if both targets are of the same type; otherwise, false. | ||
| * | ||
| * @example Comparing data types | ||
| * ```typescript | ||
| * sameType([1], [2]) // 'array' | ||
| * sameType({}, []) // false | ||
| * ``` | ||
| */ | ||
| const sameType = (targetA, targetB) => { | ||
| const firstType = getType(targetA); | ||
| const secondType = getType(targetB); | ||
| return firstType === secondType ? firstType : false; | ||
| }; | ||
| /** | ||
| * Returns a list of locations where circular references occur. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * Checks whether two targets have the same structure. | ||
| * | ||
| * @param target - The value to search for circular references | ||
| * @param maxResults - Maximum number of circular references to find (number or '*' for all) | ||
| * @returns An array of CircularReference objects indicating locations of circular references | ||
| * @remarks | ||
| * For iterable types (arrays, sets, maps, and objects), it checks whether they have the same keys. | ||
| * For other types, it simply checks whether they are of the same type. | ||
| * It supports configuration via `getConfig().samePositionOfOwnProperties` to determine whether the order of keys matters for objects. | ||
| * If supports other registered iterable classes as well. See `registerIterableClass`. | ||
| * @param targetA data to compare | ||
| * @param targetB data to compare | ||
| * @returns The data type if both targets have the same structure, otherwise `false`. | ||
| * | ||
| * @example Comparing structures | ||
| * ```typescript | ||
| * sameStructure({ a: 1, b: 2 }, { a: 'x', b: 'y' }) // 'object' | ||
| * sameStructure({ a: 1 }, { b: 1 }) // false | ||
| * ``` | ||
| */ | ||
| const locateCircularReference = (target, maxResults = 1) => { | ||
| const resultsType = typeof maxResults; | ||
| if (!['string', 'number'].includes(resultsType)) | ||
| throw createError(invalidmaxResults); | ||
| if (resultsType === 'string' && maxResults !== '*') | ||
| throw createError(invalidmaxResults); | ||
| if (resultsType === 'number' && (maxResults < 1 || [NaN, Infinity].includes(maxResults))) | ||
| throw createError(invalidmaxResults); | ||
| const originalSupportStatus = getConfig().detectCircularReferences; | ||
| if (!originalSupportStatus) { | ||
| setConfig({ detectCircularReferences: true }); | ||
| const sameStructure = (targetA, targetB) => { | ||
| const typeMatch = sameType(targetA, targetB); | ||
| if (typeMatch === false) | ||
| return false; | ||
| if (isIterableType(typeMatch)) { | ||
| const aKeys = getKeysFromIterable(targetA, typeMatch); | ||
| const bKeys = getKeysFromIterable(targetB, typeMatch); | ||
| const aKeyCount = aKeys.length; | ||
| const bKeyCount = bKeys.length; | ||
| if (aKeyCount !== bKeyCount) | ||
| return false; | ||
| if (aKeyCount === 0) | ||
| return typeMatch; | ||
| if (getConfig().samePositionOfOwnProperties) { | ||
| for (let i = 0; i < aKeyCount; i += 1) { | ||
| if (aKeys[i] !== bKeys[i]) | ||
| return false; | ||
| } | ||
| } | ||
| else { | ||
| for (let i = 0; i < aKeyCount; i += 1) { | ||
| if (!bKeys.includes(aKeys[i])) | ||
| return false; | ||
| } | ||
| } | ||
| } | ||
| const result = locateCircularReferenceRecursive(target, maxResults, [], referenceStack(), [], true); | ||
| if (!originalSupportStatus) { | ||
| setConfig({ detectCircularReferences: false }); | ||
| } | ||
| return result; | ||
| return typeMatch; | ||
| }; | ||
@@ -681,2 +997,9 @@ | ||
| * @returns True if the values are identical, false otherwise | ||
| * | ||
| * @example Comparing values for identity | ||
| * ```typescript | ||
| * isIdentical({ a: 1 }, { a: 1 }) // true | ||
| * isIdentical([1, 2], [1, 2]) // true | ||
| * isIdentical({ a: 1 }, { a: 2 }) // false | ||
| * ``` | ||
| */ | ||
@@ -691,23 +1014,321 @@ const isIdentical = (targetA, targetB) => { | ||
| const invalidmaxResults = 'Invalid maxResults argument.'; | ||
| /** | ||
| * Checks if the target contains all specified keys. | ||
| * Recursively searches for circular references in an object graph. | ||
| * | ||
| * @param target - The target to check. | ||
| * @param keys - The keys to check for. | ||
| * @returns True if the target contains all specified keys, false otherwise. | ||
| * @param target - The value to search | ||
| * @param maxResults - Maximum number of results to find | ||
| * @param path - Current path in the object graph | ||
| * @param stack - Reference stack for tracking visited objects | ||
| * @param result - Array to collect found circular references | ||
| * @param root - Whether this is the root call | ||
| * @returns Array of CircularReference objects found | ||
| * | ||
| * @example Recursively locating circular references | ||
| * ```typescript | ||
| * const stack = referenceStack() | ||
| * locateCircularReferenceRecursive(obj, 1, [], stack, [], true) | ||
| * ``` | ||
| */ | ||
| const locateCircularReferenceRecursive = (target, maxResults, path, stack, result, root = false) => { | ||
| if (result.length === maxResults) | ||
| return result; | ||
| if (stack.exists(target)) { | ||
| result.push(new CircularReference(path, path.slice(0, stack.lastSeen(target)))); | ||
| return result; | ||
| } | ||
| const type = getType(target); | ||
| if (!isIterableType(type)) | ||
| return result; | ||
| stack.add(target); | ||
| const { getKeys, read } = getIterableOperators(type); | ||
| const keys = getKeys(target); | ||
| keys.forEach((key) => locateCircularReferenceRecursive(read(target, key), maxResults, [...path, key], stack, result)); | ||
| if (root) | ||
| stack.clear(); | ||
| return result; | ||
| }; | ||
| /** | ||
| * Returns a list of locations where circular references occur. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The value to search for circular references | ||
| * @param maxResults - Maximum number of circular references to find (number or '*' for all) | ||
| * @returns An array of CircularReference objects indicating locations of circular references | ||
| * | ||
| * @example Locating circular references | ||
| * ```typescript | ||
| * const obj = { a: {} } | ||
| * obj.a.self = obj | ||
| * locateCircularReference(obj) // [CircularReference { location: ['a', 'self'], target: [] }] | ||
| * ``` | ||
| */ | ||
| const locateCircularReference = (target, maxResults = 1) => { | ||
| const resultsType = typeof maxResults; | ||
| if (!['string', 'number'].includes(resultsType)) | ||
| throw createError(invalidmaxResults); | ||
| if (resultsType === 'string' && maxResults !== '*') | ||
| throw createError(invalidmaxResults); | ||
| if (resultsType === 'number' && (maxResults < 1 || [NaN, Infinity].includes(maxResults))) | ||
| throw createError(invalidmaxResults); | ||
| const originalSupportStatus = getConfig().detectCircularReferences; | ||
| if (!originalSupportStatus) { | ||
| setConfig({ detectCircularReferences: true }); | ||
| } | ||
| const result = locateCircularReferenceRecursive(target, maxResults, [], referenceStack(), [], true); | ||
| if (!originalSupportStatus) { | ||
| setConfig({ detectCircularReferences: false }); | ||
| } | ||
| return result; | ||
| }; | ||
| /** | ||
| * Returns a list of locations where the key name matches a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against key names | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where the key pattern was found | ||
| * | ||
| * @example Locating keys in nested structure | ||
| * ```typescript | ||
| * locateKey({ a: { b: 1 }, c: { b: 2 } }, 'b') // [['a', 'b'], ['c', 'b']] | ||
| * ``` | ||
| */ | ||
| const locateKey = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => match(nextKey) && state.locations.push([...path, nextKey])); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Returns a list of locations where a text value matches a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against text values | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where the text pattern was found | ||
| * | ||
| * @example Locating text values in structure | ||
| * ```typescript | ||
| * locateText({ a: 'hello', b: { c: 'hello' } }, 'hello') // [['a'], ['b', 'c']] | ||
| * ``` | ||
| */ | ||
| const locateText = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (text) => text === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => getType(value) === 'string' && match(value) && state.locations.push(path); | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Registers one or more classes which will be used to identify values as distinct data types. | ||
| * | ||
| * @param classRefs - One or more class references to register. | ||
| * @returns The result of the forEach operation (void) | ||
| * | ||
| * @example Registering custom class types | ||
| * ```typescript | ||
| * registerClassTypes(MyCustomClass, AnotherClass) | ||
| * getType(new MyCustomClass()) // 'MyCustomClass' | ||
| * ``` | ||
| */ | ||
| const registerClassTypes = (...classRefs) => classRefs.forEach((classRef) => !registeredClasses.includes(classRef) && registeredClasses.push(classRef)); | ||
| /** | ||
| * Registers a custom class as iterable, allowing the data utilities API to treat instances | ||
| * as map-like objects with their own unique data type. | ||
| * | ||
| * @param classRef - The class constructor to register | ||
| * @param getKeys - Function that returns all keys from an instance | ||
| * @param read - Function to read a value from an instance by key | ||
| * @param write - Function to write a value to an instance (with optional key) | ||
| * @param remove - Function to remove a key from an instance | ||
| * @param instantiate - Factory function to create new instances (defaults to calling constructor) | ||
| * @remarks | ||
| * Works with objects, arrays, and registered iterable classes. | ||
| * An empty keys array will always return `false`. | ||
| * If the class is already registered, its entry will be updated with the new handlers. | ||
| * | ||
| * @example Registering custom iterable class | ||
| * ```typescript | ||
| * registerIterableClass( | ||
| * MyMap, | ||
| * (m) => [...m.keys()], | ||
| * (m, k) => m.get(k), | ||
| * (m, v, k) => m.set(k, v), | ||
| * (m, k) => m.delete(k) | ||
| * ) | ||
| * ``` | ||
| */ | ||
| const containsKeys = (target, keys) => { | ||
| if (keys.length === 0) | ||
| return false; | ||
| const dataType = getType(target); | ||
| if (isIterableType(dataType) === false) | ||
| return false; | ||
| const targetKeys = getKeysFromIterable(target, dataType); | ||
| return !keys.some((k) => !targetKeys.includes(k)); | ||
| const registerIterableClass = (classRef, getKeys, read, write, remove, instantiate = () => new classRef()) => { | ||
| const existingEntryLocation = registeredIterableClasses.findIndex((entry) => entry.classRef === classRef); | ||
| const GetKeys = (target) => getConfig().detectCircularReferences ? [...getKeys(target)].filter((key) => !isMarker(key)) : getKeys(target); | ||
| const entry = { | ||
| classRef, | ||
| getKeys: GetKeys, | ||
| read, | ||
| write, | ||
| remove, | ||
| instantiate, | ||
| }; | ||
| if (existingEntryLocation >= 0) { | ||
| registeredIterableClasses[existingEntryLocation] = entry; | ||
| return; | ||
| } | ||
| registeredIterableClasses.unshift(entry); | ||
| registerClassTypes(classRef); | ||
| }; | ||
| /** | ||
| * Removes any key names that match a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of keys that were removed. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against key names for removal | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where keys were removed | ||
| * | ||
| * @example Removing keys by pattern | ||
| * ```typescript | ||
| * const obj = { a: 1, temp: 2, b: { temp: 3 } } | ||
| * removeKey(obj, 'temp') // [['temp'], ['b', 'temp']] | ||
| * ``` | ||
| */ | ||
| const removeKey = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, remove } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| if (!match(nextKey)) | ||
| return; | ||
| remove(value, nextKey); | ||
| state.locations.push([...path, nextKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Renames any key names that match a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of keys that were edited. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against key names | ||
| * @param name - The new name to assign to matching keys | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where keys were renamed | ||
| * | ||
| * @example Renaming keys in structure | ||
| * ```typescript | ||
| * const obj = { old: 1, nested: { old: 2 } } | ||
| * renameKey(obj, 'old', 'new') // [['new'], ['nested', 'new']] | ||
| * ``` | ||
| */ | ||
| const renameKey = (target, pattern, name, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| if (typeof name !== 'string') | ||
| throw createError('Expected name to be a string.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const rename = patternIsString ? () => name : (key) => key.replace(pattern, name); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, read, write, remove } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| if (!match(nextKey)) | ||
| return; | ||
| const newKey = rename(nextKey); | ||
| write(value, read(value, nextKey), newKey); | ||
| remove(value, nextKey); | ||
| state.locations.push([...path, newKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Edits any text by replacing any string or substring that matches a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of the original text that were edited. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against text values | ||
| * @param text - The replacement text for matching values | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where text was replaced | ||
| * | ||
| * @example Replacing text in structure | ||
| * ```typescript | ||
| * const obj = { a: 'hello world', b: { c: 'hello' } } | ||
| * replaceText(obj, 'hello', 'hi') // [['a'], ['b', 'c']] | ||
| * ``` | ||
| */ | ||
| const replaceText = (target, pattern, text, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| if (typeof text !== 'string') | ||
| throw createError('Expected name to be a string.'); | ||
| const match = patternIsString ? (text) => text.includes(pattern) : (text) => pattern.test(text); | ||
| const replace = (original) => original.replace(pattern, text); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, read, write } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| const nextValue = read(value, nextKey); | ||
| if (getType(nextValue) !== 'string' || !match(nextValue)) | ||
| return; | ||
| write(value, replace(nextValue), nextKey); | ||
| state.locations.push([...path, nextKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /* eslint-disable @typescript-eslint/no-unused-vars */ | ||
| /** | ||
| * Recursively creates a selective copy of an object based on predicate conditions. | ||
| * | ||
| * @param target - The object to copy | ||
| * @param path - Current path in the object | ||
| * @param includeKey - Predicate to determine if a key should be included | ||
| * @param skipFunctions - Whether to skip function values | ||
| * @param recordSkip - Callback to record skipped data points | ||
| * @returns Partial copy of the target based on predicate | ||
| * | ||
| * @example Basic recursive copy | ||
| * ```typescript | ||
| * selectiveCopyRecursive(obj, [], () => true, false, () => {}) | ||
| * ``` | ||
| */ | ||
| const selectiveCopyRecursive = (target, path, includeKey, skipFunctions, recordSkip) => { | ||
@@ -722,3 +1343,2 @@ const type = getType(target); | ||
| const nextKey = keys[i]; | ||
| // Filter out __proto__ to prevent prototype pollution attacks | ||
| if (nextKey === '__proto__') | ||
@@ -750,2 +1370,7 @@ continue; | ||
| * @returns A partial clone of the target object | ||
| * | ||
| * @example Copying with circular reference handling | ||
| * ```typescript | ||
| * selectiveCopyForCircularReferencesRecursive(obj, [], () => true, false, () => {}, referenceStack(), [], true) | ||
| * ``` | ||
| */ | ||
@@ -764,3 +1389,2 @@ const selectiveCopyForCircularReferencesRecursive = (target, path, includeKey, skipFunctions, recordSkip, stack, circularRefs, root = false) => { | ||
| const nextKey = keys[i]; | ||
| // Filter out __proto__ to prevent prototype pollution attacks | ||
| if (nextKey === '__proto__') | ||
@@ -801,3 +1425,2 @@ continue; | ||
| } | ||
| // Set the circular reference | ||
| const lastKey = startPath[startPath.length - 1]; | ||
@@ -817,3 +1440,3 @@ /* istanbul ignore else -- __proto__ is already filtered during iteration, this is defensive */ | ||
| * This algorithm instead copies function references by default instead. For the same reason getters and setters are not replicate, only their | ||
| * return values. This algorithm can replicate circular references, when configured to do so. | ||
| * return values. This algorithm can replicate circular references, when configured. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
@@ -824,2 +1447,8 @@ * | ||
| * @returns An object containing the cloned value and array of skipped data points | ||
| * | ||
| * @example Selective copying with options | ||
| * ```typescript | ||
| * const { clone, skipped } = selectiveCopy({ a: 1, b: 2 }, { includeKeys: ['a'] }) | ||
| * // clone = { a: 1 }, skipped = [{ path: ['b'], ... }] | ||
| * ``` | ||
| */ | ||
@@ -870,375 +1499,2 @@ const selectiveCopy = (target, options) => { | ||
| const errorMessage = (thing, type) => `Expected ${thing} to be ${type}.`; | ||
| const nextIterationDetails = (path, key, value) => ({ | ||
| nextPath: [...path, key], | ||
| nextValue: value[key], | ||
| }); | ||
| const circularDependencyTraversal = (condition, callback, config, key, path, value, parent, state, stack, root = false) => { | ||
| if (stack.exists(value)) | ||
| return state; | ||
| const ok = condition(config, key, value, path, parent); | ||
| /* istanbul ignore next */ | ||
| if (config.exitEarly) | ||
| return state; | ||
| if (ok) | ||
| callback(key, value, path, state, parent); | ||
| stack.add(value); | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return state; | ||
| const keys = getKeysFromIterable(value, type); | ||
| keys.forEach((key) => { | ||
| const { nextPath, nextValue } = nextIterationDetails(path, key, value); | ||
| circularDependencyTraversal(condition, callback, config, key, nextPath, nextValue, value, state, stack); | ||
| }); | ||
| if (root) | ||
| stack.clear(); | ||
| return state; | ||
| }; | ||
| const nonCircularDependencyTraversal = (condition, callback, config, key, path, value, parent, state) => { | ||
| const ok = condition(config, key, value, path, parent); | ||
| /* istanbul ignore next */ | ||
| if (config.exitEarly) | ||
| return state; | ||
| if (ok) | ||
| callback(key, value, path, state, parent); | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return state; | ||
| const keys = getKeysFromIterable(value, type); | ||
| keys.forEach((key) => { | ||
| const { nextPath, nextValue } = nextIterationDetails(path, key, value); | ||
| nonCircularDependencyTraversal(condition, callback, config, key, nextPath, nextValue, value, state); | ||
| }); | ||
| return state; | ||
| }; | ||
| const traversal = (target, condition, callback, options, state) => { | ||
| if (typeof callback !== 'function') | ||
| throw createError(errorMessage('callback', 'a function')); | ||
| if (!(typeof options === 'object' && !isArray(options))) | ||
| throw createError(errorMessage('options', 'an object')); | ||
| if (!isArray(options.depth)) | ||
| throw createError(errorMessage('options.depth', 'an array')); | ||
| const [startDepth, maxDepth] = options.depth; | ||
| if (startDepth !== void 0 && typeof startDepth !== 'number') | ||
| throw createError(errorMessage('options.depth.0', 'a number')); | ||
| if (maxDepth !== void 0) { | ||
| const maxDepthType = typeof maxDepth; | ||
| if (!['number', 'string'].includes(maxDepthType)) | ||
| throw createError(errorMessage('options.depth.1', 'a number or a string')); | ||
| if (maxDepthType === 'string' && maxDepth !== '*') | ||
| throw createError("Only valid string value in options.depth.1 is '*'."); | ||
| } | ||
| const config = { | ||
| depth: freeze([options.depth[0] ?? 0, options.depth[1] ?? '*']), | ||
| exitEarly: false, | ||
| }; | ||
| const initialArgs = [condition, callback, config, '', [], target, void 0, state]; | ||
| if (getConfig().detectCircularReferences) | ||
| return circularDependencyTraversal(...initialArgs, referenceStack(), true); | ||
| return nonCircularDependencyTraversal(...initialArgs); | ||
| }; | ||
| /** | ||
| * A higher-order function that takes a single predicate function to generate an algorithm that traverses data points | ||
| * on a data structure. See traverse. | ||
| * | ||
| * @param condition - Predicate function to determine whether to traverse a data point | ||
| * @returns A traversal function configured with the condition | ||
| */ | ||
| const createTraversal = (condition) => (target, callback, options, state) => traversal(target, condition, callback, options ?? { depth: [0, '*'] }, state ?? {}); | ||
| const condition = (config, key, value, path) => !(path.length < config.depth[0] || config.depth[1] < path.length); | ||
| const traverseBetweenDepthRange = createTraversal(condition); | ||
| /** | ||
| * Invokes a callback function for every data point in the data structure of the target value to let you do read and write operations. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * | ||
| * @param target - The value to traverse | ||
| * @param callback - Function to invoke for each data point | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @param state - Optional state object to maintain across traversal callbacks | ||
| * @returns The state object after traversal completes | ||
| */ | ||
| const traverse = (target, callback, options, state) => traverseBetweenDepthRange(target, callback, options, state); | ||
| /** | ||
| * Gets the value at the specified path from the target. | ||
| * | ||
| * @param target - The target to get the value from. | ||
| * @param path - The path to the value. | ||
| * @param defaultValue - The default value to return if the path does not exist or an error occurs. | ||
| * @returns The value at the specified path or the default value. | ||
| * @throws {Error} Will throw an error if the path is not a non-empty array of strings and no default value for errors is provided. | ||
| * @remarks | ||
| * - If `defaultValue.onMissingKey` is provided, it will be returned when a key in the path is missing. | ||
| * - If `defaultValue.onError` is provided, it will be returned when any error occurs during the retrieval process. | ||
| */ | ||
| const getValue = (target, path, defaultValue) => { | ||
| if (isArray(path) === false) { | ||
| throw createError('Expected path to be a non-empty array of strings.'); | ||
| } | ||
| if (path.length === 0) | ||
| return target; | ||
| const hasOnMissingKeyDefault = !!(defaultValue && 'onMissingKey' in defaultValue); | ||
| const hasOnErrorDefault = !!(defaultValue && 'onError' in defaultValue); | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| let scope; | ||
| let scopeType; | ||
| let scopeIterable; | ||
| let scopeOperators; | ||
| try { | ||
| scope = target; | ||
| for (let index = 0; index < path.length; index += 1) { | ||
| const key = path[index]; | ||
| if (typeof key !== 'string') { | ||
| throw createError(`Expected path[${index}] to be a string, got ${typeof key}.`); | ||
| } | ||
| scopeType = getType(scope); | ||
| scopeIterable = isIterableType(scopeType); | ||
| /* instanbul ignore next */ | ||
| if (!scopeIterable && hasOnMissingKeyDefault) { | ||
| scope = defaultValue.onMissingKey; | ||
| break; | ||
| } | ||
| scopeOperators = getIterableOperators(scopeType); | ||
| if (scopeIterable && !scopeOperators.getKeys(scope).includes(key) && hasOnMissingKeyDefault) { | ||
| scope = defaultValue.onMissingKey; | ||
| break; | ||
| } | ||
| scope = scopeOperators.read(scope, key); | ||
| } | ||
| } | ||
| catch (error) { | ||
| if (hasOnErrorDefault) { | ||
| scope = defaultValue.onError; | ||
| } | ||
| else { | ||
| throw error; | ||
| } | ||
| } | ||
| return scope; | ||
| }; | ||
| /** | ||
| * Returns the total depth of a value's data structure, | ||
| * and returns a list of locations that are the most deeply nested. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to analyze for depth | ||
| * @returns A tuple containing the maximum depth and an array of paths to the deepest locations | ||
| */ | ||
| const getDepth = (target) => { | ||
| const trackDepth = (key, value, path, state) => { | ||
| if (state.depth < path.length) { | ||
| state.depth = path.length; | ||
| state.locations = [path]; | ||
| return; | ||
| } | ||
| if (state.depth === path.length) { | ||
| state.locations.push(path); | ||
| } | ||
| }; | ||
| const options = { depth: [0, '*'] }; | ||
| const state = { depth: 0, locations: [] }; | ||
| const { depth, locations } = traverse(target, trackDepth, options, state); | ||
| return [depth, locations]; | ||
| }; | ||
| /** | ||
| * Returns a list of locations where the key name matches a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against key names | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where the key pattern was found | ||
| */ | ||
| const locateKey = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => match(nextKey) && state.locations.push([...path, nextKey])); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Safe copies of Set built-in via factory function. | ||
| * | ||
| * Since constructors cannot be safely captured via Object.assign, this module | ||
| * provides a factory function that uses Reflect.construct internally. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/set | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Set = globalThis.Set; | ||
| const _Reflect = globalThis.Reflect; | ||
| /** | ||
| * (Safe copy) Creates a new Set using the captured Set constructor. | ||
| * Use this instead of `new Set()`. | ||
| * | ||
| * @param iterable - Optional iterable of values. | ||
| * @returns A new Set instance. | ||
| */ | ||
| const createSet = (iterable) => _Reflect.construct(_Set, iterable ? [iterable] : []); | ||
| /** | ||
| * Returns a list of unique key names that match a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against key names (defaults to matching all keys) | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of unique key names that match the pattern | ||
| */ | ||
| const getUniqueKeys = (target, pattern = /.+/, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => match(nextKey) && state.names.add(nextKey)); | ||
| }; | ||
| return from(traverse(target, callback, { depth: [0, '*'], ...options }, { | ||
| names: createSet(), | ||
| }).names.values()); | ||
| }; | ||
| /** | ||
| * Returns a list of locations where a text value matches a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against text values | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where the text pattern was found | ||
| */ | ||
| const locateText = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (text) => text === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => getType(value) === 'string' && match(value) && state.locations.push(path); | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Renames any key names that match a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of keys that were edited. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against key names | ||
| * @param name - The new name to assign to matching keys | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where keys were renamed | ||
| */ | ||
| const renameKey = (target, pattern, name, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| if (typeof name !== 'string') | ||
| throw createError('Expected name to be a string.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const rename = patternIsString ? () => name : (key) => key.replace(pattern, name); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, read, write, remove } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| if (!match(nextKey)) | ||
| return; | ||
| const newKey = rename(nextKey); | ||
| write(value, read(value, nextKey), newKey); | ||
| remove(value, nextKey); | ||
| state.locations.push([...path, newKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Removes any key names that match a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of keys that were removed. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against key names for removal | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where keys were removed | ||
| */ | ||
| const removeKey = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, remove } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| if (!match(nextKey)) | ||
| return; | ||
| remove(value, nextKey); | ||
| state.locations.push([...path, nextKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Edits any text by replacing any string or substring that matches a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of the original text that were edited. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against text values | ||
| * @param text - The replacement text for matching values | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where text was replaced | ||
| */ | ||
| const replaceText = (target, pattern, text, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| if (typeof text !== 'string') | ||
| throw createError('Expected name to be a string.'); | ||
| const match = patternIsString ? (text) => text.includes(pattern) : (text) => pattern.test(text); | ||
| const replace = (original) => original.replace(pattern, text); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, read, write } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| const nextValue = read(value, nextKey); | ||
| if (getType(nextValue) !== 'string' || !match(nextValue)) | ||
| return; | ||
| write(value, replace(nextValue), nextKey); | ||
| state.locations.push([...path, nextKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| exports.CircularReference = CircularReference; | ||
@@ -1284,2 +1540,1 @@ exports.containsKeys = containsKeys; | ||
| })); | ||
| //# sourceMappingURL=index.umd.js.map |
@@ -1,2 +0,1 @@ | ||
| !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).HyperfrontendDataUtils={})}(this,function(e){"use strict";const t=globalThis.Object,r=t.freeze,n=t.keys,s=e=>!("string"!=typeof e||!e.startsWith("__$"))&&/^__\$[0-9]+$/.test(e),o=[],i=[{classRef:Array,instantiate:()=>[],getKeys:e=>{const t=n(e);return f().detectCircularReferences?t.filter(e=>!s(e)):t},read:(e,t)=>e[t],write:(e,t,r)=>e[r]=t,remove:(e,t)=>e.splice(t,1)},{classRef:Object,instantiate:()=>({}),getKeys:e=>{const t=n(e);return f().detectCircularReferences?t.filter(e=>!s(e)):t},read:(e,t)=>e[t],write:(e,t,r)=>e[r]=t,remove:(e,t)=>delete e[t]}];let c=!1,a=!1;const l=e=>{c="boolean"==typeof e.samePositionOfOwnProperties?e.samePositionOfOwnProperties:c||!1,a="boolean"==typeof e.detectCircularReferences?e.detectCircularReferences:a||!1},f=()=>({samePositionOfOwnProperties:c,detectCircularReferences:a}),u=(...e)=>e.forEach(e=>!o.includes(e)&&o.push(e)),h=(...e)=>{if(0===e.length){for(;0!==o.length;)o.shift();return}const t=e.map(e=>o.indexOf(e)).filter(e=>e>=0).sort();for(;0!==t.length;)o.splice(t[t.length-1],1),t.pop()},d=globalThis.Array,p=d.isArray,g=d.from,y=e=>{if(null===e)return"null";const t=typeof e;if("object"===t){if(p(e))return"array";for(const t of o)if(e instanceof t)return t.name}return t},b=(e,t)=>{const r=y(e);return r===y(t)&&r},x=(e,t)=>{"array"===t&&(t=Array.name),"object"===t&&(t=Object.name);const r=i.find(({classRef:e})=>t===e.name);return void 0===r?[]:r.getKeys(e)},m=()=>i.map(({classRef:e})=>{const t=e.name;return t===Object.name?"object":t===Array.name?"array":t}),w=e=>m().includes(e),R=(e,t)=>{const r=b(e,t);if(!1===r)return!1;if(w(r)){const n=x(e,r),s=x(t,r),o=n.length;if(o!==s.length)return!1;if(0===o)return r;if(f().samePositionOfOwnProperties){for(let e=0;e<o;e+=1)if(n[e]!==s[e])return!1}else for(let e=0;e<o;e+=1)if(!s.includes(n[e]))return!1}return r},E=e=>w(y(e)),C=globalThis.Error,K=globalThis.Reflect,v=(e,t)=>K.construct(C,[e,t]);class _{location;target;keyDelimiter="·";delimiter=" → ";constructor(e,t){if(!p(e)||0===e.length)throw v("Expected location to be a list with at list one string value.");if(!p(t))throw v("Expected target to be a list.");this.location={path:e},this.target={path:t}}get depth(){return this.location.path.length-this.target.path.length}toString=()=>`${this.join(this.location)}${this.delimiter}${this.join(this.target)}`;toJSON=()=>this.toString();join=({path:e})=>e.join(this.keyDelimiter)}const T=e=>{const{getKeys:t,read:r,write:n,remove:s,instantiate:o}=i.find(t=>t.classRef.name.toLowerCase()===e.toLowerCase());return{getKeys:t,read:r,write:n,remove:s,instantiate:o}},O=globalThis.Map,k=globalThis.Reflect,j=globalThis.Date,S=globalThis.Reflect;const $=globalThis.Math,P=$.round,I=$.random,z=()=>`__$${`${P(1e13*I())}${function(...e){return S.construct(j,e)}().getTime()}`}`,A=()=>{const e=k.construct(O,t?[t]:[]);var t;const r=z(),n=t=>!!E(t)&&(r in t&&e.has(t[r]));return{add:t=>(t=>{E(t)&&!n(t)&&(t[r]=Symbol(),e.set(t[r],[r,t,e.size]))})(t),exists:e=>n(e),lastSeen:t=>(t=>{if(!E(t))return null;const n=e.get(t[r]);return n?n[2]-e.size:null})(t),clear:()=>(e.forEach(([e,t])=>{delete t[e]}),e.clear()),get size(){return e.size}}},M=(e,t,r=!1)=>{if(t.exists(e))return!0;const n=y(e);if(!w(n))return!1;t.add(e);const{getKeys:s,read:o}=T(n),i=s(e).some(r=>M(o(e,r),t));return r&&t.clear(),i},D="Invalid maxResults argument.",F=(e,t,r,n,s,o=!1)=>{if(s.length===t)return s;if(n.exists(e))return s.push(new _(r,r.slice(0,n.lastSeen(e)))),s;const i=y(e);if(!w(i))return s;n.add(e);const{getKeys:c,read:a}=T(i);return c(e).forEach(o=>F(a(e,o),t,[...r,o],n,s)),o&&n.clear(),s},V=(e,t)=>{if(e===t)return!0;const r=R(e,t);if(!1===r)return r;if("function"===r)return e.toString()===t.toString();if(!w(r))return e===t;const{getKeys:n,read:s}=T(r),o=n(e),i=o.length;for(let r=0;r<i;r+=1){const n=o[r];if(!V(s(e,n),s(t,n)))return!1}return!0},N=()=>{},L=(e,t,...r)=>{const n=()=>(r[0].add(e),r[1].add(t)),s=(e=>e.every(e=>!e.size))(r)?(n(),()=>(e=>e.forEach(e=>e.clear()))(r)):N;if(e===t)return s(),!0;const o=R(e,t);if(!1===o)return s(),o;if("function"===o)return s(),e.toString()===t.toString();if(!w(o))return s(),e===t;const{getKeys:i,read:c}=T(o),a=i(e),l=a.length;for(let o=0;o<l;o+=1){const i=a[o],l=c(e,i),f=c(t,i),u=r[0].exists(l);if(u!==r[1].exists(f))return s(),!1;if(u){if(r[0].lastSeen(l)!==r[1].lastSeen(f))return s(),!1}else if(n(),!L(l,f,...r))return s(),!1}return s(),!0},U=(e,t,r,n,s)=>{const o=y(e);if(!w(o))return e;const{instantiate:i,getKeys:c,read:a,write:l}=T(o),f=i(),u=c(e);for(let o=0;o<u.length;o+=1){const i=u[o];if("__proto__"===i)continue;const c=a(e,i),h=t.concat(i),d=y(c);!r(c,h,i,d)||n&&"function"===d?s(c,h,i,d):l(f,U(c,h,r,n,s),i)}return f},q=(e,t,r,n,s,o,i,c=!1)=>{c&&o.add(e);const a=y(e);if(!w(a))return e;const{instantiate:l,getKeys:f,read:u,write:h}=T(a),d=l(),p=f(e);for(let c=0;c<p.length;c+=1){const a=p[c];if("__proto__"===a)continue;const l=u(e,a),f=t.concat(a),g=y(l);if(!r(l,f,a,g)||n&&"function"===g){s(l,f,a,g);continue}o.exists(l)?i.push({startPath:f,destinationPath:f.slice(0,o.lastSeen(l))}):(o.add(l),h(d,q(l,f,r,n,s,o,i),a))}return c&&(i.forEach(({startPath:e,destinationPath:t})=>{let[r,n]=[d,d];for(let t=0;t<e.length-1;t+=1)"__proto__"!==e[t]&&(r=r[e[t]]);for(let e=0;e<t.length;e+=1)"__proto__"!==t[e]&&(n=n[t[e]]);const s=e[e.length-1];"__proto__"!==s&&(r[s]=n)}),o.clear()),d},H=(e,t)=>`Expected ${e} to be ${t}.`,J=(e,t,r)=>({nextPath:[...e,t],nextValue:r[t]}),W=(e,t,r,n,s,o,i,c,a,l=!1)=>{if(a.exists(o))return c;const f=e(r,n,o,s,i);if(r.exitEarly)return c;f&&t(n,o,s,c,i),a.add(o);const u=y(o);if(!w(u))return c;return x(o,u).forEach(n=>{const{nextPath:i,nextValue:l}=J(s,n,o);W(e,t,r,n,i,l,o,c,a)}),l&&a.clear(),c},B=(e,t,r,n,s,o,i,c)=>{const a=e(r,n,o,s,i);if(r.exitEarly)return c;a&&t(n,o,s,c,i);const l=y(o);if(!w(l))return c;return x(o,l).forEach(n=>{const{nextPath:i,nextValue:a}=J(s,n,o);B(e,t,r,n,i,a,o,c)}),c},G=e=>(t,n,s,o)=>((e,t,n,s,o)=>{if("function"!=typeof n)throw v(H("callback","a function"));if("object"!=typeof s||p(s))throw v(H("options","an object"));if(!p(s.depth))throw v(H("options.depth","an array"));const[i,c]=s.depth;if(void 0!==i&&"number"!=typeof i)throw v(H("options.depth.0","a number"));if(void 0!==c){const e=typeof c;if(!["number","string"].includes(e))throw v(H("options.depth.1","a number or a string"));if("string"===e&&"*"!==c)throw v("Only valid string value in options.depth.1 is '*'.")}const a=[t,n,{depth:r([s.depth[0]??0,s.depth[1]??"*"]),exitEarly:!1},"",[],e,void 0,o];return f().detectCircularReferences?W(...a,A(),!0):B(...a)})(t,e,n,s??{depth:[0,"*"]},o??{}),Q=G((e,t,r,n)=>!(n.length<e.depth[0]||e.depth[1]<n.length)),X=(e,t,r,n)=>Q(e,t,r,n),Y=globalThis.Set,Z=globalThis.Reflect;e.CircularReference=_,e.containsKeys=(e,t)=>{if(0===t.length)return!1;const r=y(e);if(!1===w(r))return!1;const n=x(e,r);return!t.some(e=>!n.includes(e))},e.createTraversal=G,e.deregisterClassTypes=h,e.deregisterIterableClass=(...e)=>{if(0===e.length)for(let e=i.length-1;e>=0;e--){const t=i[e].classRef;[Array,Object].includes(t)||i.splice(e,1)}else{const t=e.map(e=>i.findIndex(t=>t.classRef===e)).filter(e=>e>=0).sort();for(;t.length>0;)i.splice(t[t.length-1],1),t.pop()}h(...e)},e.getConfig=f,e.getDepth=e=>{const{depth:t,locations:r}=X(e,(e,t,r,n)=>{if(n.depth<r.length)return n.depth=r.length,void(n.locations=[r]);n.depth===r.length&&n.locations.push(r)},{depth:[0,"*"]},{depth:0,locations:[]});return[t,r]},e.getIterableOperators=T,e.getIterableTypes=m,e.getKeysFromIterable=x,e.getType=y,e.getUniqueKeys=(e,t=/.+/,r)=>{const n="string"==typeof t;if(!(n||t instanceof RegExp))throw v("Expected pattern to be either a string of a regular expression.");const s=n?e=>e===t:e=>t.test(e);return g(X(e,(e,t,r,n)=>{const o=y(t);if(!w(o))return;const{getKeys:i}=T(o);i(t).forEach(e=>s(e)&&n.names.add(e))},{depth:[0,"*"],...r},{names:Z.construct(Y,o?[o]:[])}).names.values());var o},e.getValue=(e,t,r)=>{if(!1===p(t))throw v("Expected path to be a non-empty array of strings.");if(0===t.length)return e;const n=!(!r||!("onMissingKey"in r)),s=!(!r||!("onError"in r));let o,i,c,a;try{o=e;for(let e=0;e<t.length;e+=1){const s=t[e];if("string"!=typeof s)throw v(`Expected path[${e}] to be a string, got ${typeof s}.`);if(i=y(o),c=w(i),!c&&n){o=r.onMissingKey;break}if(a=T(i),c&&!a.getKeys(o).includes(s)&&n){o=r.onMissingKey;break}o=a.read(o,s)}}catch(e){if(!s)throw e;o=r.onError}return o},e.hasCircularReference=e=>{const t=f().detectCircularReferences;t||l({detectCircularReferences:!0});const r=M(e,A(),!0);return t||l({detectCircularReferences:!1}),r},e.isIdentical=(e,t)=>{const r=[e,t];return f().detectCircularReferences?L(...r,A(),A()):V(...r)},e.isIterable=E,e.isIterableType=w,e.isMarker=s,e.locateCircularReference=(e,t=1)=>{const r=typeof t;if(!["string","number"].includes(r))throw v(D);if("string"===r&&"*"!==t)throw v(D);if("number"===r&&(t<1||[NaN,1/0].includes(t)))throw v(D);const n=f().detectCircularReferences;n||l({detectCircularReferences:!0});const s=F(e,t,[],A(),[],!0);return n||l({detectCircularReferences:!1}),s},e.locateCircularReferenceRecursive=F,e.locateKey=(e,t,r)=>{const n="string"==typeof t;if(!(n||t instanceof RegExp))throw v("Expected pattern to be either a string of a regular expression.");const s=n?e=>e===t:e=>t.test(e);return X(e,(e,t,r,n)=>{const o=y(t);if(!w(o))return;const{getKeys:i}=T(o);i(t).forEach(e=>s(e)&&n.locations.push([...r,e]))},{depth:[0,"*"],...r},{locations:[]}).locations},e.locateText=(e,t,r)=>{const n="string"==typeof t;if(!(n||t instanceof RegExp))throw v("Expected pattern to be either a string of a regular expression.");const s=n?e=>e===t:e=>t.test(e);return X(e,(e,t,r,n)=>"string"===y(t)&&s(t)&&n.locations.push(r),{depth:[0,"*"],...r},{locations:[]}).locations},e.marker=z,e.referenceStack=A,e.registerClassTypes=u,e.registerIterableClass=(e,t,r,n,o,c=()=>new e)=>{const a=i.findIndex(t=>t.classRef===e),l={classRef:e,getKeys:e=>f().detectCircularReferences?[...t(e)].filter(e=>!s(e)):t(e),read:r,write:n,remove:o,instantiate:c};a>=0?i[a]=l:(i.unshift(l),u(e))},e.registeredClasses=o,e.registeredIterableClasses=i,e.removeKey=(e,t,r)=>{const n="string"==typeof t;if(!(n||t instanceof RegExp))throw v("Expected pattern to be either a string of a regular expression.");const s=n?e=>e===t:e=>t.test(e);return X(e,(e,t,r,n)=>{const o=y(t);if(!w(o))return;const{getKeys:i,remove:c}=T(o);i(t).forEach(e=>{s(e)&&(c(t,e),n.locations.push([...r,e]))})},{depth:[0,"*"],...r},{locations:[]}).locations},e.renameKey=(e,t,r,n)=>{const s="string"==typeof t;if(!(s||t instanceof RegExp))throw v("Expected pattern to be either a string of a regular expression.");if("string"!=typeof r)throw v("Expected name to be a string.");const o=s?e=>e===t:e=>t.test(e),i=s?()=>r:e=>e.replace(t,r);return X(e,(e,t,r,n)=>{const s=y(t);if(!w(s))return;const{getKeys:c,read:a,write:l,remove:f}=T(s);c(t).forEach(e=>{if(!o(e))return;const s=i(e);l(t,a(t,e),s),f(t,e),n.locations.push([...r,s])})},{depth:[0,"*"],...n},{locations:[]}).locations},e.replaceText=(e,t,r,n)=>{const s="string"==typeof t;if(!(s||t instanceof RegExp))throw v("Expected pattern to be either a string of a regular expression.");if("string"!=typeof r)throw v("Expected name to be a string.");const o=s?e=>e.includes(t):e=>t.test(e);return X(e,(e,n,s,i)=>{const c=y(n);if(!w(c))return;const{getKeys:a,read:l,write:f}=T(c);a(n).forEach(e=>{const c=l(n,e);"string"===y(c)&&o(c)&&(f(n,c.replace(t,r),e),i.locations.push([...s,e]))})},{depth:[0,"*"],...n},{locations:[]}).locations},e.sameStructure=R,e.sameType=b,e.selectiveCopy=(e,t)=>{if(void 0!==t&&"object"!==y(t))throw v("Invalid options argument.");t||(t={}),t.skipFunctions||(t.skipFunctions=!1);const r=["includeKeys","excludeKeys","include","exclude"];let n="";for(let e=0;e<r.length;e+=1){const s=r[e]in t;if(n&&s)throw v(`Options ${n} and ${r[e]} are mutually exclusive.`);s&&(n=r[e])}const{includeKeys:s,excludeKeys:o,include:i,exclude:c,skipFunctions:a}=t;let l=(e,t,r,n)=>!0;switch(n){case"includeKeys":l=(e,t,r,n)=>1!==t.length||s.includes(r);break;case"excludeKeys":l=(e,t,r,n)=>1!==t.length||!o.includes(r);break;case"include":l=i;break;case"exclude":l=(e,t,r,n)=>!c(e,t,r,n)}const u=[],h=(e,t,r,n)=>u.push({target:e,path:t,key:r,dataType:n});let d;return d=f().detectCircularReferences?q(e,[],l,a,h,A(),[],!0):U(e,[],l,a,h),{clone:d,skipped:u}},e.selectiveCopyForCircularReferencesRecursive=q,e.selectiveCopyRecursive=U,e.setConfig=l,e.traverse=X}); | ||
| //# sourceMappingURL=index.umd.min.js.map | ||
| !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).HyperfrontendDataUtils={})}(this,function(e){"use strict";const t=globalThis.Array,r=t.isArray,n=t.from,s=globalThis.Error,o=globalThis.Reflect,i=(e,t)=>o.construct(s,[e,t]);class c{location;target;keyDelimiter="·";delimiter=" → ";constructor(e,t){if(!r(e)||0===e.length)throw i("Expected location to be a list with at list one string value.");if(!r(t))throw i("Expected target to be a list.");this.location={path:e},this.target={path:t}}get depth(){return this.location.path.length-this.target.path.length}toString=()=>`${this.join(this.location)}${this.delimiter}${this.join(this.target)}`;toJSON=()=>this.toString();join=({path:e})=>e.join(this.keyDelimiter)}const a=globalThis.Object,l=a.freeze,f=a.keys,u=e=>!("string"!=typeof e||!e.startsWith("__$"))&&/^__\$[0-9]+$/.test(e),h=[],d=[{classRef:Array,instantiate:()=>[],getKeys:e=>{const t=f(e);return b().detectCircularReferences?t.filter(e=>!u(e)):t},read:(e,t)=>e[t],write:(e,t,r)=>e[r]=t,remove:(e,t)=>e.splice(t,1)},{classRef:Object,instantiate:()=>({}),getKeys:e=>{const t=f(e);return b().detectCircularReferences?t.filter(e=>!u(e)):t},read:(e,t)=>e[t],write:(e,t,r)=>e[r]=t,remove:(e,t)=>delete e[t]}];let p=!1,g=!1;const y=e=>{p="boolean"==typeof e.samePositionOfOwnProperties?e.samePositionOfOwnProperties:p||!1,g="boolean"==typeof e.detectCircularReferences?e.detectCircularReferences:g||!1},b=()=>({samePositionOfOwnProperties:p,detectCircularReferences:g}),x=(e,t)=>{"array"===t&&(t=Array.name),"object"===t&&(t=Object.name);const r=d.find(({classRef:e})=>t===e.name);return void 0===r?[]:r.getKeys(e)},m=e=>{if(null===e)return"null";const t=typeof e;if("object"===t){if(r(e))return"array";for(const t of h)if(e instanceof t)return t.name}return t},w=()=>d.map(({classRef:e})=>{const t=e.name;return t===Object.name?"object":t===Array.name?"array":t}),R=e=>w().includes(e),E=(...e)=>{if(0===e.length){for(;0!==h.length;)h.shift();return}const t=e.map(e=>h.indexOf(e)).filter(e=>e>=0).sort();for(;0!==t.length;)h.splice(t[t.length-1],1),t.pop()},C=globalThis.Map,K=globalThis.Reflect,v=e=>R(m(e)),_=globalThis.Date,T=globalThis.Reflect;const O=globalThis.Math,k=O.round,j=O.random,S=()=>`__$${`${k(1e13*j())}${function(...e){return T.construct(_,e)}().getTime()}`}`,$=()=>{const e=K.construct(C,t?[t]:[]);var t;const r=S(),n=t=>!!v(t)&&(r in t&&e.has(t[r]));return{add:t=>(t=>{v(t)&&!n(t)&&(t[r]=Symbol(),e.set(t[r],[r,t,e.size]))})(t),exists:e=>n(e),lastSeen:t=>(t=>{if(!v(t))return null;const n=e.get(t[r]);return n?n[2]-e.size:null})(t),clear:()=>(e.forEach(([e,t])=>{delete t[e]}),e.clear()),get size(){return e.size}}},P=(e,t)=>`Expected ${e} to be ${t}.`,I=(e,t,r)=>({nextPath:[...e,t],nextValue:r[t]}),z=(e,t,r,n,s,o,i,c,a,l=!1)=>{if(a.exists(o))return c;const f=e(r,n,o,s,i);if(r.exitEarly)return c;f&&t(n,o,s,c,i),a.add(o);const u=m(o);if(!R(u))return c;return x(o,u).forEach(n=>{const{nextPath:i,nextValue:l}=I(s,n,o);z(e,t,r,n,i,l,o,c,a)}),l&&a.clear(),c},A=(e,t,r,n,s,o,i,c)=>{const a=e(r,n,o,s,i);if(r.exitEarly)return c;a&&t(n,o,s,c,i);const l=m(o);if(!R(l))return c;return x(o,l).forEach(n=>{const{nextPath:i,nextValue:a}=I(s,n,o);A(e,t,r,n,i,a,o,c)}),c},M=e=>(t,n,s,o)=>((e,t,n,s,o)=>{if("function"!=typeof n)throw i(P("callback","a function"));if("object"!=typeof s||r(s))throw i(P("options","an object"));if(!r(s.depth))throw i(P("options.depth","an array"));const[c,a]=s.depth;if(void 0!==c&&"number"!=typeof c)throw i(P("options.depth.0","a number"));if(void 0!==a){const e=typeof a;if(!["number","string"].includes(e))throw i(P("options.depth.1","a number or a string"));if("string"===e&&"*"!==a)throw i("Only valid string value in options.depth.1 is '*'.")}const f=[t,n,{depth:l([s.depth[0]??0,s.depth[1]??"*"]),exitEarly:!1},"",[],e,void 0,o];return b().detectCircularReferences?z(...f,$(),!0):A(...f)})(t,e,n,s??{depth:[0,"*"]},o??{}),D=M((e,t,r,n)=>!(n.length<e.depth[0]||e.depth[1]<n.length)),F=(e,t,r,n)=>D(e,t,r,n),V=e=>{const{getKeys:t,read:r,write:n,remove:s,instantiate:o}=d.find(t=>t.classRef.name.toLowerCase()===e.toLowerCase());return{getKeys:t,read:r,write:n,remove:s,instantiate:o}},N=globalThis.Set,L=globalThis.Reflect,U=(e,t,r=!1)=>{if(t.exists(e))return!0;const n=m(e);if(!R(n))return!1;t.add(e);const{getKeys:s,read:o}=V(n),i=s(e).some(r=>U(o(e,r),t));return r&&t.clear(),i},q=(e,t)=>{const r=m(e);return r===m(t)&&r},H=(e,t)=>{const r=q(e,t);if(!1===r)return!1;if(R(r)){const n=x(e,r),s=x(t,r),o=n.length;if(o!==s.length)return!1;if(0===o)return r;if(b().samePositionOfOwnProperties){for(let e=0;e<o;e+=1)if(n[e]!==s[e])return!1}else for(let e=0;e<o;e+=1)if(!s.includes(n[e]))return!1}return r},J=(e,t)=>{if(e===t)return!0;const r=H(e,t);if(!1===r)return r;if("function"===r)return e.toString()===t.toString();if(!R(r))return e===t;const{getKeys:n,read:s}=V(r),o=n(e),i=o.length;for(let r=0;r<i;r+=1){const n=o[r];if(!J(s(e,n),s(t,n)))return!1}return!0},W=()=>{},B=(e,t,...r)=>{const n=()=>(r[0].add(e),r[1].add(t)),s=(e=>e.every(e=>!e.size))(r)?(n(),()=>(e=>e.forEach(e=>e.clear()))(r)):W;if(e===t)return s(),!0;const o=H(e,t);if(!1===o)return s(),o;if("function"===o)return s(),e.toString()===t.toString();if(!R(o))return s(),e===t;const{getKeys:i,read:c}=V(o),a=i(e),l=a.length;for(let o=0;o<l;o+=1){const i=a[o],l=c(e,i),f=c(t,i),u=r[0].exists(l);if(u!==r[1].exists(f))return s(),!1;if(u){if(r[0].lastSeen(l)!==r[1].lastSeen(f))return s(),!1}else if(n(),!B(l,f,...r))return s(),!1}return s(),!0},G="Invalid maxResults argument.",Q=(e,t,r,n,s,o=!1)=>{if(s.length===t)return s;if(n.exists(e))return s.push(new c(r,r.slice(0,n.lastSeen(e)))),s;const i=m(e);if(!R(i))return s;n.add(e);const{getKeys:a,read:l}=V(i);return a(e).forEach(o=>Q(l(e,o),t,[...r,o],n,s)),o&&n.clear(),s},X=(...e)=>e.forEach(e=>!h.includes(e)&&h.push(e)),Y=(e,t,r,n,s)=>{const o=m(e);if(!R(o))return e;const{instantiate:i,getKeys:c,read:a,write:l}=V(o),f=i(),u=c(e);for(let o=0;o<u.length;o+=1){const i=u[o];if("__proto__"===i)continue;const c=a(e,i),h=t.concat(i),d=m(c);!r(c,h,i,d)||n&&"function"===d?s(c,h,i,d):l(f,Y(c,h,r,n,s),i)}return f},Z=(e,t,r,n,s,o,i,c=!1)=>{c&&o.add(e);const a=m(e);if(!R(a))return e;const{instantiate:l,getKeys:f,read:u,write:h}=V(a),d=l(),p=f(e);for(let c=0;c<p.length;c+=1){const a=p[c];if("__proto__"===a)continue;const l=u(e,a),f=t.concat(a),g=m(l);if(!r(l,f,a,g)||n&&"function"===g){s(l,f,a,g);continue}o.exists(l)?i.push({startPath:f,destinationPath:f.slice(0,o.lastSeen(l))}):(o.add(l),h(d,Z(l,f,r,n,s,o,i),a))}return c&&(i.forEach(({startPath:e,destinationPath:t})=>{let[r,n]=[d,d];for(let t=0;t<e.length-1;t+=1)"__proto__"!==e[t]&&(r=r[e[t]]);for(let e=0;e<t.length;e+=1)"__proto__"!==t[e]&&(n=n[t[e]]);const s=e[e.length-1];"__proto__"!==s&&(r[s]=n)}),o.clear()),d};e.CircularReference=c,e.containsKeys=(e,t)=>{if(0===t.length)return!1;const r=m(e);if(!1===R(r))return!1;const n=x(e,r);return!t.some(e=>!n.includes(e))},e.createTraversal=M,e.deregisterClassTypes=E,e.deregisterIterableClass=(...e)=>{if(0===e.length)for(let e=d.length-1;e>=0;e--){const t=d[e].classRef;[Array,Object].includes(t)||d.splice(e,1)}else{const t=e.map(e=>d.findIndex(t=>t.classRef===e)).filter(e=>e>=0).sort();for(;t.length>0;)d.splice(t[t.length-1],1),t.pop()}E(...e)},e.getConfig=b,e.getDepth=e=>{const{depth:t,locations:r}=F(e,(e,t,r,n)=>{if(n.depth<r.length)return n.depth=r.length,void(n.locations=[r]);n.depth===r.length&&n.locations.push(r)},{depth:[0,"*"]},{depth:0,locations:[]});return[t,r]},e.getIterableOperators=V,e.getIterableTypes=w,e.getKeysFromIterable=x,e.getType=m,e.getUniqueKeys=(e,t=/.+/,r)=>{const s="string"==typeof t;if(!(s||t instanceof RegExp))throw i("Expected pattern to be either a string of a regular expression.");const o=s?e=>e===t:e=>t.test(e);return n(F(e,(e,t,r,n)=>{const s=m(t);if(!R(s))return;const{getKeys:i}=V(s);i(t).forEach(e=>o(e)&&n.names.add(e))},{depth:[0,"*"],...r},{names:L.construct(N,c?[c]:[])}).names.values());var c},e.getValue=(e,t,n)=>{if(!1===r(t))throw i("Expected path to be a non-empty array of strings.");if(0===t.length)return e;const s=!(!n||!("onMissingKey"in n)),o=!(!n||!("onError"in n));let c,a,l,f;try{c=e;for(let e=0;e<t.length;e+=1){const r=t[e];if("string"!=typeof r)throw i(`Expected path[${e}] to be a string, got ${typeof r}.`);if(a=m(c),l=R(a),!l&&s){c=n.onMissingKey;break}if(f=V(a),l&&!f.getKeys(c).includes(r)&&s){c=n.onMissingKey;break}c=f.read(c,r)}}catch(e){if(!o)throw e;c=n.onError}return c},e.hasCircularReference=e=>{const t=b().detectCircularReferences;t||y({detectCircularReferences:!0});const r=U(e,$(),!0);return t||y({detectCircularReferences:!1}),r},e.isIdentical=(e,t)=>{const r=[e,t];return b().detectCircularReferences?B(...r,$(),$()):J(...r)},e.isIterable=v,e.isIterableType=R,e.isMarker=u,e.locateCircularReference=(e,t=1)=>{const r=typeof t;if(!["string","number"].includes(r))throw i(G);if("string"===r&&"*"!==t)throw i(G);if("number"===r&&(t<1||[NaN,1/0].includes(t)))throw i(G);const n=b().detectCircularReferences;n||y({detectCircularReferences:!0});const s=Q(e,t,[],$(),[],!0);return n||y({detectCircularReferences:!1}),s},e.locateCircularReferenceRecursive=Q,e.locateKey=(e,t,r)=>{const n="string"==typeof t;if(!(n||t instanceof RegExp))throw i("Expected pattern to be either a string of a regular expression.");const s=n?e=>e===t:e=>t.test(e);return F(e,(e,t,r,n)=>{const o=m(t);if(!R(o))return;const{getKeys:i}=V(o);i(t).forEach(e=>s(e)&&n.locations.push([...r,e]))},{depth:[0,"*"],...r},{locations:[]}).locations},e.locateText=(e,t,r)=>{const n="string"==typeof t;if(!(n||t instanceof RegExp))throw i("Expected pattern to be either a string of a regular expression.");const s=n?e=>e===t:e=>t.test(e);return F(e,(e,t,r,n)=>"string"===m(t)&&s(t)&&n.locations.push(r),{depth:[0,"*"],...r},{locations:[]}).locations},e.marker=S,e.referenceStack=$,e.registerClassTypes=X,e.registerIterableClass=(e,t,r,n,s,o=()=>new e)=>{const i=d.findIndex(t=>t.classRef===e),c={classRef:e,getKeys:e=>b().detectCircularReferences?[...t(e)].filter(e=>!u(e)):t(e),read:r,write:n,remove:s,instantiate:o};i>=0?d[i]=c:(d.unshift(c),X(e))},e.registeredClasses=h,e.registeredIterableClasses=d,e.removeKey=(e,t,r)=>{const n="string"==typeof t;if(!(n||t instanceof RegExp))throw i("Expected pattern to be either a string of a regular expression.");const s=n?e=>e===t:e=>t.test(e);return F(e,(e,t,r,n)=>{const o=m(t);if(!R(o))return;const{getKeys:i,remove:c}=V(o);i(t).forEach(e=>{s(e)&&(c(t,e),n.locations.push([...r,e]))})},{depth:[0,"*"],...r},{locations:[]}).locations},e.renameKey=(e,t,r,n)=>{const s="string"==typeof t;if(!(s||t instanceof RegExp))throw i("Expected pattern to be either a string of a regular expression.");if("string"!=typeof r)throw i("Expected name to be a string.");const o=s?e=>e===t:e=>t.test(e),c=s?()=>r:e=>e.replace(t,r);return F(e,(e,t,r,n)=>{const s=m(t);if(!R(s))return;const{getKeys:i,read:a,write:l,remove:f}=V(s);i(t).forEach(e=>{if(!o(e))return;const s=c(e);l(t,a(t,e),s),f(t,e),n.locations.push([...r,s])})},{depth:[0,"*"],...n},{locations:[]}).locations},e.replaceText=(e,t,r,n)=>{const s="string"==typeof t;if(!(s||t instanceof RegExp))throw i("Expected pattern to be either a string of a regular expression.");if("string"!=typeof r)throw i("Expected name to be a string.");const o=s?e=>e.includes(t):e=>t.test(e);return F(e,(e,n,s,i)=>{const c=m(n);if(!R(c))return;const{getKeys:a,read:l,write:f}=V(c);a(n).forEach(e=>{const c=l(n,e);"string"===m(c)&&o(c)&&(f(n,c.replace(t,r),e),i.locations.push([...s,e]))})},{depth:[0,"*"],...n},{locations:[]}).locations},e.sameStructure=H,e.sameType=q,e.selectiveCopy=(e,t)=>{if(void 0!==t&&"object"!==m(t))throw i("Invalid options argument.");t||(t={}),t.skipFunctions||(t.skipFunctions=!1);const r=["includeKeys","excludeKeys","include","exclude"];let n="";for(let e=0;e<r.length;e+=1){const s=r[e]in t;if(n&&s)throw i(`Options ${n} and ${r[e]} are mutually exclusive.`);s&&(n=r[e])}const{includeKeys:s,excludeKeys:o,include:c,exclude:a,skipFunctions:l}=t;let f=(e,t,r,n)=>!0;switch(n){case"includeKeys":f=(e,t,r,n)=>1!==t.length||s.includes(r);break;case"excludeKeys":f=(e,t,r,n)=>1!==t.length||!o.includes(r);break;case"include":f=c;break;case"exclude":f=(e,t,r,n)=>!a(e,t,r,n)}const u=[],h=(e,t,r,n)=>u.push({target:e,path:t,key:r,dataType:n});let d;return d=b().detectCircularReferences?Z(e,[],f,l,h,$(),[],!0):Y(e,[],f,l,h),{clone:d,skipped:u}},e.selectiveCopyForCircularReferencesRecursive=Z,e.selectiveCopyRecursive=Y,e.setConfig=y,e.traverse=F}); |
+14
-8
| # Changelog | ||
| This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). | ||
| All notable changes to this project will be documented in this file. | ||
| ## [0.0.4](https://github.com/AndrewRedican/hyperfrontend/compare/lib-data-utils@0.0.3...lib-data-utils@0.0.4) (2026-03-08) | ||
| ## [0.0.5](https://github.com/AndrewRedican/hyperfrontend/compare/c8db08be8b183addd26caf81fdd17fb3693f296f...466c0388c4cd516b9c704214140b4df1004098e6) - 2026-06-23 | ||
| ### Other | ||
| - **@hyperfrontend/workspace:** remove lib-builder and tool-package as implicit dependencies for all lib projects | ||
| ## [0.0.4](https://github.com/AndrewRedican/hyperfrontend/compare/lib-data-utils@0.0.3...lib-data-utils@0.0.4) - 2026-03-08 | ||
| ### Bug Fixes | ||
| * **lib-data-utils:** correct package exports and dependencies ([7a58375](https://github.com/AndrewRedican/hyperfrontend/commit/7a58375f09946e313994bb6ea14e0807c8563381)) | ||
| - **lib-data-utils:** correct package exports and dependencies ([7a58375](https://github.com/AndrewRedican/hyperfrontend/commit/7a58375f09946e313994bb6ea14e0807c8563381)) | ||
| ## [0.0.3](https://github.com/AndrewRedican/hyperfrontend/compare/lib-data-utils@0.0.2...lib-data-utils@0.0.3) (2026-03-02) | ||
| ## [0.0.3](https://github.com/AndrewRedican/hyperfrontend/compare/lib-data-utils@0.0.2...lib-data-utils@0.0.3) - 2026-03-02 | ||
| ### Bug Fixes | ||
| * **lib-data-utils:** correct package exports and dependencies ([7a58375](https://github.com/AndrewRedican/hyperfrontend/commit/7a58375f09946e313994bb6ea14e0807c8563381)) | ||
| - **lib-data-utils:** correct package exports and dependencies ([7a58375](https://github.com/AndrewRedican/hyperfrontend/commit/7a58375f09946e313994bb6ea14e0807c8563381)) | ||
| ## [0.0.2](https://github.com/AndrewRedican/hyperfrontend/compare/lib-data-utils@0.0.1...lib-data-utils@0.0.2) (2026-02-26) | ||
| ## [0.0.2](https://github.com/AndrewRedican/hyperfrontend/compare/lib-data-utils@0.0.1...lib-data-utils@0.0.2) - 2026-02-26 | ||
| ## 0.0.1 (2026-02-15) | ||
| ## 0.0.1 - 2026-02-15 | ||
+840
-724
| 'use strict'; | ||
| const index_cjs_js = require('./_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/array/index.cjs.js'); | ||
| const index_cjs_js$1 = require('./_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.cjs.js'); | ||
| const index_cjs_js$2 = require('./_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/object/index.cjs.js'); | ||
| const index_cjs_js$5 = require('./_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/map/index.cjs.js'); | ||
| const index_cjs_js$4 = require('./_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/date/index.cjs.js'); | ||
| const index_cjs_js$3 = require('./_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.cjs.js'); | ||
| const index_cjs_js$6 = require('./_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.cjs.js'); | ||
| /** | ||
| * Safe copies of Object built-in methods. | ||
| * Represents a detected circular reference in an object graph. | ||
| * Tracks the location where the reference was found and its target. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/object | ||
| * @example Creating a circular reference instance | ||
| * ```typescript | ||
| * const ref = new CircularReference(['root', 'child'], ['root']) | ||
| * console.log(ref.depth) // 1 | ||
| * ``` | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Object = globalThis.Object; | ||
| class CircularReference { | ||
| location; | ||
| target; | ||
| keyDelimiter = '\u00B7'; | ||
| delimiter = ' \u2192 '; | ||
| constructor(location, target) { | ||
| if (!index_cjs_js.isArray(location) || location.length === 0) { | ||
| throw index_cjs_js$1.createError(`Expected location to be a list with at list one string value.`); | ||
| } | ||
| if (!index_cjs_js.isArray(target)) { | ||
| throw index_cjs_js$1.createError(`Expected target to be a list.`); | ||
| } | ||
| this.location = { path: location }; | ||
| this.target = { path: target }; | ||
| } | ||
| get depth() { | ||
| return this.location.path.length - this.target.path.length; | ||
| } | ||
| toString = () => `${this.join(this.location)}${this.delimiter}${this.join(this.target)}`; | ||
| toJSON = () => this.toString(); | ||
| join = ({ path }) => path.join(this.keyDelimiter); | ||
| } | ||
| /** | ||
| * (Safe copy) Prevents modification of existing property attributes and values, | ||
| * and prevents the addition of new properties. | ||
| * Checks if a string is a valid marker format. | ||
| * | ||
| * @param text - The string to check | ||
| * @returns True if the string matches the marker pattern | ||
| * | ||
| * @example Validating marker format | ||
| * ```typescript | ||
| * isMarker('__$0') // true | ||
| * isMarker('__$123') // true | ||
| * isMarker('regular') // false | ||
| * ``` | ||
| */ | ||
| const freeze = _Object.freeze; | ||
| /** | ||
| * (Safe copy) Returns the names of the enumerable string properties and methods of an object. | ||
| */ | ||
| const keys = _Object.keys; | ||
| const isMarker = (text) => { | ||
@@ -35,3 +69,3 @@ if (typeof text !== 'string' || !text.startsWith('__$')) | ||
| getKeys: (target) => { | ||
| const keysArray = keys(target); | ||
| const keysArray = index_cjs_js$2.keys(target); | ||
| if (getConfig().detectCircularReferences) { | ||
@@ -50,3 +84,3 @@ return keysArray.filter((key) => !isMarker(key)); | ||
| getKeys: (target) => { | ||
| const keysArray = keys(target); | ||
| const keysArray = index_cjs_js$2.keys(target); | ||
| if (getConfig().detectCircularReferences) { | ||
@@ -68,2 +102,7 @@ return keysArray.filter((key) => !isMarker(key)); | ||
| * @param config - Partial configuration object to merge with current settings | ||
| * | ||
| * @example Configuring settings | ||
| * ```typescript | ||
| * setConfig({ detectCircularReferences: true }) | ||
| * ``` | ||
| */ | ||
@@ -80,2 +119,7 @@ const setConfig = (config) => { | ||
| * @returns The current global configuration object | ||
| * | ||
| * @example Retrieving configuration | ||
| * ```typescript | ||
| * const { detectCircularReferences } = getConfig() | ||
| * ``` | ||
| */ | ||
@@ -88,110 +132,25 @@ const getConfig = () => ({ | ||
| /** | ||
| * Registers one or more classes which will be used to identify values as distinct data types. | ||
| * Gets the keys from an iterable target based on its data type. | ||
| * | ||
| * @param classRefs - One or more class references to register. | ||
| * @returns The result of the forEach operation (void) | ||
| */ | ||
| const registerClassTypes = (...classRefs) => classRefs.forEach((classRef) => !registeredClasses.includes(classRef) && registeredClasses.push(classRef)); | ||
| /** | ||
| * Registers a custom class as iterable, allowing the data utilities API to treat instances | ||
| * as map-like objects with their own unique data type. | ||
| * @param target - The target to get the keys from. | ||
| * @param dataType - The data type of the target. | ||
| * @returns The keys from the iterable target. | ||
| * | ||
| * @param classRef - The class constructor to register | ||
| * @param getKeys - Function that returns all keys from an instance | ||
| * @param read - Function to read a value from an instance by key | ||
| * @param write - Function to write a value to an instance (with optional key) | ||
| * @param remove - Function to remove a key from an instance | ||
| * @param instantiate - Factory function to create new instances (defaults to calling constructor) | ||
| * @remarks | ||
| * If the class is already registered, its entry will be updated with the new handlers. | ||
| * @example Extracting keys from object | ||
| * ```typescript | ||
| * getKeysFromIterable({ a: 1, b: 2 }, 'object') // ['a', 'b'] | ||
| * ``` | ||
| */ | ||
| const registerIterableClass = (classRef, getKeys, read, write, remove, instantiate = () => new classRef()) => { | ||
| const existingEntryLocation = registeredIterableClasses.findIndex((entry) => entry.classRef === classRef); | ||
| const GetKeys = (target) => getConfig().detectCircularReferences ? [...getKeys(target)].filter((key) => !isMarker(key)) : getKeys(target); | ||
| const entry = { | ||
| classRef, | ||
| getKeys: GetKeys, | ||
| read, | ||
| write, | ||
| remove, | ||
| instantiate, | ||
| }; | ||
| if (existingEntryLocation >= 0) { | ||
| registeredIterableClasses[existingEntryLocation] = entry; | ||
| return; | ||
| } | ||
| registeredIterableClasses.unshift(entry); | ||
| registerClassTypes(classRef); | ||
| const getKeysFromIterable = (target, dataType) => { | ||
| if (dataType === 'array') | ||
| dataType = Array.name; | ||
| if (dataType === 'object') | ||
| dataType = Object.name; | ||
| const iterableClass = registeredIterableClasses.find(({ classRef }) => dataType === classRef.name); | ||
| if (iterableClass === undefined) | ||
| return []; | ||
| return iterableClass.getKeys(target); | ||
| }; | ||
| /** | ||
| * Removes one or more registered classes used to identify values as distinct data types. | ||
| * | ||
| * @param classRefs - One or more class references to deregister. If none provided, all registered classes will be deregistered. | ||
| */ | ||
| const deregisterClassTypes = (...classRefs) => { | ||
| if (classRefs.length === 0) { | ||
| while (registeredClasses.length !== 0) | ||
| registeredClasses.shift(); | ||
| return; | ||
| } | ||
| const indexes = classRefs | ||
| .map((classRef) => registeredClasses.indexOf(classRef)) | ||
| .filter((index) => index >= 0) | ||
| .sort(); | ||
| while (indexes.length !== 0) { | ||
| registeredClasses.splice(indexes[indexes.length - 1], 1); | ||
| indexes.pop(); | ||
| } | ||
| }; | ||
| /** | ||
| * Removes one or more registered iterable classes. | ||
| * Removes all registered iterable classes except built-ins (Array and Object) when no references are provided. | ||
| * | ||
| * @param classRefs - The class constructors to deregister | ||
| */ | ||
| const deregisterIterableClass = (...classRefs) => { | ||
| if (classRefs.length === 0) { | ||
| for (let i = registeredIterableClasses.length - 1; i >= 0; i--) { | ||
| const classRef = registeredIterableClasses[i].classRef; | ||
| if (![Array, Object].includes(classRef)) { | ||
| registeredIterableClasses.splice(i, 1); | ||
| } | ||
| } | ||
| } | ||
| else { | ||
| const indexes = classRefs | ||
| .map((classRef) => registeredIterableClasses.findIndex((entry) => entry.classRef === classRef)) | ||
| .filter((index) => index >= 0) | ||
| .sort(); | ||
| while (indexes.length > 0) { | ||
| registeredIterableClasses.splice(indexes[indexes.length - 1], 1); | ||
| indexes.pop(); | ||
| } | ||
| } | ||
| deregisterClassTypes(...classRefs); | ||
| }; | ||
| /** | ||
| * Safe copies of Array built-in static methods. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/array | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Array = globalThis.Array; | ||
| /** | ||
| * (Safe copy) Determines whether the passed value is an Array. | ||
| */ | ||
| const isArray = _Array.isArray; | ||
| /** | ||
| * (Safe copy) Creates an array from an array-like or iterable object. | ||
| */ | ||
| const from = _Array.from; | ||
| /** | ||
| * Returns the data type of the target. | ||
@@ -203,2 +162,9 @@ * Uses native `typeof` operator, however, makes distinction between `null`, `array`, and `object`. | ||
| * @returns The data type of the target. | ||
| * | ||
| * @example Determining data types | ||
| * ```typescript | ||
| * getType([1, 2]) // 'array' | ||
| * getType({ a: 1 }) // 'object' | ||
| * getType(null) // 'null' | ||
| * ``` | ||
| */ | ||
@@ -210,3 +176,3 @@ const getType = (target) => { | ||
| if (nativeDataType === 'object') { | ||
| if (isArray(target)) | ||
| if (index_cjs_js.isArray(target)) | ||
| return 'array'; | ||
@@ -222,33 +188,2 @@ for (const registeredClass of registeredClasses) { | ||
| /** | ||
| * Checks if two targets are of the same data type. | ||
| * | ||
| * @param targetA The first target to compare | ||
| * @param targetB The second target to compare | ||
| * @returns The common data type if both targets are of the same type; otherwise, false. | ||
| */ | ||
| const sameType = (targetA, targetB) => { | ||
| const firstType = getType(targetA); | ||
| const secondType = getType(targetB); | ||
| return firstType === secondType ? firstType : false; | ||
| }; | ||
| /** | ||
| * Gets the keys from an iterable target based on its data type. | ||
| * | ||
| * @param target - The target to get the keys from. | ||
| * @param dataType - The data type of the target. | ||
| * @returns The keys from the iterable target. | ||
| */ | ||
| const getKeysFromIterable = (target, dataType) => { | ||
| if (dataType === 'array') | ||
| dataType = Array.name; | ||
| if (dataType === 'object') | ||
| dataType = Object.name; | ||
| const iterableClass = registeredIterableClasses.find(({ classRef }) => dataType === classRef.name); | ||
| if (iterableClass === undefined) | ||
| return []; | ||
| return iterableClass.getKeys(target); | ||
| }; | ||
| /** | ||
| * Returns a list of iterable data types. By default 'array' and 'object' are included., | ||
@@ -258,2 +193,7 @@ * but can be extended by using `registerIterableClass`. | ||
| * @returns Array of iterable data types. | ||
| * | ||
| * @example Listing registered iterable types | ||
| * ```typescript | ||
| * getIterableTypes() // ['array', 'object', ...registered types] | ||
| * ``` | ||
| */ | ||
@@ -274,2 +214,9 @@ const getIterableTypes = () => registeredIterableClasses.map(({ classRef }) => { | ||
| * @returns `true` if the data type is iterable, otherwise `false` | ||
| * | ||
| * @example Checking iterable types | ||
| * ```typescript | ||
| * isIterableType('array') // true | ||
| * isIterableType('object') // true | ||
| * isIterableType('string') // false | ||
| * ``` | ||
| */ | ||
@@ -279,170 +226,116 @@ const isIterableType = (dataType) => getIterableTypes().includes(dataType); | ||
| /** | ||
| * Checks whether two targets have the same structure. | ||
| * Checks if the target contains all specified keys. | ||
| * | ||
| * @param target - The target to check. | ||
| * @param keys - The keys to check for. | ||
| * @returns True if the target contains all specified keys, false otherwise. | ||
| * @remarks | ||
| * For iterable types (arrays, sets, maps, and objects), it checks whether they have the same keys. | ||
| * For other types, it simply checks whether they are of the same type. | ||
| * It supports configuration via `getConfig().samePositionOfOwnProperties` to determine whether the order of keys matters for objects. | ||
| * If supports other registered iterable classes as well. See `registerIterableClass`. | ||
| * @param targetA data to compare | ||
| * @param targetB data to compare | ||
| * @returns The data type if both targets have the same structure, otherwise `false`. | ||
| * Works with objects, arrays, and registered iterable classes. | ||
| * An empty keys array will always return `false`. | ||
| * | ||
| * @example Checking if object contains specific keys | ||
| * ```typescript | ||
| * containsKeys({ a: 1, b: 2 }, ['a', 'b']) // true | ||
| * containsKeys({ a: 1 }, ['a', 'b']) // false | ||
| * ``` | ||
| */ | ||
| const sameStructure = (targetA, targetB) => { | ||
| const typeMatch = sameType(targetA, targetB); | ||
| if (typeMatch === false) | ||
| const containsKeys = (target, keys) => { | ||
| if (keys.length === 0) | ||
| return false; | ||
| if (isIterableType(typeMatch)) { | ||
| const aKeys = getKeysFromIterable(targetA, typeMatch); | ||
| const bKeys = getKeysFromIterable(targetB, typeMatch); | ||
| const aKeyCount = aKeys.length; | ||
| const bKeyCount = bKeys.length; | ||
| if (aKeyCount !== bKeyCount) | ||
| return false; | ||
| if (aKeyCount === 0) | ||
| return typeMatch; | ||
| if (getConfig().samePositionOfOwnProperties) { | ||
| for (let i = 0; i < aKeyCount; i += 1) { | ||
| if (aKeys[i] !== bKeys[i]) | ||
| return false; | ||
| } | ||
| } | ||
| else { | ||
| for (let i = 0; i < aKeyCount; i += 1) { | ||
| if (!bKeys.includes(aKeys[i])) | ||
| return false; | ||
| } | ||
| } | ||
| } | ||
| return typeMatch; | ||
| const dataType = getType(target); | ||
| if (isIterableType(dataType) === false) | ||
| return false; | ||
| const targetKeys = getKeysFromIterable(target, dataType); | ||
| return !keys.some((k) => !targetKeys.includes(k)); | ||
| }; | ||
| /** | ||
| * Checks if the target is iterable. | ||
| * Removes one or more registered classes used to identify values as distinct data types. | ||
| * | ||
| * @param target - The target to check. | ||
| * @returns `true` if the target is iterable, `false` otherwise. | ||
| * @param classRefs - One or more class references to deregister. If none provided, all registered classes will be deregistered. | ||
| * | ||
| * @example Deregistering class types | ||
| * ```typescript | ||
| * deregisterClassTypes(MyCustomClass) | ||
| * deregisterClassTypes() // clears all | ||
| * ``` | ||
| */ | ||
| const isIterable = (target) => isIterableType(getType(target)); | ||
| const deregisterClassTypes = (...classRefs) => { | ||
| if (classRefs.length === 0) { | ||
| while (registeredClasses.length !== 0) | ||
| registeredClasses.shift(); | ||
| return; | ||
| } | ||
| const indexes = classRefs | ||
| .map((classRef) => registeredClasses.indexOf(classRef)) | ||
| .filter((index) => index >= 0) | ||
| .sort(); | ||
| while (indexes.length !== 0) { | ||
| registeredClasses.splice(indexes[indexes.length - 1], 1); | ||
| indexes.pop(); | ||
| } | ||
| }; | ||
| /** | ||
| * Safe copies of Error built-ins via factory functions. | ||
| * Removes one or more registered iterable classes. | ||
| * Removes all registered iterable classes except built-ins (Array and Object) when no references are provided. | ||
| * | ||
| * Since constructors cannot be safely captured via Object.assign, this module | ||
| * provides factory functions that use Reflect.construct internally. | ||
| * @param classRefs - The class constructors to deregister | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/error | ||
| * @example Deregistering iterable classes | ||
| * ```typescript | ||
| * deregisterIterableClass(MyCollection) | ||
| * deregisterIterableClass() // clears all except Array/Object | ||
| * ``` | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Error = globalThis.Error; | ||
| const _Reflect$3 = globalThis.Reflect; | ||
| /** | ||
| * (Safe copy) Creates a new Error using the captured Error constructor. | ||
| * Use this instead of `new Error()`. | ||
| * | ||
| * @param message - Optional error message. | ||
| * @param options - Optional error options. | ||
| * @returns A new Error instance. | ||
| */ | ||
| const createError = (message, options) => _Reflect$3.construct(_Error, [message, options]); | ||
| class CircularReference { | ||
| location; | ||
| target; | ||
| keyDelimiter = '\u00B7'; // Middle dot | ||
| delimiter = ' \u2192 '; // Right arrow | ||
| constructor(location, target) { | ||
| if (!isArray(location) || location.length === 0) { | ||
| throw createError(`Expected location to be a list with at list one string value.`); | ||
| const deregisterIterableClass = (...classRefs) => { | ||
| if (classRefs.length === 0) { | ||
| for (let i = registeredIterableClasses.length - 1; i >= 0; i--) { | ||
| const classRef = registeredIterableClasses[i].classRef; | ||
| if (![Array, Object].includes(classRef)) { | ||
| registeredIterableClasses.splice(i, 1); | ||
| } | ||
| } | ||
| if (!isArray(target)) { | ||
| throw createError(`Expected target to be a list.`); | ||
| } | ||
| else { | ||
| const indexes = classRefs | ||
| .map((classRef) => registeredIterableClasses.findIndex((entry) => entry.classRef === classRef)) | ||
| .filter((index) => index >= 0) | ||
| .sort(); | ||
| while (indexes.length > 0) { | ||
| registeredIterableClasses.splice(indexes[indexes.length - 1], 1); | ||
| indexes.pop(); | ||
| } | ||
| this.location = { path: location }; | ||
| this.target = { path: target }; | ||
| } | ||
| get depth() { | ||
| return this.location.path.length - this.target.path.length; | ||
| } | ||
| toString = () => `${this.join(this.location)}${this.delimiter}${this.join(this.target)}`; | ||
| toJSON = () => this.toString(); | ||
| join = ({ path }) => path.join(this.keyDelimiter); | ||
| } | ||
| const getIterableOperators = (dataType) => { | ||
| const { getKeys, read, write, remove, instantiate } = (registeredIterableClasses.find((e) => e.classRef.name.toLowerCase() === dataType.toLowerCase())); | ||
| return { getKeys, read, write, remove, instantiate }; | ||
| deregisterClassTypes(...classRefs); | ||
| }; | ||
| /** | ||
| * Safe copies of Map built-in via factory function. | ||
| * Checks if the target is iterable. | ||
| * | ||
| * Since constructors cannot be safely captured via Object.assign, this module | ||
| * provides a factory function that uses Reflect.construct internally. | ||
| * @param target - The target to check. | ||
| * @returns `true` if the target is iterable, `false` otherwise. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/map | ||
| * @example Checking if value is iterable | ||
| * ```typescript | ||
| * isIterable([1, 2]) // true | ||
| * isIterable({ a: 1 }) // true | ||
| * isIterable('string') // false | ||
| * ``` | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Map = globalThis.Map; | ||
| const _Reflect$2 = globalThis.Reflect; | ||
| /** | ||
| * (Safe copy) Creates a new Map using the captured Map constructor. | ||
| * Use this instead of `new Map()`. | ||
| * | ||
| * @param iterable - Optional iterable of key-value pairs. | ||
| * @returns A new Map instance. | ||
| */ | ||
| const createMap = (iterable) => _Reflect$2.construct(_Map, iterable ? [iterable] : []); | ||
| const isIterable = (target) => isIterableType(getType(target)); | ||
| /** | ||
| * Safe copies of Date built-in via factory function and static methods. | ||
| * Generates a unique marker string for object tagging. | ||
| * | ||
| * Since constructors cannot be safely captured via Object.assign, this module | ||
| * provides a factory function that uses Reflect.construct internally. | ||
| * @returns A unique marker string prefixed with __$ | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/date | ||
| * @example Generating unique marker | ||
| * ```typescript | ||
| * const tag = marker() // '__$16789012345001234567890' | ||
| * ``` | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Date = globalThis.Date; | ||
| const _Reflect$1 = globalThis.Reflect; | ||
| function createDate(...args) { | ||
| return _Reflect$1.construct(_Date, args); | ||
| } | ||
| /** | ||
| * Safe copies of Math built-in methods. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/math | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Math = globalThis.Math; | ||
| /** | ||
| * (Safe copy) Returns the value of a number rounded to the nearest integer. | ||
| */ | ||
| const round = _Math.round; | ||
| // ============================================================================ | ||
| // Random | ||
| // ============================================================================ | ||
| /** | ||
| * (Safe copy) Returns a pseudo-random number between 0 and 1. | ||
| * Note: This is NOT cryptographically secure. For secure random values, | ||
| * use crypto.getRandomValues(). | ||
| */ | ||
| const random = _Math.random; | ||
| const marker = () => { | ||
| const randomValue = round(random() * 10000000000000); | ||
| const sequential = createDate().getTime(); | ||
| const randomValue = index_cjs_js$3.round(index_cjs_js$3.random() * 10000000000000); | ||
| const sequential = index_cjs_js$4.createDate().getTime(); | ||
| const unique = `${randomValue}${sequential}`; | ||
@@ -460,5 +353,12 @@ const prefix = `__$`; | ||
| * @returns A new ReferenceStack instance. | ||
| * | ||
| * @example Tracking object references | ||
| * ```typescript | ||
| * const stack = referenceStack() | ||
| * stack.add(myObject) | ||
| * stack.exists(myObject) // true | ||
| * ``` | ||
| */ | ||
| const referenceStack = () => { | ||
| const records = createMap(); | ||
| const records = index_cjs_js$5.createMap(); | ||
| const flag = marker(); | ||
@@ -493,2 +393,251 @@ const exists = (ref) => (isIterable(ref) ? flag in ref && records.has(ref[flag]) : false); | ||
| const errorMessage = (thing, type) => `Expected ${thing} to be ${type}.`; | ||
| const nextIterationDetails = (path, key, value) => ({ | ||
| nextPath: [...path, key], | ||
| nextValue: value[key], | ||
| }); | ||
| const circularDependencyTraversal = (condition, callback, config, key, path, value, parent, state, stack, root = false) => { | ||
| if (stack.exists(value)) | ||
| return state; | ||
| const ok = condition(config, key, value, path, parent); | ||
| /* istanbul ignore next */ | ||
| if (config.exitEarly) | ||
| return state; | ||
| if (ok) | ||
| callback(key, value, path, state, parent); | ||
| stack.add(value); | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return state; | ||
| const keys = getKeysFromIterable(value, type); | ||
| keys.forEach((key) => { | ||
| const { nextPath, nextValue } = nextIterationDetails(path, key, value); | ||
| circularDependencyTraversal(condition, callback, config, key, nextPath, nextValue, value, state, stack); | ||
| }); | ||
| if (root) | ||
| stack.clear(); | ||
| return state; | ||
| }; | ||
| const nonCircularDependencyTraversal = (condition, callback, config, key, path, value, parent, state) => { | ||
| const ok = condition(config, key, value, path, parent); | ||
| /* istanbul ignore next */ | ||
| if (config.exitEarly) | ||
| return state; | ||
| if (ok) | ||
| callback(key, value, path, state, parent); | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return state; | ||
| const keys = getKeysFromIterable(value, type); | ||
| keys.forEach((key) => { | ||
| const { nextPath, nextValue } = nextIterationDetails(path, key, value); | ||
| nonCircularDependencyTraversal(condition, callback, config, key, nextPath, nextValue, value, state); | ||
| }); | ||
| return state; | ||
| }; | ||
| const traversal = (target, condition, callback, options, state) => { | ||
| if (typeof callback !== 'function') | ||
| throw index_cjs_js$1.createError(errorMessage('callback', 'a function')); | ||
| if (!(typeof options === 'object' && !index_cjs_js.isArray(options))) | ||
| throw index_cjs_js$1.createError(errorMessage('options', 'an object')); | ||
| if (!index_cjs_js.isArray(options.depth)) | ||
| throw index_cjs_js$1.createError(errorMessage('options.depth', 'an array')); | ||
| const [startDepth, maxDepth] = options.depth; | ||
| if (startDepth !== void 0 && typeof startDepth !== 'number') | ||
| throw index_cjs_js$1.createError(errorMessage('options.depth.0', 'a number')); | ||
| if (maxDepth !== void 0) { | ||
| const maxDepthType = typeof maxDepth; | ||
| if (!['number', 'string'].includes(maxDepthType)) | ||
| throw index_cjs_js$1.createError(errorMessage('options.depth.1', 'a number or a string')); | ||
| if (maxDepthType === 'string' && maxDepth !== '*') | ||
| throw index_cjs_js$1.createError("Only valid string value in options.depth.1 is '*'."); | ||
| } | ||
| const config = { | ||
| depth: index_cjs_js$2.freeze([options.depth[0] ?? 0, options.depth[1] ?? '*']), | ||
| exitEarly: false, | ||
| }; | ||
| const initialArgs = [condition, callback, config, '', [], target, void 0, state]; | ||
| if (getConfig().detectCircularReferences) | ||
| return circularDependencyTraversal(...initialArgs, referenceStack(), true); | ||
| return nonCircularDependencyTraversal(...initialArgs); | ||
| }; | ||
| /** | ||
| * A higher-order function that takes a single predicate function to generate an algorithm that traverses data points | ||
| * on a data structure. See traverse. | ||
| * | ||
| * @param condition - Predicate function to determine whether to traverse a data point | ||
| * @returns A traversal function configured with the condition | ||
| * | ||
| * @example Creating custom traversal | ||
| * ```typescript | ||
| * const customTraverse = createTraversal((config, key, value) => value !== null) | ||
| * customTraverse(data, callback, options) | ||
| * ``` | ||
| */ | ||
| const createTraversal = (condition) => (target, callback, options, state) => traversal(target, condition, callback, options ?? { depth: [0, '*'] }, state ?? {}); | ||
| const condition = (config, key, value, path) => !(path.length < config.depth[0] || config.depth[1] < path.length); | ||
| const traverseBetweenDepthRange = createTraversal(condition); | ||
| /** | ||
| * Invokes a callback function for every data point in the data structure of the target value to let you do read and write operations. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * | ||
| * @param target - The value to traverse | ||
| * @param callback - Function to invoke for each data point | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @param state - Optional state object to maintain across traversal callbacks | ||
| * @returns The state object after traversal completes | ||
| * | ||
| * @example Traversing data structure | ||
| * ```typescript | ||
| * traverse({ a: { b: 1 } }, (key, value, path) => { | ||
| * console.log(path.join('.'), '=', value) | ||
| * }) | ||
| * ``` | ||
| */ | ||
| const traverse = (target, callback, options, state) => traverseBetweenDepthRange(target, callback, options, state); | ||
| /** | ||
| * Returns the total depth of a value's data structure, | ||
| * and returns a list of locations that are the most deeply nested. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to analyze for depth | ||
| * @returns A tuple containing the maximum depth and an array of paths to the deepest locations | ||
| * | ||
| * @example Getting depth of nested object | ||
| * ```typescript | ||
| * getDepth({ a: { b: { c: 1 } } }) // [3, [['a', 'b', 'c']]] | ||
| * ``` | ||
| */ | ||
| const getDepth = (target) => { | ||
| const trackDepth = (key, value, path, state) => { | ||
| if (state.depth < path.length) { | ||
| state.depth = path.length; | ||
| state.locations = [path]; | ||
| return; | ||
| } | ||
| if (state.depth === path.length) { | ||
| state.locations.push(path); | ||
| } | ||
| }; | ||
| const options = { depth: [0, '*'] }; | ||
| const state = { depth: 0, locations: [] }; | ||
| const { depth, locations } = traverse(target, trackDepth, options, state); | ||
| return [depth, locations]; | ||
| }; | ||
| /** | ||
| * Retrieves iterable operators for a given data type. | ||
| * | ||
| * @param dataType - The type of data to get operators for | ||
| * @returns Object containing getKeys, read, write, remove, and instantiate operators | ||
| * | ||
| * @example Retrieving operators for array type | ||
| * ```typescript | ||
| * const ops = getIterableOperators('array') | ||
| * const keys = ops.getKeys([1, 2, 3]) // ['0', '1', '2'] | ||
| * ``` | ||
| */ | ||
| const getIterableOperators = (dataType) => { | ||
| const { getKeys, read, write, remove, instantiate } = (registeredIterableClasses.find((e) => e.classRef.name.toLowerCase() === dataType.toLowerCase())); | ||
| return { getKeys, read, write, remove, instantiate }; | ||
| }; | ||
| /** | ||
| * Returns a list of unique key names that match a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against key names (defaults to matching all keys) | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of unique key names that match the pattern | ||
| * | ||
| * @example Finding unique keys by pattern | ||
| * ```typescript | ||
| * getUniqueKeys({ a: { b: 1 }, c: { b: 2 } }, 'b') // ['b'] | ||
| * getUniqueKeys(data, /^user/) // keys starting with 'user' | ||
| * ``` | ||
| */ | ||
| const getUniqueKeys = (target, pattern = /.+/, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw index_cjs_js$1.createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => match(nextKey) && state.names.add(nextKey)); | ||
| }; | ||
| return index_cjs_js.from(traverse(target, callback, { depth: [0, '*'], ...options }, { | ||
| names: index_cjs_js$6.createSet(), | ||
| }).names.values()); | ||
| }; | ||
| /** | ||
| * Gets the value at the specified path from the target. | ||
| * | ||
| * @param target - The target to get the value from. | ||
| * @param path - The path to the value. | ||
| * @param defaultValue - The default value to return if the path does not exist or an error occurs. | ||
| * @returns The value at the specified path or the default value. | ||
| * @throws {Error} Will throw an error if the path is not a non-empty array of strings and no default value for errors is provided. | ||
| * @remarks | ||
| * - If `defaultValue.onMissingKey` is provided, it will be returned when a key in the path is missing. | ||
| * - If `defaultValue.onError` is provided, it will be returned when any error occurs during the retrieval process. | ||
| * | ||
| * @example Retrieving nested values | ||
| * ```typescript | ||
| * getValue({ a: { b: 1 } }, ['a', 'b']) // 1 | ||
| * getValue({ a: 1 }, ['x'], { onMissingKey: 0 }) // 0 | ||
| * ``` | ||
| */ | ||
| const getValue = (target, path, defaultValue) => { | ||
| if (index_cjs_js.isArray(path) === false) { | ||
| throw index_cjs_js$1.createError('Expected path to be a non-empty array of strings.'); | ||
| } | ||
| if (path.length === 0) | ||
| return target; | ||
| const hasOnMissingKeyDefault = !!(defaultValue && 'onMissingKey' in defaultValue); | ||
| const hasOnErrorDefault = !!(defaultValue && 'onError' in defaultValue); | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| let scope; | ||
| let scopeType; | ||
| let scopeIterable; | ||
| let scopeOperators; | ||
| try { | ||
| scope = target; | ||
| for (let index = 0; index < path.length; index += 1) { | ||
| const key = path[index]; | ||
| if (typeof key !== 'string') { | ||
| throw index_cjs_js$1.createError(`Expected path[${index}] to be a string, got ${typeof key}.`); | ||
| } | ||
| scopeType = getType(scope); | ||
| scopeIterable = isIterableType(scopeType); | ||
| /* instanbul ignore next */ | ||
| if (!scopeIterable && hasOnMissingKeyDefault) { | ||
| scope = defaultValue.onMissingKey; | ||
| break; | ||
| } | ||
| scopeOperators = getIterableOperators(scopeType); | ||
| if (scopeIterable && !scopeOperators.getKeys(scope).includes(key) && hasOnMissingKeyDefault) { | ||
| scope = defaultValue.onMissingKey; | ||
| break; | ||
| } | ||
| scope = scopeOperators.read(scope, key); | ||
| } | ||
| } | ||
| catch (error) { | ||
| if (hasOnErrorDefault) { | ||
| scope = defaultValue.onError; | ||
| } | ||
| else { | ||
| throw error; | ||
| } | ||
| } | ||
| return scope; | ||
| }; | ||
| const hasCircularReferenceRecursive = (target, stack, root = false) => { | ||
@@ -514,2 +663,10 @@ if (stack.exists(target)) | ||
| * @returns True if the value contains circular references, false otherwise | ||
| * | ||
| * @example Detecting circular references | ||
| * ```typescript | ||
| * const obj = { a: {} } | ||
| * obj.a.self = obj | ||
| * hasCircularReference(obj) // true | ||
| * hasCircularReference({ a: 1 }) // false | ||
| * ``` | ||
| */ | ||
@@ -528,46 +685,66 @@ const hasCircularReference = (target) => { | ||
| const invalidmaxResults = 'Invalid maxResults argument.'; | ||
| const locateCircularReferenceRecursive = (target, maxResults, path, stack, result, root = false) => { | ||
| if (result.length === maxResults) | ||
| return result; | ||
| if (stack.exists(target)) { | ||
| result.push(new CircularReference(path, path.slice(0, stack.lastSeen(target)))); | ||
| return result; | ||
| } | ||
| const type = getType(target); | ||
| if (!isIterableType(type)) | ||
| return result; | ||
| stack.add(target); | ||
| const { getKeys, read } = getIterableOperators(type); | ||
| const keys = getKeys(target); | ||
| keys.forEach((key) => locateCircularReferenceRecursive(read(target, key), maxResults, [...path, key], stack, result)); | ||
| if (root) | ||
| stack.clear(); | ||
| return result; | ||
| /** | ||
| * Checks if two targets are of the same data type. | ||
| * | ||
| * @param targetA The first target to compare | ||
| * @param targetB The second target to compare | ||
| * @returns The common data type if both targets are of the same type; otherwise, false. | ||
| * | ||
| * @example Comparing data types | ||
| * ```typescript | ||
| * sameType([1], [2]) // 'array' | ||
| * sameType({}, []) // false | ||
| * ``` | ||
| */ | ||
| const sameType = (targetA, targetB) => { | ||
| const firstType = getType(targetA); | ||
| const secondType = getType(targetB); | ||
| return firstType === secondType ? firstType : false; | ||
| }; | ||
| /** | ||
| * Returns a list of locations where circular references occur. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * Checks whether two targets have the same structure. | ||
| * | ||
| * @param target - The value to search for circular references | ||
| * @param maxResults - Maximum number of circular references to find (number or '*' for all) | ||
| * @returns An array of CircularReference objects indicating locations of circular references | ||
| * @remarks | ||
| * For iterable types (arrays, sets, maps, and objects), it checks whether they have the same keys. | ||
| * For other types, it simply checks whether they are of the same type. | ||
| * It supports configuration via `getConfig().samePositionOfOwnProperties` to determine whether the order of keys matters for objects. | ||
| * If supports other registered iterable classes as well. See `registerIterableClass`. | ||
| * @param targetA data to compare | ||
| * @param targetB data to compare | ||
| * @returns The data type if both targets have the same structure, otherwise `false`. | ||
| * | ||
| * @example Comparing structures | ||
| * ```typescript | ||
| * sameStructure({ a: 1, b: 2 }, { a: 'x', b: 'y' }) // 'object' | ||
| * sameStructure({ a: 1 }, { b: 1 }) // false | ||
| * ``` | ||
| */ | ||
| const locateCircularReference = (target, maxResults = 1) => { | ||
| const resultsType = typeof maxResults; | ||
| if (!['string', 'number'].includes(resultsType)) | ||
| throw createError(invalidmaxResults); | ||
| if (resultsType === 'string' && maxResults !== '*') | ||
| throw createError(invalidmaxResults); | ||
| if (resultsType === 'number' && (maxResults < 1 || [NaN, Infinity].includes(maxResults))) | ||
| throw createError(invalidmaxResults); | ||
| const originalSupportStatus = getConfig().detectCircularReferences; | ||
| if (!originalSupportStatus) { | ||
| setConfig({ detectCircularReferences: true }); | ||
| const sameStructure = (targetA, targetB) => { | ||
| const typeMatch = sameType(targetA, targetB); | ||
| if (typeMatch === false) | ||
| return false; | ||
| if (isIterableType(typeMatch)) { | ||
| const aKeys = getKeysFromIterable(targetA, typeMatch); | ||
| const bKeys = getKeysFromIterable(targetB, typeMatch); | ||
| const aKeyCount = aKeys.length; | ||
| const bKeyCount = bKeys.length; | ||
| if (aKeyCount !== bKeyCount) | ||
| return false; | ||
| if (aKeyCount === 0) | ||
| return typeMatch; | ||
| if (getConfig().samePositionOfOwnProperties) { | ||
| for (let i = 0; i < aKeyCount; i += 1) { | ||
| if (aKeys[i] !== bKeys[i]) | ||
| return false; | ||
| } | ||
| } | ||
| else { | ||
| for (let i = 0; i < aKeyCount; i += 1) { | ||
| if (!bKeys.includes(aKeys[i])) | ||
| return false; | ||
| } | ||
| } | ||
| } | ||
| const result = locateCircularReferenceRecursive(target, maxResults, [], referenceStack(), [], true); | ||
| if (!originalSupportStatus) { | ||
| setConfig({ detectCircularReferences: false }); | ||
| } | ||
| return result; | ||
| return typeMatch; | ||
| }; | ||
@@ -673,2 +850,9 @@ | ||
| * @returns True if the values are identical, false otherwise | ||
| * | ||
| * @example Comparing values for identity | ||
| * ```typescript | ||
| * isIdentical({ a: 1 }, { a: 1 }) // true | ||
| * isIdentical([1, 2], [1, 2]) // true | ||
| * isIdentical({ a: 1 }, { a: 2 }) // false | ||
| * ``` | ||
| */ | ||
@@ -683,23 +867,321 @@ const isIdentical = (targetA, targetB) => { | ||
| const invalidmaxResults = 'Invalid maxResults argument.'; | ||
| /** | ||
| * Checks if the target contains all specified keys. | ||
| * Recursively searches for circular references in an object graph. | ||
| * | ||
| * @param target - The target to check. | ||
| * @param keys - The keys to check for. | ||
| * @returns True if the target contains all specified keys, false otherwise. | ||
| * @param target - The value to search | ||
| * @param maxResults - Maximum number of results to find | ||
| * @param path - Current path in the object graph | ||
| * @param stack - Reference stack for tracking visited objects | ||
| * @param result - Array to collect found circular references | ||
| * @param root - Whether this is the root call | ||
| * @returns Array of CircularReference objects found | ||
| * | ||
| * @example Recursively locating circular references | ||
| * ```typescript | ||
| * const stack = referenceStack() | ||
| * locateCircularReferenceRecursive(obj, 1, [], stack, [], true) | ||
| * ``` | ||
| */ | ||
| const locateCircularReferenceRecursive = (target, maxResults, path, stack, result, root = false) => { | ||
| if (result.length === maxResults) | ||
| return result; | ||
| if (stack.exists(target)) { | ||
| result.push(new CircularReference(path, path.slice(0, stack.lastSeen(target)))); | ||
| return result; | ||
| } | ||
| const type = getType(target); | ||
| if (!isIterableType(type)) | ||
| return result; | ||
| stack.add(target); | ||
| const { getKeys, read } = getIterableOperators(type); | ||
| const keys = getKeys(target); | ||
| keys.forEach((key) => locateCircularReferenceRecursive(read(target, key), maxResults, [...path, key], stack, result)); | ||
| if (root) | ||
| stack.clear(); | ||
| return result; | ||
| }; | ||
| /** | ||
| * Returns a list of locations where circular references occur. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The value to search for circular references | ||
| * @param maxResults - Maximum number of circular references to find (number or '*' for all) | ||
| * @returns An array of CircularReference objects indicating locations of circular references | ||
| * | ||
| * @example Locating circular references | ||
| * ```typescript | ||
| * const obj = { a: {} } | ||
| * obj.a.self = obj | ||
| * locateCircularReference(obj) // [CircularReference { location: ['a', 'self'], target: [] }] | ||
| * ``` | ||
| */ | ||
| const locateCircularReference = (target, maxResults = 1) => { | ||
| const resultsType = typeof maxResults; | ||
| if (!['string', 'number'].includes(resultsType)) | ||
| throw index_cjs_js$1.createError(invalidmaxResults); | ||
| if (resultsType === 'string' && maxResults !== '*') | ||
| throw index_cjs_js$1.createError(invalidmaxResults); | ||
| if (resultsType === 'number' && (maxResults < 1 || [NaN, Infinity].includes(maxResults))) | ||
| throw index_cjs_js$1.createError(invalidmaxResults); | ||
| const originalSupportStatus = getConfig().detectCircularReferences; | ||
| if (!originalSupportStatus) { | ||
| setConfig({ detectCircularReferences: true }); | ||
| } | ||
| const result = locateCircularReferenceRecursive(target, maxResults, [], referenceStack(), [], true); | ||
| if (!originalSupportStatus) { | ||
| setConfig({ detectCircularReferences: false }); | ||
| } | ||
| return result; | ||
| }; | ||
| /** | ||
| * Returns a list of locations where the key name matches a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against key names | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where the key pattern was found | ||
| * | ||
| * @example Locating keys in nested structure | ||
| * ```typescript | ||
| * locateKey({ a: { b: 1 }, c: { b: 2 } }, 'b') // [['a', 'b'], ['c', 'b']] | ||
| * ``` | ||
| */ | ||
| const locateKey = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw index_cjs_js$1.createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => match(nextKey) && state.locations.push([...path, nextKey])); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Returns a list of locations where a text value matches a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against text values | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where the text pattern was found | ||
| * | ||
| * @example Locating text values in structure | ||
| * ```typescript | ||
| * locateText({ a: 'hello', b: { c: 'hello' } }, 'hello') // [['a'], ['b', 'c']] | ||
| * ``` | ||
| */ | ||
| const locateText = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw index_cjs_js$1.createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (text) => text === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => getType(value) === 'string' && match(value) && state.locations.push(path); | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Registers one or more classes which will be used to identify values as distinct data types. | ||
| * | ||
| * @param classRefs - One or more class references to register. | ||
| * @returns The result of the forEach operation (void) | ||
| * | ||
| * @example Registering custom class types | ||
| * ```typescript | ||
| * registerClassTypes(MyCustomClass, AnotherClass) | ||
| * getType(new MyCustomClass()) // 'MyCustomClass' | ||
| * ``` | ||
| */ | ||
| const registerClassTypes = (...classRefs) => classRefs.forEach((classRef) => !registeredClasses.includes(classRef) && registeredClasses.push(classRef)); | ||
| /** | ||
| * Registers a custom class as iterable, allowing the data utilities API to treat instances | ||
| * as map-like objects with their own unique data type. | ||
| * | ||
| * @param classRef - The class constructor to register | ||
| * @param getKeys - Function that returns all keys from an instance | ||
| * @param read - Function to read a value from an instance by key | ||
| * @param write - Function to write a value to an instance (with optional key) | ||
| * @param remove - Function to remove a key from an instance | ||
| * @param instantiate - Factory function to create new instances (defaults to calling constructor) | ||
| * @remarks | ||
| * Works with objects, arrays, and registered iterable classes. | ||
| * An empty keys array will always return `false`. | ||
| * If the class is already registered, its entry will be updated with the new handlers. | ||
| * | ||
| * @example Registering custom iterable class | ||
| * ```typescript | ||
| * registerIterableClass( | ||
| * MyMap, | ||
| * (m) => [...m.keys()], | ||
| * (m, k) => m.get(k), | ||
| * (m, v, k) => m.set(k, v), | ||
| * (m, k) => m.delete(k) | ||
| * ) | ||
| * ``` | ||
| */ | ||
| const containsKeys = (target, keys) => { | ||
| if (keys.length === 0) | ||
| return false; | ||
| const dataType = getType(target); | ||
| if (isIterableType(dataType) === false) | ||
| return false; | ||
| const targetKeys = getKeysFromIterable(target, dataType); | ||
| return !keys.some((k) => !targetKeys.includes(k)); | ||
| const registerIterableClass = (classRef, getKeys, read, write, remove, instantiate = () => new classRef()) => { | ||
| const existingEntryLocation = registeredIterableClasses.findIndex((entry) => entry.classRef === classRef); | ||
| const GetKeys = (target) => getConfig().detectCircularReferences ? [...getKeys(target)].filter((key) => !isMarker(key)) : getKeys(target); | ||
| const entry = { | ||
| classRef, | ||
| getKeys: GetKeys, | ||
| read, | ||
| write, | ||
| remove, | ||
| instantiate, | ||
| }; | ||
| if (existingEntryLocation >= 0) { | ||
| registeredIterableClasses[existingEntryLocation] = entry; | ||
| return; | ||
| } | ||
| registeredIterableClasses.unshift(entry); | ||
| registerClassTypes(classRef); | ||
| }; | ||
| /** | ||
| * Removes any key names that match a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of keys that were removed. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against key names for removal | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where keys were removed | ||
| * | ||
| * @example Removing keys by pattern | ||
| * ```typescript | ||
| * const obj = { a: 1, temp: 2, b: { temp: 3 } } | ||
| * removeKey(obj, 'temp') // [['temp'], ['b', 'temp']] | ||
| * ``` | ||
| */ | ||
| const removeKey = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw index_cjs_js$1.createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, remove } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| if (!match(nextKey)) | ||
| return; | ||
| remove(value, nextKey); | ||
| state.locations.push([...path, nextKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Renames any key names that match a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of keys that were edited. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against key names | ||
| * @param name - The new name to assign to matching keys | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where keys were renamed | ||
| * | ||
| * @example Renaming keys in structure | ||
| * ```typescript | ||
| * const obj = { old: 1, nested: { old: 2 } } | ||
| * renameKey(obj, 'old', 'new') // [['new'], ['nested', 'new']] | ||
| * ``` | ||
| */ | ||
| const renameKey = (target, pattern, name, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw index_cjs_js$1.createError('Expected pattern to be either a string of a regular expression.'); | ||
| if (typeof name !== 'string') | ||
| throw index_cjs_js$1.createError('Expected name to be a string.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const rename = patternIsString ? () => name : (key) => key.replace(pattern, name); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, read, write, remove } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| if (!match(nextKey)) | ||
| return; | ||
| const newKey = rename(nextKey); | ||
| write(value, read(value, nextKey), newKey); | ||
| remove(value, nextKey); | ||
| state.locations.push([...path, newKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Edits any text by replacing any string or substring that matches a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of the original text that were edited. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against text values | ||
| * @param text - The replacement text for matching values | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where text was replaced | ||
| * | ||
| * @example Replacing text in structure | ||
| * ```typescript | ||
| * const obj = { a: 'hello world', b: { c: 'hello' } } | ||
| * replaceText(obj, 'hello', 'hi') // [['a'], ['b', 'c']] | ||
| * ``` | ||
| */ | ||
| const replaceText = (target, pattern, text, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw index_cjs_js$1.createError('Expected pattern to be either a string of a regular expression.'); | ||
| if (typeof text !== 'string') | ||
| throw index_cjs_js$1.createError('Expected name to be a string.'); | ||
| const match = patternIsString ? (text) => text.includes(pattern) : (text) => pattern.test(text); | ||
| const replace = (original) => original.replace(pattern, text); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, read, write } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| const nextValue = read(value, nextKey); | ||
| if (getType(nextValue) !== 'string' || !match(nextValue)) | ||
| return; | ||
| write(value, replace(nextValue), nextKey); | ||
| state.locations.push([...path, nextKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /* eslint-disable @typescript-eslint/no-unused-vars */ | ||
| /** | ||
| * Recursively creates a selective copy of an object based on predicate conditions. | ||
| * | ||
| * @param target - The object to copy | ||
| * @param path - Current path in the object | ||
| * @param includeKey - Predicate to determine if a key should be included | ||
| * @param skipFunctions - Whether to skip function values | ||
| * @param recordSkip - Callback to record skipped data points | ||
| * @returns Partial copy of the target based on predicate | ||
| * | ||
| * @example Basic recursive copy | ||
| * ```typescript | ||
| * selectiveCopyRecursive(obj, [], () => true, false, () => {}) | ||
| * ``` | ||
| */ | ||
| const selectiveCopyRecursive = (target, path, includeKey, skipFunctions, recordSkip) => { | ||
@@ -714,3 +1196,2 @@ const type = getType(target); | ||
| const nextKey = keys[i]; | ||
| // Filter out __proto__ to prevent prototype pollution attacks | ||
| if (nextKey === '__proto__') | ||
@@ -742,2 +1223,7 @@ continue; | ||
| * @returns A partial clone of the target object | ||
| * | ||
| * @example Copying with circular reference handling | ||
| * ```typescript | ||
| * selectiveCopyForCircularReferencesRecursive(obj, [], () => true, false, () => {}, referenceStack(), [], true) | ||
| * ``` | ||
| */ | ||
@@ -756,3 +1242,2 @@ const selectiveCopyForCircularReferencesRecursive = (target, path, includeKey, skipFunctions, recordSkip, stack, circularRefs, root = false) => { | ||
| const nextKey = keys[i]; | ||
| // Filter out __proto__ to prevent prototype pollution attacks | ||
| if (nextKey === '__proto__') | ||
@@ -793,3 +1278,2 @@ continue; | ||
| } | ||
| // Set the circular reference | ||
| const lastKey = startPath[startPath.length - 1]; | ||
@@ -809,3 +1293,3 @@ /* istanbul ignore else -- __proto__ is already filtered during iteration, this is defensive */ | ||
| * This algorithm instead copies function references by default instead. For the same reason getters and setters are not replicate, only their | ||
| * return values. This algorithm can replicate circular references, when configured to do so. | ||
| * return values. This algorithm can replicate circular references, when configured. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
@@ -816,6 +1300,12 @@ * | ||
| * @returns An object containing the cloned value and array of skipped data points | ||
| * | ||
| * @example Selective copying with options | ||
| * ```typescript | ||
| * const { clone, skipped } = selectiveCopy({ a: 1, b: 2 }, { includeKeys: ['a'] }) | ||
| * // clone = { a: 1 }, skipped = [{ path: ['b'], ... }] | ||
| * ``` | ||
| */ | ||
| const selectiveCopy = (target, options) => { | ||
| if (options !== void 0 && getType(options) !== 'object') | ||
| throw createError('Invalid options argument.'); | ||
| throw index_cjs_js$1.createError('Invalid options argument.'); | ||
| if (!options) | ||
@@ -830,3 +1320,3 @@ options = {}; | ||
| if (found && included) | ||
| throw createError(`Options ${found} and ${keys[i]} are mutually exclusive.`); | ||
| throw index_cjs_js$1.createError(`Options ${found} and ${keys[i]} are mutually exclusive.`); | ||
| if (included) | ||
@@ -863,375 +1353,2 @@ found = keys[i]; | ||
| const errorMessage = (thing, type) => `Expected ${thing} to be ${type}.`; | ||
| const nextIterationDetails = (path, key, value) => ({ | ||
| nextPath: [...path, key], | ||
| nextValue: value[key], | ||
| }); | ||
| const circularDependencyTraversal = (condition, callback, config, key, path, value, parent, state, stack, root = false) => { | ||
| if (stack.exists(value)) | ||
| return state; | ||
| const ok = condition(config, key, value, path, parent); | ||
| /* istanbul ignore next */ | ||
| if (config.exitEarly) | ||
| return state; | ||
| if (ok) | ||
| callback(key, value, path, state, parent); | ||
| stack.add(value); | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return state; | ||
| const keys = getKeysFromIterable(value, type); | ||
| keys.forEach((key) => { | ||
| const { nextPath, nextValue } = nextIterationDetails(path, key, value); | ||
| circularDependencyTraversal(condition, callback, config, key, nextPath, nextValue, value, state, stack); | ||
| }); | ||
| if (root) | ||
| stack.clear(); | ||
| return state; | ||
| }; | ||
| const nonCircularDependencyTraversal = (condition, callback, config, key, path, value, parent, state) => { | ||
| const ok = condition(config, key, value, path, parent); | ||
| /* istanbul ignore next */ | ||
| if (config.exitEarly) | ||
| return state; | ||
| if (ok) | ||
| callback(key, value, path, state, parent); | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return state; | ||
| const keys = getKeysFromIterable(value, type); | ||
| keys.forEach((key) => { | ||
| const { nextPath, nextValue } = nextIterationDetails(path, key, value); | ||
| nonCircularDependencyTraversal(condition, callback, config, key, nextPath, nextValue, value, state); | ||
| }); | ||
| return state; | ||
| }; | ||
| const traversal = (target, condition, callback, options, state) => { | ||
| if (typeof callback !== 'function') | ||
| throw createError(errorMessage('callback', 'a function')); | ||
| if (!(typeof options === 'object' && !isArray(options))) | ||
| throw createError(errorMessage('options', 'an object')); | ||
| if (!isArray(options.depth)) | ||
| throw createError(errorMessage('options.depth', 'an array')); | ||
| const [startDepth, maxDepth] = options.depth; | ||
| if (startDepth !== void 0 && typeof startDepth !== 'number') | ||
| throw createError(errorMessage('options.depth.0', 'a number')); | ||
| if (maxDepth !== void 0) { | ||
| const maxDepthType = typeof maxDepth; | ||
| if (!['number', 'string'].includes(maxDepthType)) | ||
| throw createError(errorMessage('options.depth.1', 'a number or a string')); | ||
| if (maxDepthType === 'string' && maxDepth !== '*') | ||
| throw createError("Only valid string value in options.depth.1 is '*'."); | ||
| } | ||
| const config = { | ||
| depth: freeze([options.depth[0] ?? 0, options.depth[1] ?? '*']), | ||
| exitEarly: false, | ||
| }; | ||
| const initialArgs = [condition, callback, config, '', [], target, void 0, state]; | ||
| if (getConfig().detectCircularReferences) | ||
| return circularDependencyTraversal(...initialArgs, referenceStack(), true); | ||
| return nonCircularDependencyTraversal(...initialArgs); | ||
| }; | ||
| /** | ||
| * A higher-order function that takes a single predicate function to generate an algorithm that traverses data points | ||
| * on a data structure. See traverse. | ||
| * | ||
| * @param condition - Predicate function to determine whether to traverse a data point | ||
| * @returns A traversal function configured with the condition | ||
| */ | ||
| const createTraversal = (condition) => (target, callback, options, state) => traversal(target, condition, callback, options ?? { depth: [0, '*'] }, state ?? {}); | ||
| const condition = (config, key, value, path) => !(path.length < config.depth[0] || config.depth[1] < path.length); | ||
| const traverseBetweenDepthRange = createTraversal(condition); | ||
| /** | ||
| * Invokes a callback function for every data point in the data structure of the target value to let you do read and write operations. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * | ||
| * @param target - The value to traverse | ||
| * @param callback - Function to invoke for each data point | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @param state - Optional state object to maintain across traversal callbacks | ||
| * @returns The state object after traversal completes | ||
| */ | ||
| const traverse = (target, callback, options, state) => traverseBetweenDepthRange(target, callback, options, state); | ||
| /** | ||
| * Gets the value at the specified path from the target. | ||
| * | ||
| * @param target - The target to get the value from. | ||
| * @param path - The path to the value. | ||
| * @param defaultValue - The default value to return if the path does not exist or an error occurs. | ||
| * @returns The value at the specified path or the default value. | ||
| * @throws {Error} Will throw an error if the path is not a non-empty array of strings and no default value for errors is provided. | ||
| * @remarks | ||
| * - If `defaultValue.onMissingKey` is provided, it will be returned when a key in the path is missing. | ||
| * - If `defaultValue.onError` is provided, it will be returned when any error occurs during the retrieval process. | ||
| */ | ||
| const getValue = (target, path, defaultValue) => { | ||
| if (isArray(path) === false) { | ||
| throw createError('Expected path to be a non-empty array of strings.'); | ||
| } | ||
| if (path.length === 0) | ||
| return target; | ||
| const hasOnMissingKeyDefault = !!(defaultValue && 'onMissingKey' in defaultValue); | ||
| const hasOnErrorDefault = !!(defaultValue && 'onError' in defaultValue); | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| let scope; | ||
| let scopeType; | ||
| let scopeIterable; | ||
| let scopeOperators; | ||
| try { | ||
| scope = target; | ||
| for (let index = 0; index < path.length; index += 1) { | ||
| const key = path[index]; | ||
| if (typeof key !== 'string') { | ||
| throw createError(`Expected path[${index}] to be a string, got ${typeof key}.`); | ||
| } | ||
| scopeType = getType(scope); | ||
| scopeIterable = isIterableType(scopeType); | ||
| /* instanbul ignore next */ | ||
| if (!scopeIterable && hasOnMissingKeyDefault) { | ||
| scope = defaultValue.onMissingKey; | ||
| break; | ||
| } | ||
| scopeOperators = getIterableOperators(scopeType); | ||
| if (scopeIterable && !scopeOperators.getKeys(scope).includes(key) && hasOnMissingKeyDefault) { | ||
| scope = defaultValue.onMissingKey; | ||
| break; | ||
| } | ||
| scope = scopeOperators.read(scope, key); | ||
| } | ||
| } | ||
| catch (error) { | ||
| if (hasOnErrorDefault) { | ||
| scope = defaultValue.onError; | ||
| } | ||
| else { | ||
| throw error; | ||
| } | ||
| } | ||
| return scope; | ||
| }; | ||
| /** | ||
| * Returns the total depth of a value's data structure, | ||
| * and returns a list of locations that are the most deeply nested. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to analyze for depth | ||
| * @returns A tuple containing the maximum depth and an array of paths to the deepest locations | ||
| */ | ||
| const getDepth = (target) => { | ||
| const trackDepth = (key, value, path, state) => { | ||
| if (state.depth < path.length) { | ||
| state.depth = path.length; | ||
| state.locations = [path]; | ||
| return; | ||
| } | ||
| if (state.depth === path.length) { | ||
| state.locations.push(path); | ||
| } | ||
| }; | ||
| const options = { depth: [0, '*'] }; | ||
| const state = { depth: 0, locations: [] }; | ||
| const { depth, locations } = traverse(target, trackDepth, options, state); | ||
| return [depth, locations]; | ||
| }; | ||
| /** | ||
| * Returns a list of locations where the key name matches a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against key names | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where the key pattern was found | ||
| */ | ||
| const locateKey = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => match(nextKey) && state.locations.push([...path, nextKey])); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Safe copies of Set built-in via factory function. | ||
| * | ||
| * Since constructors cannot be safely captured via Object.assign, this module | ||
| * provides a factory function that uses Reflect.construct internally. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/set | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Set = globalThis.Set; | ||
| const _Reflect = globalThis.Reflect; | ||
| /** | ||
| * (Safe copy) Creates a new Set using the captured Set constructor. | ||
| * Use this instead of `new Set()`. | ||
| * | ||
| * @param iterable - Optional iterable of values. | ||
| * @returns A new Set instance. | ||
| */ | ||
| const createSet = (iterable) => _Reflect.construct(_Set, iterable ? [iterable] : []); | ||
| /** | ||
| * Returns a list of unique key names that match a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against key names (defaults to matching all keys) | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of unique key names that match the pattern | ||
| */ | ||
| const getUniqueKeys = (target, pattern = /.+/, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => match(nextKey) && state.names.add(nextKey)); | ||
| }; | ||
| return from(traverse(target, callback, { depth: [0, '*'], ...options }, { | ||
| names: createSet(), | ||
| }).names.values()); | ||
| }; | ||
| /** | ||
| * Returns a list of locations where a text value matches a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against text values | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where the text pattern was found | ||
| */ | ||
| const locateText = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (text) => text === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => getType(value) === 'string' && match(value) && state.locations.push(path); | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Renames any key names that match a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of keys that were edited. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against key names | ||
| * @param name - The new name to assign to matching keys | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where keys were renamed | ||
| */ | ||
| const renameKey = (target, pattern, name, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| if (typeof name !== 'string') | ||
| throw createError('Expected name to be a string.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const rename = patternIsString ? () => name : (key) => key.replace(pattern, name); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, read, write, remove } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| if (!match(nextKey)) | ||
| return; | ||
| const newKey = rename(nextKey); | ||
| write(value, read(value, nextKey), newKey); | ||
| remove(value, nextKey); | ||
| state.locations.push([...path, newKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Removes any key names that match a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of keys that were removed. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against key names for removal | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where keys were removed | ||
| */ | ||
| const removeKey = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, remove } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| if (!match(nextKey)) | ||
| return; | ||
| remove(value, nextKey); | ||
| state.locations.push([...path, nextKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Edits any text by replacing any string or substring that matches a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of the original text that were edited. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against text values | ||
| * @param text - The replacement text for matching values | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where text was replaced | ||
| */ | ||
| const replaceText = (target, pattern, text, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| if (typeof text !== 'string') | ||
| throw createError('Expected name to be a string.'); | ||
| const match = patternIsString ? (text) => text.includes(pattern) : (text) => pattern.test(text); | ||
| const replace = (original) => original.replace(pattern, text); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, read, write } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| const nextValue = read(value, nextKey); | ||
| if (getType(nextValue) !== 'string' || !match(nextValue)) | ||
| return; | ||
| write(value, replace(nextValue), nextKey); | ||
| state.locations.push([...path, nextKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| exports.CircularReference = CircularReference; | ||
@@ -1275,2 +1392,1 @@ exports.containsKeys = containsKeys; | ||
| exports.traverse = traverse; | ||
| //# sourceMappingURL=index.cjs.js.map |
+815
-35
@@ -1,35 +0,815 @@ | ||
| export type * from './models'; | ||
| export type * from './get-value.model'; | ||
| export type * from './selective-copy.model'; | ||
| export * from './shared/consts'; | ||
| export * from './register-class-types'; | ||
| export * from './register-iterable-class'; | ||
| export * from './deregister-class-types'; | ||
| export * from './deregister-iterable-class'; | ||
| export * from './get-type'; | ||
| export * from './same-type'; | ||
| export * from './same-structure'; | ||
| export * from './is-iterable'; | ||
| export * from './is-iterable-type'; | ||
| export * from './is-marker'; | ||
| export * from './circular-reference'; | ||
| export * from './has-circular-reference'; | ||
| export * from './locate-circular-reference'; | ||
| export * from './reference-stack'; | ||
| export * from './is-identical'; | ||
| export * from './contains-keys'; | ||
| export * from './selective-copy'; | ||
| export * from './traverse'; | ||
| export * from './get-value'; | ||
| export * from './get-depth'; | ||
| export * from './locate-key'; | ||
| export * from './get-unique-keys'; | ||
| export * from './locate-text'; | ||
| export * from './rename-key'; | ||
| export * from './remove-key'; | ||
| export * from './replace-text'; | ||
| export * from './get-iterable-operators'; | ||
| export * from './get-iterable-types'; | ||
| export * from './get-keys-from-iterable'; | ||
| export * from './marker'; | ||
| //# sourceMappingURL=index.d.ts.map | ||
| /** | ||
| * Represents the location where a circular reference was detected. | ||
| */ | ||
| interface Location { | ||
| /** Path segments from root to the location */ | ||
| path: [string, ...string[]]; | ||
| } | ||
| /** | ||
| * Represents the target of a circular reference. | ||
| */ | ||
| interface Target { | ||
| /** Path segments from root to the target */ | ||
| path: string[]; | ||
| } | ||
| /** | ||
| * Describes a circular reference in an object graph. | ||
| */ | ||
| interface ICircularReference { | ||
| /** Location where the circular reference was detected */ | ||
| readonly location: Location; | ||
| /** Target of the circular reference */ | ||
| readonly target: Target; | ||
| /** Depth of the circular reference */ | ||
| readonly depth: number; | ||
| } | ||
| /** | ||
| * Represents a detected circular reference in an object graph. | ||
| * Tracks the location where the reference was found and its target. | ||
| * | ||
| * @example Creating a circular reference instance | ||
| * ```typescript | ||
| * const ref = new CircularReference(['root', 'child'], ['root']) | ||
| * console.log(ref.depth) // 1 | ||
| * ``` | ||
| */ | ||
| declare class CircularReference implements ICircularReference { | ||
| readonly location: Location; | ||
| readonly target: Target; | ||
| readonly keyDelimiter = "\u00B7"; | ||
| private readonly delimiter; | ||
| constructor(location: Location['path'], target: Target['path']); | ||
| get depth(): number; | ||
| readonly toString: () => string; | ||
| readonly toJSON: () => string; | ||
| private readonly join; | ||
| } | ||
| /** | ||
| * Options for providing default values when retrieving data. | ||
| */ | ||
| interface DefaultValueOptions<T = unknown> { | ||
| /** Default value to return when a key in the path is missing. */ | ||
| onMissingKey?: T; | ||
| /** Default value to return when an error occurs during retrieval. */ | ||
| onError?: T; | ||
| } | ||
| /** Function that tests if a value matches a condition */ | ||
| type Predicate = (x: unknown) => boolean; | ||
| /** JavaScript data type names including 'null' and 'array' */ | ||
| type DataType = 'undefined' | 'object' | 'boolean' | 'number' | 'bigint' | 'string' | 'symbol' | 'function' | 'null' | 'array'; | ||
| /** Any iterable of unknown values */ | ||
| type UnknownIterable = Iterable<unknown>; | ||
| /** String keys of UnknownIterable */ | ||
| type UnknownIterableKey = keyof UnknownIterable & string; | ||
| /** Constructor type for unknown class instances */ | ||
| type UnknownClass<T = unknown> = { | ||
| new (...args: any[]): T; | ||
| }; | ||
| /** Registered iterable class with operators for traversal */ | ||
| interface RegisteredIterableClassEntry<T = unknown> { | ||
| /** A reference to a class definition. */ | ||
| classRef: UnknownClass<T>; | ||
| /** Returns a new (empty) instance. */ | ||
| instantiate: () => T; | ||
| /** Returns list of iterable keys. */ | ||
| getKeys: (target: any) => string[]; | ||
| /** Returns a value corresponding to a key of class instance. */ | ||
| read: (target: any, key: unknown) => unknown; | ||
| /** Sets a new value with specific key optionally on class instance. */ | ||
| write: (instance: T, value: unknown, key?: unknown) => void; | ||
| /** Removes a key from the class instance. */ | ||
| remove: (instance: T, key: unknown) => void; | ||
| } | ||
| /** Operators for iterating over custom class instances */ | ||
| interface IterableOperators<T = unknown> { | ||
| /** Returns a new (empty) instance. */ | ||
| instantiate: () => T; | ||
| /** Returns list of iterable keys. */ | ||
| getKeys: (target: any) => string[]; | ||
| /** Returns a value corresponding to a key of class instance. */ | ||
| read: (target: any, key: unknown) => unknown; | ||
| /** Sets a new value with specific key optionally on class instance. */ | ||
| write: (instance: T, value: unknown, key?: unknown) => void; | ||
| /** Removes a key from the class instance. */ | ||
| remove: (instance: T, key: unknown) => void; | ||
| } | ||
| /** Configuration options for comparison and traversal */ | ||
| interface Config { | ||
| /** | ||
| * A flag that indicates the API that two values can match only if their properties | ||
| * are in the same order when set to `true` | ||
| */ | ||
| samePositionOfOwnProperties: boolean; | ||
| /** | ||
| * A flag that indicates the API that circular references may exist and should keep a tally of reference stack. | ||
| * Turning this flag ON comes at a performance cost, so enable only when necessary. | ||
| */ | ||
| detectCircularReferences: boolean; | ||
| } | ||
| /** Stack for tracking object references during traversal */ | ||
| interface ReferenceStack { | ||
| /** | ||
| * Total number of references in the stack. | ||
| */ | ||
| size: number; | ||
| /** | ||
| * Returns true if reference is already registered. | ||
| * | ||
| * @param reference | ||
| * @returns | ||
| */ | ||
| exists: (reference: unknown) => boolean; | ||
| /** | ||
| * Returns a negative number corresponding to how many iterations ago the reference | ||
| * was registered in the stack relative to the last entry or null when it is not in the stack. | ||
| * | ||
| * @param reference | ||
| * @returns | ||
| */ | ||
| lastSeen: (reference: unknown) => number | null; | ||
| /** | ||
| * Adds a new reference into the stack. | ||
| */ | ||
| add: (reference: unknown) => void; | ||
| /** | ||
| * Empties the reference stack and removes any flags added. | ||
| */ | ||
| clear: () => void; | ||
| } | ||
| /** Configuration specifying traversal depth range */ | ||
| interface DepthConfig { | ||
| /** Depth range: [min, max] or [min] or empty */ | ||
| depth: [number, number | '*'] | [number] | []; | ||
| } | ||
| /** Internal traversal configuration */ | ||
| interface TraverseConfig { | ||
| /** Depth range with resolved max value */ | ||
| depth: [number, number | '*']; | ||
| /** Whether to exit traversal early */ | ||
| exitEarly: boolean; | ||
| } | ||
| /** Condition function to determine if a node should be processed */ | ||
| type Condition = (config: TraverseConfig, key: string, value: unknown, path: string[], parent: unknown) => boolean; | ||
| /** Callback function invoked for each traversed node */ | ||
| type Callback = (key: string, value: unknown, path: string[], state: any, parent: unknown) => void; | ||
| /** Arguments tuple for traversal functions */ | ||
| type TraversalArgs<T = unknown, S extends Record<string, unknown> = Record<string, unknown>> = [ | ||
| Condition, | ||
| Callback, | ||
| TraverseConfig, | ||
| string, | ||
| string[], | ||
| T, | ||
| unknown, | ||
| S | ||
| ]; | ||
| /** Traversal function for non-circular structures */ | ||
| type TraversalNonCircular<S extends Record<string, unknown> = Record<string, unknown>> = (condition: Condition, callback: Callback, config: TraverseConfig, key: string, path: string[], value: unknown, parent: unknown, state: S) => S; | ||
| /** Traversal function for structures with circular references */ | ||
| type TraversalCircular = (condition: Condition, callback: Callback, config: TraverseConfig, key: string, path: string[], value: unknown, parent: unknown, state: any, stack: ReferenceStack, root?: boolean) => any; | ||
| /** Generic traversal function */ | ||
| type Traversal<T = unknown> = (target: T, condition: Condition, callback: Callback, options: DepthConfig, state: any) => any; | ||
| /** Factory function that creates a traverse function with a fixed condition */ | ||
| type TraversalCreator<T = unknown> = (condition: Condition) => Traverse<T>; | ||
| /** Function to traverse a target with callback and options */ | ||
| type Traverse<T = unknown> = (target: T, callback: Callback, options?: DepthConfig, state?: any) => any; | ||
| /** Predicate function to determine if a data point should be included/excluded */ | ||
| type SelectiveCopyPredicate = <T extends DataType = DataType>(target: unknown, path: string[], key: string, dataType: T) => boolean; | ||
| /** Operation function applied to each data point during traversal */ | ||
| type DataPointOperation = <T extends DataType = DataType>(target: unknown, path: string[], key: string, dataType: T) => void; | ||
| /** | ||
| * Settings used to determine what to copy. | ||
| */ | ||
| interface SelectiveCopyOptions { | ||
| /** Set flag true to ignore all functions. */ | ||
| skipFunctions?: boolean; | ||
| /** A list of top-level properties that should be included. */ | ||
| includeKeys?: string[]; | ||
| /** A list of top-level properties that should be excluded. */ | ||
| excludeKeys?: string[]; | ||
| /** A condition that is evaluated to determine if data point should be included. */ | ||
| include?: SelectiveCopyPredicate; | ||
| /** A condition that is evaluated to determine if data point should be excluded. */ | ||
| exclude?: SelectiveCopyPredicate; | ||
| } | ||
| /** | ||
| * Represents a single data point in an object graph. | ||
| */ | ||
| interface DataPoint { | ||
| /** The value at this data point */ | ||
| target: unknown; | ||
| /** Path segments from root to this point */ | ||
| path: string[]; | ||
| /** Property key at this point */ | ||
| key: string; | ||
| /** Type of the data at this point */ | ||
| dataType: DataType; | ||
| } | ||
| /** | ||
| * Describes a reference loop detected during traversal. | ||
| */ | ||
| interface ReferenceLoop { | ||
| /** Path where the loop starts */ | ||
| startPath: string[]; | ||
| /** Path where the loop leads to */ | ||
| destinationPath: string[]; | ||
| } | ||
| /** | ||
| * Result of {@link selectiveCopy}: the partial clone and any skipped data points. | ||
| * | ||
| * @template T - Original target type | ||
| */ | ||
| interface SelectiveCopyResult<T> { | ||
| /** Cloned value */ | ||
| clone: Partial<T>; | ||
| /** Skipped data points */ | ||
| skipped: DataPoint[]; | ||
| } | ||
| /** | ||
| * Checks if the target contains all specified keys. | ||
| * | ||
| * @param target - The target to check. | ||
| * @param keys - The keys to check for. | ||
| * @returns True if the target contains all specified keys, false otherwise. | ||
| * @remarks | ||
| * Works with objects, arrays, and registered iterable classes. | ||
| * An empty keys array will always return `false`. | ||
| * | ||
| * @example Checking if object contains specific keys | ||
| * ```typescript | ||
| * containsKeys({ a: 1, b: 2 }, ['a', 'b']) // true | ||
| * containsKeys({ a: 1 }, ['a', 'b']) // false | ||
| * ``` | ||
| */ | ||
| declare const containsKeys: (target: unknown, keys: string[]) => boolean; | ||
| /** | ||
| * Removes one or more registered classes used to identify values as distinct data types. | ||
| * | ||
| * @param classRefs - One or more class references to deregister. If none provided, all registered classes will be deregistered. | ||
| * | ||
| * @example Deregistering class types | ||
| * ```typescript | ||
| * deregisterClassTypes(MyCustomClass) | ||
| * deregisterClassTypes() // clears all | ||
| * ``` | ||
| */ | ||
| declare const deregisterClassTypes: (...classRefs: UnknownClass<unknown>[]) => void; | ||
| /** | ||
| * Removes one or more registered iterable classes. | ||
| * Removes all registered iterable classes except built-ins (Array and Object) when no references are provided. | ||
| * | ||
| * @param classRefs - The class constructors to deregister | ||
| * | ||
| * @example Deregistering iterable classes | ||
| * ```typescript | ||
| * deregisterIterableClass(MyCollection) | ||
| * deregisterIterableClass() // clears all except Array/Object | ||
| * ``` | ||
| */ | ||
| declare const deregisterIterableClass: <T = unknown>(...classRefs: UnknownClass<T>[]) => void; | ||
| /** | ||
| * Returns the total depth of a value's data structure, | ||
| * and returns a list of locations that are the most deeply nested. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to analyze for depth | ||
| * @returns A tuple containing the maximum depth and an array of paths to the deepest locations | ||
| * | ||
| * @example Getting depth of nested object | ||
| * ```typescript | ||
| * getDepth({ a: { b: { c: 1 } } }) // [3, [['a', 'b', 'c']]] | ||
| * ``` | ||
| */ | ||
| declare const getDepth: (target: unknown) => [number, string[][]]; | ||
| /** | ||
| * Retrieves iterable operators for a given data type. | ||
| * | ||
| * @param dataType - The type of data to get operators for | ||
| * @returns Object containing getKeys, read, write, remove, and instantiate operators | ||
| * | ||
| * @example Retrieving operators for array type | ||
| * ```typescript | ||
| * const ops = getIterableOperators('array') | ||
| * const keys = ops.getKeys([1, 2, 3]) // ['0', '1', '2'] | ||
| * ``` | ||
| */ | ||
| declare const getIterableOperators: <T extends string = DataType>(dataType: T) => IterableOperators; | ||
| /** | ||
| * Returns a list of iterable data types. By default 'array' and 'object' are included., | ||
| * but can be extended by using `registerIterableClass`. | ||
| * | ||
| * @returns Array of iterable data types. | ||
| * | ||
| * @example Listing registered iterable types | ||
| * ```typescript | ||
| * getIterableTypes() // ['array', 'object', ...registered types] | ||
| * ``` | ||
| */ | ||
| declare const getIterableTypes: <T extends string = DataType>() => T[]; | ||
| /** | ||
| * Gets the keys from an iterable target based on its data type. | ||
| * | ||
| * @param target - The target to get the keys from. | ||
| * @param dataType - The data type of the target. | ||
| * @returns The keys from the iterable target. | ||
| * | ||
| * @example Extracting keys from object | ||
| * ```typescript | ||
| * getKeysFromIterable({ a: 1, b: 2 }, 'object') // ['a', 'b'] | ||
| * ``` | ||
| */ | ||
| declare const getKeysFromIterable: <T extends string = DataType>(target: unknown, dataType: T) => string[]; | ||
| /** | ||
| * Returns the data type of the target. | ||
| * Uses native `typeof` operator, however, makes distinction between `null`, `array`, and `object`. | ||
| * Also, when classes are registered via `registerClass`, it checks if objects are instance of any known registered class. | ||
| * | ||
| * @param target - The target to get the data type of. | ||
| * @returns The data type of the target. | ||
| * | ||
| * @example Determining data types | ||
| * ```typescript | ||
| * getType([1, 2]) // 'array' | ||
| * getType({ a: 1 }) // 'object' | ||
| * getType(null) // 'null' | ||
| * ``` | ||
| */ | ||
| declare const getType: <T extends string = DataType>(target: unknown) => T; | ||
| /** | ||
| * Returns a list of unique key names that match a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against key names (defaults to matching all keys) | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of unique key names that match the pattern | ||
| * | ||
| * @example Finding unique keys by pattern | ||
| * ```typescript | ||
| * getUniqueKeys({ a: { b: 1 }, c: { b: 2 } }, 'b') // ['b'] | ||
| * getUniqueKeys(data, /^user/) // keys starting with 'user' | ||
| * ``` | ||
| */ | ||
| declare const getUniqueKeys: (target: unknown, pattern?: string | RegExp, options?: DepthConfig) => string[]; | ||
| /** | ||
| * Gets the value at the specified path from the target. | ||
| * | ||
| * @param target - The target to get the value from. | ||
| * @param path - The path to the value. | ||
| * @param defaultValue - The default value to return if the path does not exist or an error occurs. | ||
| * @returns The value at the specified path or the default value. | ||
| * @throws {Error} Will throw an error if the path is not a non-empty array of strings and no default value for errors is provided. | ||
| * @remarks | ||
| * - If `defaultValue.onMissingKey` is provided, it will be returned when a key in the path is missing. | ||
| * - If `defaultValue.onError` is provided, it will be returned when any error occurs during the retrieval process. | ||
| * | ||
| * @example Retrieving nested values | ||
| * ```typescript | ||
| * getValue({ a: { b: 1 } }, ['a', 'b']) // 1 | ||
| * getValue({ a: 1 }, ['x'], { onMissingKey: 0 }) // 0 | ||
| * ``` | ||
| */ | ||
| declare const getValue: <T = unknown>(target: unknown, path: [string, ...string[]], defaultValue?: DefaultValueOptions<T>) => T; | ||
| /** | ||
| * Returns true for values that have circular references. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The value to check for circular references | ||
| * @returns True if the value contains circular references, false otherwise | ||
| * | ||
| * @example Detecting circular references | ||
| * ```typescript | ||
| * const obj = { a: {} } | ||
| * obj.a.self = obj | ||
| * hasCircularReference(obj) // true | ||
| * hasCircularReference({ a: 1 }) // false | ||
| * ``` | ||
| */ | ||
| declare const hasCircularReference: (target: unknown) => boolean; | ||
| /** | ||
| * Returns true when both values are identical. | ||
| * For primitive values, use strict equality comparison. | ||
| * For non-primitive values, it checks equality by reviewing values' properties and values. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param targetA - The first value to compare | ||
| * @param targetB - The second value to compare | ||
| * @returns True if the values are identical, false otherwise | ||
| * | ||
| * @example Comparing values for identity | ||
| * ```typescript | ||
| * isIdentical({ a: 1 }, { a: 1 }) // true | ||
| * isIdentical([1, 2], [1, 2]) // true | ||
| * isIdentical({ a: 1 }, { a: 2 }) // false | ||
| * ``` | ||
| */ | ||
| declare const isIdentical: (targetA: unknown, targetB: unknown) => boolean; | ||
| /** | ||
| * Checks if the target is iterable. | ||
| * | ||
| * @param target - The target to check. | ||
| * @returns `true` if the target is iterable, `false` otherwise. | ||
| * | ||
| * @example Checking if value is iterable | ||
| * ```typescript | ||
| * isIterable([1, 2]) // true | ||
| * isIterable({ a: 1 }) // true | ||
| * isIterable('string') // false | ||
| * ``` | ||
| */ | ||
| declare const isIterable: (target: unknown) => boolean; | ||
| /** | ||
| * Checks if the provided data type is registered as an iterable type. | ||
| * | ||
| * @param dataType - The data type to check | ||
| * @returns `true` if the data type is iterable, otherwise `false` | ||
| * | ||
| * @example Checking iterable types | ||
| * ```typescript | ||
| * isIterableType('array') // true | ||
| * isIterableType('object') // true | ||
| * isIterableType('string') // false | ||
| * ``` | ||
| */ | ||
| declare const isIterableType: <T extends string = DataType>(dataType: T) => boolean; | ||
| /** | ||
| * Checks if a string is a valid marker format. | ||
| * | ||
| * @param text - The string to check | ||
| * @returns True if the string matches the marker pattern | ||
| * | ||
| * @example Validating marker format | ||
| * ```typescript | ||
| * isMarker('__$0') // true | ||
| * isMarker('__$123') // true | ||
| * isMarker('regular') // false | ||
| * ``` | ||
| */ | ||
| declare const isMarker: (text: string) => boolean; | ||
| /** | ||
| * Recursively searches for circular references in an object graph. | ||
| * | ||
| * @param target - The value to search | ||
| * @param maxResults - Maximum number of results to find | ||
| * @param path - Current path in the object graph | ||
| * @param stack - Reference stack for tracking visited objects | ||
| * @param result - Array to collect found circular references | ||
| * @param root - Whether this is the root call | ||
| * @returns Array of CircularReference objects found | ||
| * | ||
| * @example Recursively locating circular references | ||
| * ```typescript | ||
| * const stack = referenceStack() | ||
| * locateCircularReferenceRecursive(obj, 1, [], stack, [], true) | ||
| * ``` | ||
| */ | ||
| declare const locateCircularReferenceRecursive: (target: unknown, maxResults: "*" | number, path: string[], stack: ReferenceStack, result: CircularReference[], root?: boolean) => CircularReference[]; | ||
| /** | ||
| * Returns a list of locations where circular references occur. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The value to search for circular references | ||
| * @param maxResults - Maximum number of circular references to find (number or '*' for all) | ||
| * @returns An array of CircularReference objects indicating locations of circular references | ||
| * | ||
| * @example Locating circular references | ||
| * ```typescript | ||
| * const obj = { a: {} } | ||
| * obj.a.self = obj | ||
| * locateCircularReference(obj) // [CircularReference { location: ['a', 'self'], target: [] }] | ||
| * ``` | ||
| */ | ||
| declare const locateCircularReference: (target: unknown, maxResults?: "*" | number) => CircularReference[]; | ||
| /** | ||
| * Returns a list of locations where the key name matches a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against key names | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where the key pattern was found | ||
| * | ||
| * @example Locating keys in nested structure | ||
| * ```typescript | ||
| * locateKey({ a: { b: 1 }, c: { b: 2 } }, 'b') // [['a', 'b'], ['c', 'b']] | ||
| * ``` | ||
| */ | ||
| declare const locateKey: (target: unknown, pattern: string | RegExp, options?: DepthConfig) => string[][]; | ||
| /** | ||
| * Returns a list of locations where a text value matches a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against text values | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where the text pattern was found | ||
| * | ||
| * @example Locating text values in structure | ||
| * ```typescript | ||
| * locateText({ a: 'hello', b: { c: 'hello' } }, 'hello') // [['a'], ['b', 'c']] | ||
| * ``` | ||
| */ | ||
| declare const locateText: (target: unknown, pattern: string | RegExp, options?: DepthConfig) => string[][]; | ||
| /** | ||
| * Generates a unique marker string for object tagging. | ||
| * | ||
| * @returns A unique marker string prefixed with __$ | ||
| * | ||
| * @example Generating unique marker | ||
| * ```typescript | ||
| * const tag = marker() // '__$16789012345001234567890' | ||
| * ``` | ||
| */ | ||
| declare const marker: () => string; | ||
| /** | ||
| * Creates a new ReferenceStack instance. | ||
| * | ||
| * @remarks | ||
| * A ReferenceStack is used to keep track of iterables that have already been processed. | ||
| * This is particularly useful for handling circular references in data structures. | ||
| * @returns A new ReferenceStack instance. | ||
| * | ||
| * @example Tracking object references | ||
| * ```typescript | ||
| * const stack = referenceStack() | ||
| * stack.add(myObject) | ||
| * stack.exists(myObject) // true | ||
| * ``` | ||
| */ | ||
| declare const referenceStack: () => ReferenceStack; | ||
| /** | ||
| * Registers one or more classes which will be used to identify values as distinct data types. | ||
| * | ||
| * @param classRefs - One or more class references to register. | ||
| * @returns The result of the forEach operation (void) | ||
| * | ||
| * @example Registering custom class types | ||
| * ```typescript | ||
| * registerClassTypes(MyCustomClass, AnotherClass) | ||
| * getType(new MyCustomClass()) // 'MyCustomClass' | ||
| * ``` | ||
| */ | ||
| declare const registerClassTypes: (...classRefs: UnknownClass[]) => void; | ||
| /** | ||
| * Registers a custom class as iterable, allowing the data utilities API to treat instances | ||
| * as map-like objects with their own unique data type. | ||
| * | ||
| * @param classRef - The class constructor to register | ||
| * @param getKeys - Function that returns all keys from an instance | ||
| * @param read - Function to read a value from an instance by key | ||
| * @param write - Function to write a value to an instance (with optional key) | ||
| * @param remove - Function to remove a key from an instance | ||
| * @param instantiate - Factory function to create new instances (defaults to calling constructor) | ||
| * @remarks | ||
| * If the class is already registered, its entry will be updated with the new handlers. | ||
| * | ||
| * @example Registering custom iterable class | ||
| * ```typescript | ||
| * registerIterableClass( | ||
| * MyMap, | ||
| * (m) => [...m.keys()], | ||
| * (m, k) => m.get(k), | ||
| * (m, v, k) => m.set(k, v), | ||
| * (m, k) => m.delete(k) | ||
| * ) | ||
| * ``` | ||
| */ | ||
| declare const registerIterableClass: <T = unknown>(classRef: UnknownClass<T>, getKeys: (target: T) => string[], read: (target: T, key: unknown) => unknown, write: (instance: T, value: unknown, key?: unknown) => void, remove: (instance: T, key: unknown) => void, instantiate?: () => T) => void; | ||
| /** | ||
| * Removes any key names that match a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of keys that were removed. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against key names for removal | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where keys were removed | ||
| * | ||
| * @example Removing keys by pattern | ||
| * ```typescript | ||
| * const obj = { a: 1, temp: 2, b: { temp: 3 } } | ||
| * removeKey(obj, 'temp') // [['temp'], ['b', 'temp']] | ||
| * ``` | ||
| */ | ||
| declare const removeKey: (target: unknown, pattern: string | RegExp, options?: DepthConfig) => string[][]; | ||
| /** | ||
| * Renames any key names that match a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of keys that were edited. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against key names | ||
| * @param name - The new name to assign to matching keys | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where keys were renamed | ||
| * | ||
| * @example Renaming keys in structure | ||
| * ```typescript | ||
| * const obj = { old: 1, nested: { old: 2 } } | ||
| * renameKey(obj, 'old', 'new') // [['new'], ['nested', 'new']] | ||
| * ``` | ||
| */ | ||
| declare const renameKey: (target: unknown, pattern: string | RegExp, name: string, options?: DepthConfig) => string[][]; | ||
| /** | ||
| * Edits any text by replacing any string or substring that matches a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of the original text that were edited. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against text values | ||
| * @param text - The replacement text for matching values | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where text was replaced | ||
| * | ||
| * @example Replacing text in structure | ||
| * ```typescript | ||
| * const obj = { a: 'hello world', b: { c: 'hello' } } | ||
| * replaceText(obj, 'hello', 'hi') // [['a'], ['b', 'c']] | ||
| * ``` | ||
| */ | ||
| declare const replaceText: (target: unknown, pattern: string | RegExp, text: string, options?: DepthConfig) => string[][]; | ||
| /** | ||
| * Checks whether two targets have the same structure. | ||
| * | ||
| * @remarks | ||
| * For iterable types (arrays, sets, maps, and objects), it checks whether they have the same keys. | ||
| * For other types, it simply checks whether they are of the same type. | ||
| * It supports configuration via `getConfig().samePositionOfOwnProperties` to determine whether the order of keys matters for objects. | ||
| * If supports other registered iterable classes as well. See `registerIterableClass`. | ||
| * @param targetA data to compare | ||
| * @param targetB data to compare | ||
| * @returns The data type if both targets have the same structure, otherwise `false`. | ||
| * | ||
| * @example Comparing structures | ||
| * ```typescript | ||
| * sameStructure({ a: 1, b: 2 }, { a: 'x', b: 'y' }) // 'object' | ||
| * sameStructure({ a: 1 }, { b: 1 }) // false | ||
| * ``` | ||
| */ | ||
| declare const sameStructure: (targetA: unknown, targetB: unknown) => DataType | false; | ||
| /** | ||
| * Checks if two targets are of the same data type. | ||
| * | ||
| * @param targetA The first target to compare | ||
| * @param targetB The second target to compare | ||
| * @returns The common data type if both targets are of the same type; otherwise, false. | ||
| * | ||
| * @example Comparing data types | ||
| * ```typescript | ||
| * sameType([1], [2]) // 'array' | ||
| * sameType({}, []) // false | ||
| * ``` | ||
| */ | ||
| declare const sameType: <T extends string = DataType>(targetA: unknown, targetB: unknown) => T | false; | ||
| /** | ||
| * Recursively creates a selective copy of an object based on predicate conditions. | ||
| * | ||
| * @param target - The object to copy | ||
| * @param path - Current path in the object | ||
| * @param includeKey - Predicate to determine if a key should be included | ||
| * @param skipFunctions - Whether to skip function values | ||
| * @param recordSkip - Callback to record skipped data points | ||
| * @returns Partial copy of the target based on predicate | ||
| * | ||
| * @example Basic recursive copy | ||
| * ```typescript | ||
| * selectiveCopyRecursive(obj, [], () => true, false, () => {}) | ||
| * ``` | ||
| */ | ||
| declare const selectiveCopyRecursive: <T extends Record<string, unknown>>(target: T, path: string[], includeKey: SelectiveCopyPredicate, skipFunctions: boolean, recordSkip: DataPointOperation) => Partial<T>; | ||
| /** | ||
| * Creates a clone of the target. Options can be provided to selectively copy values. | ||
| * This algorithm is able detect circular references, and optionally clone them. | ||
| * | ||
| * @param target - The object to clone | ||
| * @param path - The current path in the data structure | ||
| * @param includeKey - Predicate function to determine if a key should be included | ||
| * @param skipFunctions - Whether to skip function values | ||
| * @param recordSkip - Callback to record skipped data points | ||
| * @param stack - Reference stack for tracking circular references | ||
| * @param circularRefs - Array to store circular reference information | ||
| * @param root - Whether this is the root call | ||
| * @returns A partial clone of the target object | ||
| * | ||
| * @example Copying with circular reference handling | ||
| * ```typescript | ||
| * selectiveCopyForCircularReferencesRecursive(obj, [], () => true, false, () => {}, referenceStack(), [], true) | ||
| * ``` | ||
| */ | ||
| declare const selectiveCopyForCircularReferencesRecursive: <T extends Record<string, unknown>>(target: T, path: string[], includeKey: SelectiveCopyPredicate, skipFunctions: boolean, recordSkip: DataPointOperation, stack: ReferenceStack, circularRefs: ReferenceLoop[], root?: boolean) => Partial<T>; | ||
| /** | ||
| * Creates a clone of the target. Options can be provided to selectively copy values. | ||
| * Due to JavaScript language limitations context of bound functions is not known, thus functions cannot be reliably cloned. | ||
| * This algorithm instead copies function references by default instead. For the same reason getters and setters are not replicate, only their | ||
| * return values. This algorithm can replicate circular references, when configured. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The value to clone | ||
| * @param options - Configuration options for selective copying | ||
| * @returns An object containing the cloned value and array of skipped data points | ||
| * | ||
| * @example Selective copying with options | ||
| * ```typescript | ||
| * const { clone, skipped } = selectiveCopy({ a: 1, b: 2 }, { includeKeys: ['a'] }) | ||
| * // clone = { a: 1 }, skipped = [{ path: ['b'], ... }] | ||
| * ``` | ||
| */ | ||
| declare const selectiveCopy: <T = unknown>(target: T, options?: SelectiveCopyOptions) => SelectiveCopyResult<T>; | ||
| declare const registeredClasses: UnknownClass[]; | ||
| declare const registeredIterableClasses: RegisteredIterableClassEntry[]; | ||
| /** | ||
| * Sets the global settings. | ||
| * | ||
| * @param config - Partial configuration object to merge with current settings | ||
| * | ||
| * @example Configuring settings | ||
| * ```typescript | ||
| * setConfig({ detectCircularReferences: true }) | ||
| * ``` | ||
| */ | ||
| declare const setConfig: (config: Partial<Config>) => void; | ||
| /** | ||
| * Returns the global settings. | ||
| * | ||
| * @returns The current global configuration object | ||
| * | ||
| * @example Retrieving configuration | ||
| * ```typescript | ||
| * const { detectCircularReferences } = getConfig() | ||
| * ``` | ||
| */ | ||
| declare const getConfig: () => Config; | ||
| /** | ||
| * A higher-order function that takes a single predicate function to generate an algorithm that traverses data points | ||
| * on a data structure. See traverse. | ||
| * | ||
| * @param condition - Predicate function to determine whether to traverse a data point | ||
| * @returns A traversal function configured with the condition | ||
| * | ||
| * @example Creating custom traversal | ||
| * ```typescript | ||
| * const customTraverse = createTraversal((config, key, value) => value !== null) | ||
| * customTraverse(data, callback, options) | ||
| * ``` | ||
| */ | ||
| declare const createTraversal: TraversalCreator<unknown>; | ||
| /** | ||
| * Invokes a callback function for every data point in the data structure of the target value to let you do read and write operations. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * | ||
| * @param target - The value to traverse | ||
| * @param callback - Function to invoke for each data point | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @param state - Optional state object to maintain across traversal callbacks | ||
| * @returns The state object after traversal completes | ||
| * | ||
| * @example Traversing data structure | ||
| * ```typescript | ||
| * traverse({ a: { b: 1 } }, (key, value, path) => { | ||
| * console.log(path.join('.'), '=', value) | ||
| * }) | ||
| * ``` | ||
| */ | ||
| declare const traverse: <T = unknown, S extends Record<string, unknown> = Record<string, unknown>>(target: T, callback: Callback, options?: DepthConfig, state?: S) => S; | ||
| export { CircularReference, containsKeys, createTraversal, deregisterClassTypes, deregisterIterableClass, getConfig, getDepth, getIterableOperators, getIterableTypes, getKeysFromIterable, getType, getUniqueKeys, getValue, hasCircularReference, isIdentical, isIterable, isIterableType, isMarker, locateCircularReference, locateCircularReferenceRecursive, locateKey, locateText, marker, referenceStack, registerClassTypes, registerIterableClass, registeredClasses, registeredIterableClasses, removeKey, renameKey, replaceText, sameStructure, sameType, selectiveCopy, selectiveCopyForCircularReferencesRecursive, selectiveCopyRecursive, setConfig, traverse }; | ||
| export type { Callback, Condition, Config, DataPoint, DataPointOperation, DataType, DefaultValueOptions, DepthConfig, ICircularReference, IterableOperators, Location, Predicate, ReferenceLoop, ReferenceStack, RegisteredIterableClassEntry, SelectiveCopyOptions, SelectiveCopyPredicate, SelectiveCopyResult, Target, Traversal, TraversalArgs, TraversalCircular, TraversalCreator, TraversalNonCircular, Traverse, TraverseConfig, UnknownClass, UnknownIterable, UnknownIterableKey }; |
+1
-1
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/index.ts"],"names":[],"mappings":"AAGA,mBAAmB,UAAU,CAAA;AAC7B,mBAAmB,mBAAmB,CAAA;AACtC,mBAAmB,wBAAwB,CAAA;AAG3C,cAAc,iBAAiB,CAAA;AAG/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA;AACzC,cAAc,0BAA0B,CAAA;AACxC,cAAc,6BAA6B,CAAA;AAG3C,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAG3B,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,mBAAmB,CAAA;AAGjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAG/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,cAAc,gBAAgB,CAAA;AAG9B,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AAGxC,cAAc,UAAU,CAAA"} | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAChF,YAAY,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAC5D,YAAY,EACV,SAAS,EACT,QAAQ,EACR,eAAe,EACf,kBAAkB,EAClB,YAAY,EACZ,4BAA4B,EAC5B,iBAAiB,EACjB,MAAM,EACN,cAAc,EACd,WAAW,EACX,cAAc,EACd,SAAS,EACT,QAAQ,EACR,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,QAAQ,GACT,MAAM,UAAU,CAAA;AACjB,YAAY,EACV,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,EACT,aAAa,EACb,mBAAmB,GACpB,MAAM,wBAA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AAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,EAAE,sBAAsB,EAAE,2CAA2C,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrH,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACpG,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA"} |
+832
-716
@@ -0,21 +1,55 @@ | ||
| import { isArray, from } from './_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/array/index.esm.js'; | ||
| import { createError } from './_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/error/index.esm.js'; | ||
| import { keys, freeze } from './_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/object/index.esm.js'; | ||
| import { createMap } from './_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/map/index.esm.js'; | ||
| import { createDate } from './_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/date/index.esm.js'; | ||
| import { round, random } from './_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/math/index.esm.js'; | ||
| import { createSet } from './_dependencies/@hyperfrontend/immutable-api-utils/built-in-copy/set/index.esm.js'; | ||
| /** | ||
| * Safe copies of Object built-in methods. | ||
| * Represents a detected circular reference in an object graph. | ||
| * Tracks the location where the reference was found and its target. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/object | ||
| * @example Creating a circular reference instance | ||
| * ```typescript | ||
| * const ref = new CircularReference(['root', 'child'], ['root']) | ||
| * console.log(ref.depth) // 1 | ||
| * ``` | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Object = globalThis.Object; | ||
| class CircularReference { | ||
| location; | ||
| target; | ||
| keyDelimiter = '\u00B7'; | ||
| delimiter = ' \u2192 '; | ||
| constructor(location, target) { | ||
| if (!isArray(location) || location.length === 0) { | ||
| throw createError(`Expected location to be a list with at list one string value.`); | ||
| } | ||
| if (!isArray(target)) { | ||
| throw createError(`Expected target to be a list.`); | ||
| } | ||
| this.location = { path: location }; | ||
| this.target = { path: target }; | ||
| } | ||
| get depth() { | ||
| return this.location.path.length - this.target.path.length; | ||
| } | ||
| toString = () => `${this.join(this.location)}${this.delimiter}${this.join(this.target)}`; | ||
| toJSON = () => this.toString(); | ||
| join = ({ path }) => path.join(this.keyDelimiter); | ||
| } | ||
| /** | ||
| * (Safe copy) Prevents modification of existing property attributes and values, | ||
| * and prevents the addition of new properties. | ||
| * Checks if a string is a valid marker format. | ||
| * | ||
| * @param text - The string to check | ||
| * @returns True if the string matches the marker pattern | ||
| * | ||
| * @example Validating marker format | ||
| * ```typescript | ||
| * isMarker('__$0') // true | ||
| * isMarker('__$123') // true | ||
| * isMarker('regular') // false | ||
| * ``` | ||
| */ | ||
| const freeze = _Object.freeze; | ||
| /** | ||
| * (Safe copy) Returns the names of the enumerable string properties and methods of an object. | ||
| */ | ||
| const keys = _Object.keys; | ||
| const isMarker = (text) => { | ||
@@ -64,2 +98,7 @@ if (typeof text !== 'string' || !text.startsWith('__$')) | ||
| * @param config - Partial configuration object to merge with current settings | ||
| * | ||
| * @example Configuring settings | ||
| * ```typescript | ||
| * setConfig({ detectCircularReferences: true }) | ||
| * ``` | ||
| */ | ||
@@ -76,2 +115,7 @@ const setConfig = (config) => { | ||
| * @returns The current global configuration object | ||
| * | ||
| * @example Retrieving configuration | ||
| * ```typescript | ||
| * const { detectCircularReferences } = getConfig() | ||
| * ``` | ||
| */ | ||
@@ -84,110 +128,25 @@ const getConfig = () => ({ | ||
| /** | ||
| * Registers one or more classes which will be used to identify values as distinct data types. | ||
| * Gets the keys from an iterable target based on its data type. | ||
| * | ||
| * @param classRefs - One or more class references to register. | ||
| * @returns The result of the forEach operation (void) | ||
| */ | ||
| const registerClassTypes = (...classRefs) => classRefs.forEach((classRef) => !registeredClasses.includes(classRef) && registeredClasses.push(classRef)); | ||
| /** | ||
| * Registers a custom class as iterable, allowing the data utilities API to treat instances | ||
| * as map-like objects with their own unique data type. | ||
| * @param target - The target to get the keys from. | ||
| * @param dataType - The data type of the target. | ||
| * @returns The keys from the iterable target. | ||
| * | ||
| * @param classRef - The class constructor to register | ||
| * @param getKeys - Function that returns all keys from an instance | ||
| * @param read - Function to read a value from an instance by key | ||
| * @param write - Function to write a value to an instance (with optional key) | ||
| * @param remove - Function to remove a key from an instance | ||
| * @param instantiate - Factory function to create new instances (defaults to calling constructor) | ||
| * @remarks | ||
| * If the class is already registered, its entry will be updated with the new handlers. | ||
| * @example Extracting keys from object | ||
| * ```typescript | ||
| * getKeysFromIterable({ a: 1, b: 2 }, 'object') // ['a', 'b'] | ||
| * ``` | ||
| */ | ||
| const registerIterableClass = (classRef, getKeys, read, write, remove, instantiate = () => new classRef()) => { | ||
| const existingEntryLocation = registeredIterableClasses.findIndex((entry) => entry.classRef === classRef); | ||
| const GetKeys = (target) => getConfig().detectCircularReferences ? [...getKeys(target)].filter((key) => !isMarker(key)) : getKeys(target); | ||
| const entry = { | ||
| classRef, | ||
| getKeys: GetKeys, | ||
| read, | ||
| write, | ||
| remove, | ||
| instantiate, | ||
| }; | ||
| if (existingEntryLocation >= 0) { | ||
| registeredIterableClasses[existingEntryLocation] = entry; | ||
| return; | ||
| } | ||
| registeredIterableClasses.unshift(entry); | ||
| registerClassTypes(classRef); | ||
| const getKeysFromIterable = (target, dataType) => { | ||
| if (dataType === 'array') | ||
| dataType = Array.name; | ||
| if (dataType === 'object') | ||
| dataType = Object.name; | ||
| const iterableClass = registeredIterableClasses.find(({ classRef }) => dataType === classRef.name); | ||
| if (iterableClass === undefined) | ||
| return []; | ||
| return iterableClass.getKeys(target); | ||
| }; | ||
| /** | ||
| * Removes one or more registered classes used to identify values as distinct data types. | ||
| * | ||
| * @param classRefs - One or more class references to deregister. If none provided, all registered classes will be deregistered. | ||
| */ | ||
| const deregisterClassTypes = (...classRefs) => { | ||
| if (classRefs.length === 0) { | ||
| while (registeredClasses.length !== 0) | ||
| registeredClasses.shift(); | ||
| return; | ||
| } | ||
| const indexes = classRefs | ||
| .map((classRef) => registeredClasses.indexOf(classRef)) | ||
| .filter((index) => index >= 0) | ||
| .sort(); | ||
| while (indexes.length !== 0) { | ||
| registeredClasses.splice(indexes[indexes.length - 1], 1); | ||
| indexes.pop(); | ||
| } | ||
| }; | ||
| /** | ||
| * Removes one or more registered iterable classes. | ||
| * Removes all registered iterable classes except built-ins (Array and Object) when no references are provided. | ||
| * | ||
| * @param classRefs - The class constructors to deregister | ||
| */ | ||
| const deregisterIterableClass = (...classRefs) => { | ||
| if (classRefs.length === 0) { | ||
| for (let i = registeredIterableClasses.length - 1; i >= 0; i--) { | ||
| const classRef = registeredIterableClasses[i].classRef; | ||
| if (![Array, Object].includes(classRef)) { | ||
| registeredIterableClasses.splice(i, 1); | ||
| } | ||
| } | ||
| } | ||
| else { | ||
| const indexes = classRefs | ||
| .map((classRef) => registeredIterableClasses.findIndex((entry) => entry.classRef === classRef)) | ||
| .filter((index) => index >= 0) | ||
| .sort(); | ||
| while (indexes.length > 0) { | ||
| registeredIterableClasses.splice(indexes[indexes.length - 1], 1); | ||
| indexes.pop(); | ||
| } | ||
| } | ||
| deregisterClassTypes(...classRefs); | ||
| }; | ||
| /** | ||
| * Safe copies of Array built-in static methods. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/array | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Array = globalThis.Array; | ||
| /** | ||
| * (Safe copy) Determines whether the passed value is an Array. | ||
| */ | ||
| const isArray = _Array.isArray; | ||
| /** | ||
| * (Safe copy) Creates an array from an array-like or iterable object. | ||
| */ | ||
| const from = _Array.from; | ||
| /** | ||
| * Returns the data type of the target. | ||
@@ -199,2 +158,9 @@ * Uses native `typeof` operator, however, makes distinction between `null`, `array`, and `object`. | ||
| * @returns The data type of the target. | ||
| * | ||
| * @example Determining data types | ||
| * ```typescript | ||
| * getType([1, 2]) // 'array' | ||
| * getType({ a: 1 }) // 'object' | ||
| * getType(null) // 'null' | ||
| * ``` | ||
| */ | ||
@@ -217,33 +183,2 @@ const getType = (target) => { | ||
| /** | ||
| * Checks if two targets are of the same data type. | ||
| * | ||
| * @param targetA The first target to compare | ||
| * @param targetB The second target to compare | ||
| * @returns The common data type if both targets are of the same type; otherwise, false. | ||
| */ | ||
| const sameType = (targetA, targetB) => { | ||
| const firstType = getType(targetA); | ||
| const secondType = getType(targetB); | ||
| return firstType === secondType ? firstType : false; | ||
| }; | ||
| /** | ||
| * Gets the keys from an iterable target based on its data type. | ||
| * | ||
| * @param target - The target to get the keys from. | ||
| * @param dataType - The data type of the target. | ||
| * @returns The keys from the iterable target. | ||
| */ | ||
| const getKeysFromIterable = (target, dataType) => { | ||
| if (dataType === 'array') | ||
| dataType = Array.name; | ||
| if (dataType === 'object') | ||
| dataType = Object.name; | ||
| const iterableClass = registeredIterableClasses.find(({ classRef }) => dataType === classRef.name); | ||
| if (iterableClass === undefined) | ||
| return []; | ||
| return iterableClass.getKeys(target); | ||
| }; | ||
| /** | ||
| * Returns a list of iterable data types. By default 'array' and 'object' are included., | ||
@@ -253,2 +188,7 @@ * but can be extended by using `registerIterableClass`. | ||
| * @returns Array of iterable data types. | ||
| * | ||
| * @example Listing registered iterable types | ||
| * ```typescript | ||
| * getIterableTypes() // ['array', 'object', ...registered types] | ||
| * ``` | ||
| */ | ||
@@ -269,2 +209,9 @@ const getIterableTypes = () => registeredIterableClasses.map(({ classRef }) => { | ||
| * @returns `true` if the data type is iterable, otherwise `false` | ||
| * | ||
| * @example Checking iterable types | ||
| * ```typescript | ||
| * isIterableType('array') // true | ||
| * isIterableType('object') // true | ||
| * isIterableType('string') // false | ||
| * ``` | ||
| */ | ||
@@ -274,167 +221,113 @@ const isIterableType = (dataType) => getIterableTypes().includes(dataType); | ||
| /** | ||
| * Checks whether two targets have the same structure. | ||
| * Checks if the target contains all specified keys. | ||
| * | ||
| * @param target - The target to check. | ||
| * @param keys - The keys to check for. | ||
| * @returns True if the target contains all specified keys, false otherwise. | ||
| * @remarks | ||
| * For iterable types (arrays, sets, maps, and objects), it checks whether they have the same keys. | ||
| * For other types, it simply checks whether they are of the same type. | ||
| * It supports configuration via `getConfig().samePositionOfOwnProperties` to determine whether the order of keys matters for objects. | ||
| * If supports other registered iterable classes as well. See `registerIterableClass`. | ||
| * @param targetA data to compare | ||
| * @param targetB data to compare | ||
| * @returns The data type if both targets have the same structure, otherwise `false`. | ||
| * Works with objects, arrays, and registered iterable classes. | ||
| * An empty keys array will always return `false`. | ||
| * | ||
| * @example Checking if object contains specific keys | ||
| * ```typescript | ||
| * containsKeys({ a: 1, b: 2 }, ['a', 'b']) // true | ||
| * containsKeys({ a: 1 }, ['a', 'b']) // false | ||
| * ``` | ||
| */ | ||
| const sameStructure = (targetA, targetB) => { | ||
| const typeMatch = sameType(targetA, targetB); | ||
| if (typeMatch === false) | ||
| const containsKeys = (target, keys) => { | ||
| if (keys.length === 0) | ||
| return false; | ||
| if (isIterableType(typeMatch)) { | ||
| const aKeys = getKeysFromIterable(targetA, typeMatch); | ||
| const bKeys = getKeysFromIterable(targetB, typeMatch); | ||
| const aKeyCount = aKeys.length; | ||
| const bKeyCount = bKeys.length; | ||
| if (aKeyCount !== bKeyCount) | ||
| return false; | ||
| if (aKeyCount === 0) | ||
| return typeMatch; | ||
| if (getConfig().samePositionOfOwnProperties) { | ||
| for (let i = 0; i < aKeyCount; i += 1) { | ||
| if (aKeys[i] !== bKeys[i]) | ||
| return false; | ||
| } | ||
| } | ||
| else { | ||
| for (let i = 0; i < aKeyCount; i += 1) { | ||
| if (!bKeys.includes(aKeys[i])) | ||
| return false; | ||
| } | ||
| } | ||
| } | ||
| return typeMatch; | ||
| const dataType = getType(target); | ||
| if (isIterableType(dataType) === false) | ||
| return false; | ||
| const targetKeys = getKeysFromIterable(target, dataType); | ||
| return !keys.some((k) => !targetKeys.includes(k)); | ||
| }; | ||
| /** | ||
| * Checks if the target is iterable. | ||
| * Removes one or more registered classes used to identify values as distinct data types. | ||
| * | ||
| * @param target - The target to check. | ||
| * @returns `true` if the target is iterable, `false` otherwise. | ||
| * @param classRefs - One or more class references to deregister. If none provided, all registered classes will be deregistered. | ||
| * | ||
| * @example Deregistering class types | ||
| * ```typescript | ||
| * deregisterClassTypes(MyCustomClass) | ||
| * deregisterClassTypes() // clears all | ||
| * ``` | ||
| */ | ||
| const isIterable = (target) => isIterableType(getType(target)); | ||
| const deregisterClassTypes = (...classRefs) => { | ||
| if (classRefs.length === 0) { | ||
| while (registeredClasses.length !== 0) | ||
| registeredClasses.shift(); | ||
| return; | ||
| } | ||
| const indexes = classRefs | ||
| .map((classRef) => registeredClasses.indexOf(classRef)) | ||
| .filter((index) => index >= 0) | ||
| .sort(); | ||
| while (indexes.length !== 0) { | ||
| registeredClasses.splice(indexes[indexes.length - 1], 1); | ||
| indexes.pop(); | ||
| } | ||
| }; | ||
| /** | ||
| * Safe copies of Error built-ins via factory functions. | ||
| * Removes one or more registered iterable classes. | ||
| * Removes all registered iterable classes except built-ins (Array and Object) when no references are provided. | ||
| * | ||
| * Since constructors cannot be safely captured via Object.assign, this module | ||
| * provides factory functions that use Reflect.construct internally. | ||
| * @param classRefs - The class constructors to deregister | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/error | ||
| * @example Deregistering iterable classes | ||
| * ```typescript | ||
| * deregisterIterableClass(MyCollection) | ||
| * deregisterIterableClass() // clears all except Array/Object | ||
| * ``` | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Error = globalThis.Error; | ||
| const _Reflect$3 = globalThis.Reflect; | ||
| /** | ||
| * (Safe copy) Creates a new Error using the captured Error constructor. | ||
| * Use this instead of `new Error()`. | ||
| * | ||
| * @param message - Optional error message. | ||
| * @param options - Optional error options. | ||
| * @returns A new Error instance. | ||
| */ | ||
| const createError = (message, options) => _Reflect$3.construct(_Error, [message, options]); | ||
| class CircularReference { | ||
| location; | ||
| target; | ||
| keyDelimiter = '\u00B7'; // Middle dot | ||
| delimiter = ' \u2192 '; // Right arrow | ||
| constructor(location, target) { | ||
| if (!isArray(location) || location.length === 0) { | ||
| throw createError(`Expected location to be a list with at list one string value.`); | ||
| const deregisterIterableClass = (...classRefs) => { | ||
| if (classRefs.length === 0) { | ||
| for (let i = registeredIterableClasses.length - 1; i >= 0; i--) { | ||
| const classRef = registeredIterableClasses[i].classRef; | ||
| if (![Array, Object].includes(classRef)) { | ||
| registeredIterableClasses.splice(i, 1); | ||
| } | ||
| } | ||
| if (!isArray(target)) { | ||
| throw createError(`Expected target to be a list.`); | ||
| } | ||
| else { | ||
| const indexes = classRefs | ||
| .map((classRef) => registeredIterableClasses.findIndex((entry) => entry.classRef === classRef)) | ||
| .filter((index) => index >= 0) | ||
| .sort(); | ||
| while (indexes.length > 0) { | ||
| registeredIterableClasses.splice(indexes[indexes.length - 1], 1); | ||
| indexes.pop(); | ||
| } | ||
| this.location = { path: location }; | ||
| this.target = { path: target }; | ||
| } | ||
| get depth() { | ||
| return this.location.path.length - this.target.path.length; | ||
| } | ||
| toString = () => `${this.join(this.location)}${this.delimiter}${this.join(this.target)}`; | ||
| toJSON = () => this.toString(); | ||
| join = ({ path }) => path.join(this.keyDelimiter); | ||
| } | ||
| const getIterableOperators = (dataType) => { | ||
| const { getKeys, read, write, remove, instantiate } = (registeredIterableClasses.find((e) => e.classRef.name.toLowerCase() === dataType.toLowerCase())); | ||
| return { getKeys, read, write, remove, instantiate }; | ||
| deregisterClassTypes(...classRefs); | ||
| }; | ||
| /** | ||
| * Safe copies of Map built-in via factory function. | ||
| * Checks if the target is iterable. | ||
| * | ||
| * Since constructors cannot be safely captured via Object.assign, this module | ||
| * provides a factory function that uses Reflect.construct internally. | ||
| * @param target - The target to check. | ||
| * @returns `true` if the target is iterable, `false` otherwise. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/map | ||
| * @example Checking if value is iterable | ||
| * ```typescript | ||
| * isIterable([1, 2]) // true | ||
| * isIterable({ a: 1 }) // true | ||
| * isIterable('string') // false | ||
| * ``` | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Map = globalThis.Map; | ||
| const _Reflect$2 = globalThis.Reflect; | ||
| /** | ||
| * (Safe copy) Creates a new Map using the captured Map constructor. | ||
| * Use this instead of `new Map()`. | ||
| * | ||
| * @param iterable - Optional iterable of key-value pairs. | ||
| * @returns A new Map instance. | ||
| */ | ||
| const createMap = (iterable) => _Reflect$2.construct(_Map, iterable ? [iterable] : []); | ||
| const isIterable = (target) => isIterableType(getType(target)); | ||
| /** | ||
| * Safe copies of Date built-in via factory function and static methods. | ||
| * Generates a unique marker string for object tagging. | ||
| * | ||
| * Since constructors cannot be safely captured via Object.assign, this module | ||
| * provides a factory function that uses Reflect.construct internally. | ||
| * @returns A unique marker string prefixed with __$ | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/date | ||
| * @example Generating unique marker | ||
| * ```typescript | ||
| * const tag = marker() // '__$16789012345001234567890' | ||
| * ``` | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Date = globalThis.Date; | ||
| const _Reflect$1 = globalThis.Reflect; | ||
| function createDate(...args) { | ||
| return _Reflect$1.construct(_Date, args); | ||
| } | ||
| /** | ||
| * Safe copies of Math built-in methods. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/math | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Math = globalThis.Math; | ||
| /** | ||
| * (Safe copy) Returns the value of a number rounded to the nearest integer. | ||
| */ | ||
| const round = _Math.round; | ||
| // ============================================================================ | ||
| // Random | ||
| // ============================================================================ | ||
| /** | ||
| * (Safe copy) Returns a pseudo-random number between 0 and 1. | ||
| * Note: This is NOT cryptographically secure. For secure random values, | ||
| * use crypto.getRandomValues(). | ||
| */ | ||
| const random = _Math.random; | ||
| const marker = () => { | ||
@@ -455,2 +348,9 @@ const randomValue = round(random() * 10000000000000); | ||
| * @returns A new ReferenceStack instance. | ||
| * | ||
| * @example Tracking object references | ||
| * ```typescript | ||
| * const stack = referenceStack() | ||
| * stack.add(myObject) | ||
| * stack.exists(myObject) // true | ||
| * ``` | ||
| */ | ||
@@ -488,2 +388,251 @@ const referenceStack = () => { | ||
| const errorMessage = (thing, type) => `Expected ${thing} to be ${type}.`; | ||
| const nextIterationDetails = (path, key, value) => ({ | ||
| nextPath: [...path, key], | ||
| nextValue: value[key], | ||
| }); | ||
| const circularDependencyTraversal = (condition, callback, config, key, path, value, parent, state, stack, root = false) => { | ||
| if (stack.exists(value)) | ||
| return state; | ||
| const ok = condition(config, key, value, path, parent); | ||
| /* istanbul ignore next */ | ||
| if (config.exitEarly) | ||
| return state; | ||
| if (ok) | ||
| callback(key, value, path, state, parent); | ||
| stack.add(value); | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return state; | ||
| const keys = getKeysFromIterable(value, type); | ||
| keys.forEach((key) => { | ||
| const { nextPath, nextValue } = nextIterationDetails(path, key, value); | ||
| circularDependencyTraversal(condition, callback, config, key, nextPath, nextValue, value, state, stack); | ||
| }); | ||
| if (root) | ||
| stack.clear(); | ||
| return state; | ||
| }; | ||
| const nonCircularDependencyTraversal = (condition, callback, config, key, path, value, parent, state) => { | ||
| const ok = condition(config, key, value, path, parent); | ||
| /* istanbul ignore next */ | ||
| if (config.exitEarly) | ||
| return state; | ||
| if (ok) | ||
| callback(key, value, path, state, parent); | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return state; | ||
| const keys = getKeysFromIterable(value, type); | ||
| keys.forEach((key) => { | ||
| const { nextPath, nextValue } = nextIterationDetails(path, key, value); | ||
| nonCircularDependencyTraversal(condition, callback, config, key, nextPath, nextValue, value, state); | ||
| }); | ||
| return state; | ||
| }; | ||
| const traversal = (target, condition, callback, options, state) => { | ||
| if (typeof callback !== 'function') | ||
| throw createError(errorMessage('callback', 'a function')); | ||
| if (!(typeof options === 'object' && !isArray(options))) | ||
| throw createError(errorMessage('options', 'an object')); | ||
| if (!isArray(options.depth)) | ||
| throw createError(errorMessage('options.depth', 'an array')); | ||
| const [startDepth, maxDepth] = options.depth; | ||
| if (startDepth !== void 0 && typeof startDepth !== 'number') | ||
| throw createError(errorMessage('options.depth.0', 'a number')); | ||
| if (maxDepth !== void 0) { | ||
| const maxDepthType = typeof maxDepth; | ||
| if (!['number', 'string'].includes(maxDepthType)) | ||
| throw createError(errorMessage('options.depth.1', 'a number or a string')); | ||
| if (maxDepthType === 'string' && maxDepth !== '*') | ||
| throw createError("Only valid string value in options.depth.1 is '*'."); | ||
| } | ||
| const config = { | ||
| depth: freeze([options.depth[0] ?? 0, options.depth[1] ?? '*']), | ||
| exitEarly: false, | ||
| }; | ||
| const initialArgs = [condition, callback, config, '', [], target, void 0, state]; | ||
| if (getConfig().detectCircularReferences) | ||
| return circularDependencyTraversal(...initialArgs, referenceStack(), true); | ||
| return nonCircularDependencyTraversal(...initialArgs); | ||
| }; | ||
| /** | ||
| * A higher-order function that takes a single predicate function to generate an algorithm that traverses data points | ||
| * on a data structure. See traverse. | ||
| * | ||
| * @param condition - Predicate function to determine whether to traverse a data point | ||
| * @returns A traversal function configured with the condition | ||
| * | ||
| * @example Creating custom traversal | ||
| * ```typescript | ||
| * const customTraverse = createTraversal((config, key, value) => value !== null) | ||
| * customTraverse(data, callback, options) | ||
| * ``` | ||
| */ | ||
| const createTraversal = (condition) => (target, callback, options, state) => traversal(target, condition, callback, options ?? { depth: [0, '*'] }, state ?? {}); | ||
| const condition = (config, key, value, path) => !(path.length < config.depth[0] || config.depth[1] < path.length); | ||
| const traverseBetweenDepthRange = createTraversal(condition); | ||
| /** | ||
| * Invokes a callback function for every data point in the data structure of the target value to let you do read and write operations. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * | ||
| * @param target - The value to traverse | ||
| * @param callback - Function to invoke for each data point | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @param state - Optional state object to maintain across traversal callbacks | ||
| * @returns The state object after traversal completes | ||
| * | ||
| * @example Traversing data structure | ||
| * ```typescript | ||
| * traverse({ a: { b: 1 } }, (key, value, path) => { | ||
| * console.log(path.join('.'), '=', value) | ||
| * }) | ||
| * ``` | ||
| */ | ||
| const traverse = (target, callback, options, state) => traverseBetweenDepthRange(target, callback, options, state); | ||
| /** | ||
| * Returns the total depth of a value's data structure, | ||
| * and returns a list of locations that are the most deeply nested. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to analyze for depth | ||
| * @returns A tuple containing the maximum depth and an array of paths to the deepest locations | ||
| * | ||
| * @example Getting depth of nested object | ||
| * ```typescript | ||
| * getDepth({ a: { b: { c: 1 } } }) // [3, [['a', 'b', 'c']]] | ||
| * ``` | ||
| */ | ||
| const getDepth = (target) => { | ||
| const trackDepth = (key, value, path, state) => { | ||
| if (state.depth < path.length) { | ||
| state.depth = path.length; | ||
| state.locations = [path]; | ||
| return; | ||
| } | ||
| if (state.depth === path.length) { | ||
| state.locations.push(path); | ||
| } | ||
| }; | ||
| const options = { depth: [0, '*'] }; | ||
| const state = { depth: 0, locations: [] }; | ||
| const { depth, locations } = traverse(target, trackDepth, options, state); | ||
| return [depth, locations]; | ||
| }; | ||
| /** | ||
| * Retrieves iterable operators for a given data type. | ||
| * | ||
| * @param dataType - The type of data to get operators for | ||
| * @returns Object containing getKeys, read, write, remove, and instantiate operators | ||
| * | ||
| * @example Retrieving operators for array type | ||
| * ```typescript | ||
| * const ops = getIterableOperators('array') | ||
| * const keys = ops.getKeys([1, 2, 3]) // ['0', '1', '2'] | ||
| * ``` | ||
| */ | ||
| const getIterableOperators = (dataType) => { | ||
| const { getKeys, read, write, remove, instantiate } = (registeredIterableClasses.find((e) => e.classRef.name.toLowerCase() === dataType.toLowerCase())); | ||
| return { getKeys, read, write, remove, instantiate }; | ||
| }; | ||
| /** | ||
| * Returns a list of unique key names that match a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against key names (defaults to matching all keys) | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of unique key names that match the pattern | ||
| * | ||
| * @example Finding unique keys by pattern | ||
| * ```typescript | ||
| * getUniqueKeys({ a: { b: 1 }, c: { b: 2 } }, 'b') // ['b'] | ||
| * getUniqueKeys(data, /^user/) // keys starting with 'user' | ||
| * ``` | ||
| */ | ||
| const getUniqueKeys = (target, pattern = /.+/, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => match(nextKey) && state.names.add(nextKey)); | ||
| }; | ||
| return from(traverse(target, callback, { depth: [0, '*'], ...options }, { | ||
| names: createSet(), | ||
| }).names.values()); | ||
| }; | ||
| /** | ||
| * Gets the value at the specified path from the target. | ||
| * | ||
| * @param target - The target to get the value from. | ||
| * @param path - The path to the value. | ||
| * @param defaultValue - The default value to return if the path does not exist or an error occurs. | ||
| * @returns The value at the specified path or the default value. | ||
| * @throws {Error} Will throw an error if the path is not a non-empty array of strings and no default value for errors is provided. | ||
| * @remarks | ||
| * - If `defaultValue.onMissingKey` is provided, it will be returned when a key in the path is missing. | ||
| * - If `defaultValue.onError` is provided, it will be returned when any error occurs during the retrieval process. | ||
| * | ||
| * @example Retrieving nested values | ||
| * ```typescript | ||
| * getValue({ a: { b: 1 } }, ['a', 'b']) // 1 | ||
| * getValue({ a: 1 }, ['x'], { onMissingKey: 0 }) // 0 | ||
| * ``` | ||
| */ | ||
| const getValue = (target, path, defaultValue) => { | ||
| if (isArray(path) === false) { | ||
| throw createError('Expected path to be a non-empty array of strings.'); | ||
| } | ||
| if (path.length === 0) | ||
| return target; | ||
| const hasOnMissingKeyDefault = !!(defaultValue && 'onMissingKey' in defaultValue); | ||
| const hasOnErrorDefault = !!(defaultValue && 'onError' in defaultValue); | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| let scope; | ||
| let scopeType; | ||
| let scopeIterable; | ||
| let scopeOperators; | ||
| try { | ||
| scope = target; | ||
| for (let index = 0; index < path.length; index += 1) { | ||
| const key = path[index]; | ||
| if (typeof key !== 'string') { | ||
| throw createError(`Expected path[${index}] to be a string, got ${typeof key}.`); | ||
| } | ||
| scopeType = getType(scope); | ||
| scopeIterable = isIterableType(scopeType); | ||
| /* instanbul ignore next */ | ||
| if (!scopeIterable && hasOnMissingKeyDefault) { | ||
| scope = defaultValue.onMissingKey; | ||
| break; | ||
| } | ||
| scopeOperators = getIterableOperators(scopeType); | ||
| if (scopeIterable && !scopeOperators.getKeys(scope).includes(key) && hasOnMissingKeyDefault) { | ||
| scope = defaultValue.onMissingKey; | ||
| break; | ||
| } | ||
| scope = scopeOperators.read(scope, key); | ||
| } | ||
| } | ||
| catch (error) { | ||
| if (hasOnErrorDefault) { | ||
| scope = defaultValue.onError; | ||
| } | ||
| else { | ||
| throw error; | ||
| } | ||
| } | ||
| return scope; | ||
| }; | ||
| const hasCircularReferenceRecursive = (target, stack, root = false) => { | ||
@@ -509,2 +658,10 @@ if (stack.exists(target)) | ||
| * @returns True if the value contains circular references, false otherwise | ||
| * | ||
| * @example Detecting circular references | ||
| * ```typescript | ||
| * const obj = { a: {} } | ||
| * obj.a.self = obj | ||
| * hasCircularReference(obj) // true | ||
| * hasCircularReference({ a: 1 }) // false | ||
| * ``` | ||
| */ | ||
@@ -523,46 +680,66 @@ const hasCircularReference = (target) => { | ||
| const invalidmaxResults = 'Invalid maxResults argument.'; | ||
| const locateCircularReferenceRecursive = (target, maxResults, path, stack, result, root = false) => { | ||
| if (result.length === maxResults) | ||
| return result; | ||
| if (stack.exists(target)) { | ||
| result.push(new CircularReference(path, path.slice(0, stack.lastSeen(target)))); | ||
| return result; | ||
| } | ||
| const type = getType(target); | ||
| if (!isIterableType(type)) | ||
| return result; | ||
| stack.add(target); | ||
| const { getKeys, read } = getIterableOperators(type); | ||
| const keys = getKeys(target); | ||
| keys.forEach((key) => locateCircularReferenceRecursive(read(target, key), maxResults, [...path, key], stack, result)); | ||
| if (root) | ||
| stack.clear(); | ||
| return result; | ||
| /** | ||
| * Checks if two targets are of the same data type. | ||
| * | ||
| * @param targetA The first target to compare | ||
| * @param targetB The second target to compare | ||
| * @returns The common data type if both targets are of the same type; otherwise, false. | ||
| * | ||
| * @example Comparing data types | ||
| * ```typescript | ||
| * sameType([1], [2]) // 'array' | ||
| * sameType({}, []) // false | ||
| * ``` | ||
| */ | ||
| const sameType = (targetA, targetB) => { | ||
| const firstType = getType(targetA); | ||
| const secondType = getType(targetB); | ||
| return firstType === secondType ? firstType : false; | ||
| }; | ||
| /** | ||
| * Returns a list of locations where circular references occur. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * Checks whether two targets have the same structure. | ||
| * | ||
| * @param target - The value to search for circular references | ||
| * @param maxResults - Maximum number of circular references to find (number or '*' for all) | ||
| * @returns An array of CircularReference objects indicating locations of circular references | ||
| * @remarks | ||
| * For iterable types (arrays, sets, maps, and objects), it checks whether they have the same keys. | ||
| * For other types, it simply checks whether they are of the same type. | ||
| * It supports configuration via `getConfig().samePositionOfOwnProperties` to determine whether the order of keys matters for objects. | ||
| * If supports other registered iterable classes as well. See `registerIterableClass`. | ||
| * @param targetA data to compare | ||
| * @param targetB data to compare | ||
| * @returns The data type if both targets have the same structure, otherwise `false`. | ||
| * | ||
| * @example Comparing structures | ||
| * ```typescript | ||
| * sameStructure({ a: 1, b: 2 }, { a: 'x', b: 'y' }) // 'object' | ||
| * sameStructure({ a: 1 }, { b: 1 }) // false | ||
| * ``` | ||
| */ | ||
| const locateCircularReference = (target, maxResults = 1) => { | ||
| const resultsType = typeof maxResults; | ||
| if (!['string', 'number'].includes(resultsType)) | ||
| throw createError(invalidmaxResults); | ||
| if (resultsType === 'string' && maxResults !== '*') | ||
| throw createError(invalidmaxResults); | ||
| if (resultsType === 'number' && (maxResults < 1 || [NaN, Infinity].includes(maxResults))) | ||
| throw createError(invalidmaxResults); | ||
| const originalSupportStatus = getConfig().detectCircularReferences; | ||
| if (!originalSupportStatus) { | ||
| setConfig({ detectCircularReferences: true }); | ||
| const sameStructure = (targetA, targetB) => { | ||
| const typeMatch = sameType(targetA, targetB); | ||
| if (typeMatch === false) | ||
| return false; | ||
| if (isIterableType(typeMatch)) { | ||
| const aKeys = getKeysFromIterable(targetA, typeMatch); | ||
| const bKeys = getKeysFromIterable(targetB, typeMatch); | ||
| const aKeyCount = aKeys.length; | ||
| const bKeyCount = bKeys.length; | ||
| if (aKeyCount !== bKeyCount) | ||
| return false; | ||
| if (aKeyCount === 0) | ||
| return typeMatch; | ||
| if (getConfig().samePositionOfOwnProperties) { | ||
| for (let i = 0; i < aKeyCount; i += 1) { | ||
| if (aKeys[i] !== bKeys[i]) | ||
| return false; | ||
| } | ||
| } | ||
| else { | ||
| for (let i = 0; i < aKeyCount; i += 1) { | ||
| if (!bKeys.includes(aKeys[i])) | ||
| return false; | ||
| } | ||
| } | ||
| } | ||
| const result = locateCircularReferenceRecursive(target, maxResults, [], referenceStack(), [], true); | ||
| if (!originalSupportStatus) { | ||
| setConfig({ detectCircularReferences: false }); | ||
| } | ||
| return result; | ||
| return typeMatch; | ||
| }; | ||
@@ -668,2 +845,9 @@ | ||
| * @returns True if the values are identical, false otherwise | ||
| * | ||
| * @example Comparing values for identity | ||
| * ```typescript | ||
| * isIdentical({ a: 1 }, { a: 1 }) // true | ||
| * isIdentical([1, 2], [1, 2]) // true | ||
| * isIdentical({ a: 1 }, { a: 2 }) // false | ||
| * ``` | ||
| */ | ||
@@ -678,23 +862,321 @@ const isIdentical = (targetA, targetB) => { | ||
| const invalidmaxResults = 'Invalid maxResults argument.'; | ||
| /** | ||
| * Checks if the target contains all specified keys. | ||
| * Recursively searches for circular references in an object graph. | ||
| * | ||
| * @param target - The target to check. | ||
| * @param keys - The keys to check for. | ||
| * @returns True if the target contains all specified keys, false otherwise. | ||
| * @param target - The value to search | ||
| * @param maxResults - Maximum number of results to find | ||
| * @param path - Current path in the object graph | ||
| * @param stack - Reference stack for tracking visited objects | ||
| * @param result - Array to collect found circular references | ||
| * @param root - Whether this is the root call | ||
| * @returns Array of CircularReference objects found | ||
| * | ||
| * @example Recursively locating circular references | ||
| * ```typescript | ||
| * const stack = referenceStack() | ||
| * locateCircularReferenceRecursive(obj, 1, [], stack, [], true) | ||
| * ``` | ||
| */ | ||
| const locateCircularReferenceRecursive = (target, maxResults, path, stack, result, root = false) => { | ||
| if (result.length === maxResults) | ||
| return result; | ||
| if (stack.exists(target)) { | ||
| result.push(new CircularReference(path, path.slice(0, stack.lastSeen(target)))); | ||
| return result; | ||
| } | ||
| const type = getType(target); | ||
| if (!isIterableType(type)) | ||
| return result; | ||
| stack.add(target); | ||
| const { getKeys, read } = getIterableOperators(type); | ||
| const keys = getKeys(target); | ||
| keys.forEach((key) => locateCircularReferenceRecursive(read(target, key), maxResults, [...path, key], stack, result)); | ||
| if (root) | ||
| stack.clear(); | ||
| return result; | ||
| }; | ||
| /** | ||
| * Returns a list of locations where circular references occur. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The value to search for circular references | ||
| * @param maxResults - Maximum number of circular references to find (number or '*' for all) | ||
| * @returns An array of CircularReference objects indicating locations of circular references | ||
| * | ||
| * @example Locating circular references | ||
| * ```typescript | ||
| * const obj = { a: {} } | ||
| * obj.a.self = obj | ||
| * locateCircularReference(obj) // [CircularReference { location: ['a', 'self'], target: [] }] | ||
| * ``` | ||
| */ | ||
| const locateCircularReference = (target, maxResults = 1) => { | ||
| const resultsType = typeof maxResults; | ||
| if (!['string', 'number'].includes(resultsType)) | ||
| throw createError(invalidmaxResults); | ||
| if (resultsType === 'string' && maxResults !== '*') | ||
| throw createError(invalidmaxResults); | ||
| if (resultsType === 'number' && (maxResults < 1 || [NaN, Infinity].includes(maxResults))) | ||
| throw createError(invalidmaxResults); | ||
| const originalSupportStatus = getConfig().detectCircularReferences; | ||
| if (!originalSupportStatus) { | ||
| setConfig({ detectCircularReferences: true }); | ||
| } | ||
| const result = locateCircularReferenceRecursive(target, maxResults, [], referenceStack(), [], true); | ||
| if (!originalSupportStatus) { | ||
| setConfig({ detectCircularReferences: false }); | ||
| } | ||
| return result; | ||
| }; | ||
| /** | ||
| * Returns a list of locations where the key name matches a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against key names | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where the key pattern was found | ||
| * | ||
| * @example Locating keys in nested structure | ||
| * ```typescript | ||
| * locateKey({ a: { b: 1 }, c: { b: 2 } }, 'b') // [['a', 'b'], ['c', 'b']] | ||
| * ``` | ||
| */ | ||
| const locateKey = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => match(nextKey) && state.locations.push([...path, nextKey])); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Returns a list of locations where a text value matches a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against text values | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where the text pattern was found | ||
| * | ||
| * @example Locating text values in structure | ||
| * ```typescript | ||
| * locateText({ a: 'hello', b: { c: 'hello' } }, 'hello') // [['a'], ['b', 'c']] | ||
| * ``` | ||
| */ | ||
| const locateText = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (text) => text === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => getType(value) === 'string' && match(value) && state.locations.push(path); | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Registers one or more classes which will be used to identify values as distinct data types. | ||
| * | ||
| * @param classRefs - One or more class references to register. | ||
| * @returns The result of the forEach operation (void) | ||
| * | ||
| * @example Registering custom class types | ||
| * ```typescript | ||
| * registerClassTypes(MyCustomClass, AnotherClass) | ||
| * getType(new MyCustomClass()) // 'MyCustomClass' | ||
| * ``` | ||
| */ | ||
| const registerClassTypes = (...classRefs) => classRefs.forEach((classRef) => !registeredClasses.includes(classRef) && registeredClasses.push(classRef)); | ||
| /** | ||
| * Registers a custom class as iterable, allowing the data utilities API to treat instances | ||
| * as map-like objects with their own unique data type. | ||
| * | ||
| * @param classRef - The class constructor to register | ||
| * @param getKeys - Function that returns all keys from an instance | ||
| * @param read - Function to read a value from an instance by key | ||
| * @param write - Function to write a value to an instance (with optional key) | ||
| * @param remove - Function to remove a key from an instance | ||
| * @param instantiate - Factory function to create new instances (defaults to calling constructor) | ||
| * @remarks | ||
| * Works with objects, arrays, and registered iterable classes. | ||
| * An empty keys array will always return `false`. | ||
| * If the class is already registered, its entry will be updated with the new handlers. | ||
| * | ||
| * @example Registering custom iterable class | ||
| * ```typescript | ||
| * registerIterableClass( | ||
| * MyMap, | ||
| * (m) => [...m.keys()], | ||
| * (m, k) => m.get(k), | ||
| * (m, v, k) => m.set(k, v), | ||
| * (m, k) => m.delete(k) | ||
| * ) | ||
| * ``` | ||
| */ | ||
| const containsKeys = (target, keys) => { | ||
| if (keys.length === 0) | ||
| return false; | ||
| const dataType = getType(target); | ||
| if (isIterableType(dataType) === false) | ||
| return false; | ||
| const targetKeys = getKeysFromIterable(target, dataType); | ||
| return !keys.some((k) => !targetKeys.includes(k)); | ||
| const registerIterableClass = (classRef, getKeys, read, write, remove, instantiate = () => new classRef()) => { | ||
| const existingEntryLocation = registeredIterableClasses.findIndex((entry) => entry.classRef === classRef); | ||
| const GetKeys = (target) => getConfig().detectCircularReferences ? [...getKeys(target)].filter((key) => !isMarker(key)) : getKeys(target); | ||
| const entry = { | ||
| classRef, | ||
| getKeys: GetKeys, | ||
| read, | ||
| write, | ||
| remove, | ||
| instantiate, | ||
| }; | ||
| if (existingEntryLocation >= 0) { | ||
| registeredIterableClasses[existingEntryLocation] = entry; | ||
| return; | ||
| } | ||
| registeredIterableClasses.unshift(entry); | ||
| registerClassTypes(classRef); | ||
| }; | ||
| /** | ||
| * Removes any key names that match a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of keys that were removed. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against key names for removal | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where keys were removed | ||
| * | ||
| * @example Removing keys by pattern | ||
| * ```typescript | ||
| * const obj = { a: 1, temp: 2, b: { temp: 3 } } | ||
| * removeKey(obj, 'temp') // [['temp'], ['b', 'temp']] | ||
| * ``` | ||
| */ | ||
| const removeKey = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, remove } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| if (!match(nextKey)) | ||
| return; | ||
| remove(value, nextKey); | ||
| state.locations.push([...path, nextKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Renames any key names that match a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of keys that were edited. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against key names | ||
| * @param name - The new name to assign to matching keys | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where keys were renamed | ||
| * | ||
| * @example Renaming keys in structure | ||
| * ```typescript | ||
| * const obj = { old: 1, nested: { old: 2 } } | ||
| * renameKey(obj, 'old', 'new') // [['new'], ['nested', 'new']] | ||
| * ``` | ||
| */ | ||
| const renameKey = (target, pattern, name, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| if (typeof name !== 'string') | ||
| throw createError('Expected name to be a string.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const rename = patternIsString ? () => name : (key) => key.replace(pattern, name); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, read, write, remove } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| if (!match(nextKey)) | ||
| return; | ||
| const newKey = rename(nextKey); | ||
| write(value, read(value, nextKey), newKey); | ||
| remove(value, nextKey); | ||
| state.locations.push([...path, newKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Edits any text by replacing any string or substring that matches a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of the original text that were edited. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against text values | ||
| * @param text - The replacement text for matching values | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where text was replaced | ||
| * | ||
| * @example Replacing text in structure | ||
| * ```typescript | ||
| * const obj = { a: 'hello world', b: { c: 'hello' } } | ||
| * replaceText(obj, 'hello', 'hi') // [['a'], ['b', 'c']] | ||
| * ``` | ||
| */ | ||
| const replaceText = (target, pattern, text, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| if (typeof text !== 'string') | ||
| throw createError('Expected name to be a string.'); | ||
| const match = patternIsString ? (text) => text.includes(pattern) : (text) => pattern.test(text); | ||
| const replace = (original) => original.replace(pattern, text); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, read, write } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| const nextValue = read(value, nextKey); | ||
| if (getType(nextValue) !== 'string' || !match(nextValue)) | ||
| return; | ||
| write(value, replace(nextValue), nextKey); | ||
| state.locations.push([...path, nextKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /* eslint-disable @typescript-eslint/no-unused-vars */ | ||
| /** | ||
| * Recursively creates a selective copy of an object based on predicate conditions. | ||
| * | ||
| * @param target - The object to copy | ||
| * @param path - Current path in the object | ||
| * @param includeKey - Predicate to determine if a key should be included | ||
| * @param skipFunctions - Whether to skip function values | ||
| * @param recordSkip - Callback to record skipped data points | ||
| * @returns Partial copy of the target based on predicate | ||
| * | ||
| * @example Basic recursive copy | ||
| * ```typescript | ||
| * selectiveCopyRecursive(obj, [], () => true, false, () => {}) | ||
| * ``` | ||
| */ | ||
| const selectiveCopyRecursive = (target, path, includeKey, skipFunctions, recordSkip) => { | ||
@@ -709,3 +1191,2 @@ const type = getType(target); | ||
| const nextKey = keys[i]; | ||
| // Filter out __proto__ to prevent prototype pollution attacks | ||
| if (nextKey === '__proto__') | ||
@@ -737,2 +1218,7 @@ continue; | ||
| * @returns A partial clone of the target object | ||
| * | ||
| * @example Copying with circular reference handling | ||
| * ```typescript | ||
| * selectiveCopyForCircularReferencesRecursive(obj, [], () => true, false, () => {}, referenceStack(), [], true) | ||
| * ``` | ||
| */ | ||
@@ -751,3 +1237,2 @@ const selectiveCopyForCircularReferencesRecursive = (target, path, includeKey, skipFunctions, recordSkip, stack, circularRefs, root = false) => { | ||
| const nextKey = keys[i]; | ||
| // Filter out __proto__ to prevent prototype pollution attacks | ||
| if (nextKey === '__proto__') | ||
@@ -788,3 +1273,2 @@ continue; | ||
| } | ||
| // Set the circular reference | ||
| const lastKey = startPath[startPath.length - 1]; | ||
@@ -804,3 +1288,3 @@ /* istanbul ignore else -- __proto__ is already filtered during iteration, this is defensive */ | ||
| * This algorithm instead copies function references by default instead. For the same reason getters and setters are not replicate, only their | ||
| * return values. This algorithm can replicate circular references, when configured to do so. | ||
| * return values. This algorithm can replicate circular references, when configured. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
@@ -811,2 +1295,8 @@ * | ||
| * @returns An object containing the cloned value and array of skipped data points | ||
| * | ||
| * @example Selective copying with options | ||
| * ```typescript | ||
| * const { clone, skipped } = selectiveCopy({ a: 1, b: 2 }, { includeKeys: ['a'] }) | ||
| * // clone = { a: 1 }, skipped = [{ path: ['b'], ... }] | ||
| * ``` | ||
| */ | ||
@@ -857,376 +1347,2 @@ const selectiveCopy = (target, options) => { | ||
| const errorMessage = (thing, type) => `Expected ${thing} to be ${type}.`; | ||
| const nextIterationDetails = (path, key, value) => ({ | ||
| nextPath: [...path, key], | ||
| nextValue: value[key], | ||
| }); | ||
| const circularDependencyTraversal = (condition, callback, config, key, path, value, parent, state, stack, root = false) => { | ||
| if (stack.exists(value)) | ||
| return state; | ||
| const ok = condition(config, key, value, path, parent); | ||
| /* istanbul ignore next */ | ||
| if (config.exitEarly) | ||
| return state; | ||
| if (ok) | ||
| callback(key, value, path, state, parent); | ||
| stack.add(value); | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return state; | ||
| const keys = getKeysFromIterable(value, type); | ||
| keys.forEach((key) => { | ||
| const { nextPath, nextValue } = nextIterationDetails(path, key, value); | ||
| circularDependencyTraversal(condition, callback, config, key, nextPath, nextValue, value, state, stack); | ||
| }); | ||
| if (root) | ||
| stack.clear(); | ||
| return state; | ||
| }; | ||
| const nonCircularDependencyTraversal = (condition, callback, config, key, path, value, parent, state) => { | ||
| const ok = condition(config, key, value, path, parent); | ||
| /* istanbul ignore next */ | ||
| if (config.exitEarly) | ||
| return state; | ||
| if (ok) | ||
| callback(key, value, path, state, parent); | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return state; | ||
| const keys = getKeysFromIterable(value, type); | ||
| keys.forEach((key) => { | ||
| const { nextPath, nextValue } = nextIterationDetails(path, key, value); | ||
| nonCircularDependencyTraversal(condition, callback, config, key, nextPath, nextValue, value, state); | ||
| }); | ||
| return state; | ||
| }; | ||
| const traversal = (target, condition, callback, options, state) => { | ||
| if (typeof callback !== 'function') | ||
| throw createError(errorMessage('callback', 'a function')); | ||
| if (!(typeof options === 'object' && !isArray(options))) | ||
| throw createError(errorMessage('options', 'an object')); | ||
| if (!isArray(options.depth)) | ||
| throw createError(errorMessage('options.depth', 'an array')); | ||
| const [startDepth, maxDepth] = options.depth; | ||
| if (startDepth !== void 0 && typeof startDepth !== 'number') | ||
| throw createError(errorMessage('options.depth.0', 'a number')); | ||
| if (maxDepth !== void 0) { | ||
| const maxDepthType = typeof maxDepth; | ||
| if (!['number', 'string'].includes(maxDepthType)) | ||
| throw createError(errorMessage('options.depth.1', 'a number or a string')); | ||
| if (maxDepthType === 'string' && maxDepth !== '*') | ||
| throw createError("Only valid string value in options.depth.1 is '*'."); | ||
| } | ||
| const config = { | ||
| depth: freeze([options.depth[0] ?? 0, options.depth[1] ?? '*']), | ||
| exitEarly: false, | ||
| }; | ||
| const initialArgs = [condition, callback, config, '', [], target, void 0, state]; | ||
| if (getConfig().detectCircularReferences) | ||
| return circularDependencyTraversal(...initialArgs, referenceStack(), true); | ||
| return nonCircularDependencyTraversal(...initialArgs); | ||
| }; | ||
| /** | ||
| * A higher-order function that takes a single predicate function to generate an algorithm that traverses data points | ||
| * on a data structure. See traverse. | ||
| * | ||
| * @param condition - Predicate function to determine whether to traverse a data point | ||
| * @returns A traversal function configured with the condition | ||
| */ | ||
| const createTraversal = (condition) => (target, callback, options, state) => traversal(target, condition, callback, options ?? { depth: [0, '*'] }, state ?? {}); | ||
| const condition = (config, key, value, path) => !(path.length < config.depth[0] || config.depth[1] < path.length); | ||
| const traverseBetweenDepthRange = createTraversal(condition); | ||
| /** | ||
| * Invokes a callback function for every data point in the data structure of the target value to let you do read and write operations. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * | ||
| * @param target - The value to traverse | ||
| * @param callback - Function to invoke for each data point | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @param state - Optional state object to maintain across traversal callbacks | ||
| * @returns The state object after traversal completes | ||
| */ | ||
| const traverse = (target, callback, options, state) => traverseBetweenDepthRange(target, callback, options, state); | ||
| /** | ||
| * Gets the value at the specified path from the target. | ||
| * | ||
| * @param target - The target to get the value from. | ||
| * @param path - The path to the value. | ||
| * @param defaultValue - The default value to return if the path does not exist or an error occurs. | ||
| * @returns The value at the specified path or the default value. | ||
| * @throws {Error} Will throw an error if the path is not a non-empty array of strings and no default value for errors is provided. | ||
| * @remarks | ||
| * - If `defaultValue.onMissingKey` is provided, it will be returned when a key in the path is missing. | ||
| * - If `defaultValue.onError` is provided, it will be returned when any error occurs during the retrieval process. | ||
| */ | ||
| const getValue = (target, path, defaultValue) => { | ||
| if (isArray(path) === false) { | ||
| throw createError('Expected path to be a non-empty array of strings.'); | ||
| } | ||
| if (path.length === 0) | ||
| return target; | ||
| const hasOnMissingKeyDefault = !!(defaultValue && 'onMissingKey' in defaultValue); | ||
| const hasOnErrorDefault = !!(defaultValue && 'onError' in defaultValue); | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| let scope; | ||
| let scopeType; | ||
| let scopeIterable; | ||
| let scopeOperators; | ||
| try { | ||
| scope = target; | ||
| for (let index = 0; index < path.length; index += 1) { | ||
| const key = path[index]; | ||
| if (typeof key !== 'string') { | ||
| throw createError(`Expected path[${index}] to be a string, got ${typeof key}.`); | ||
| } | ||
| scopeType = getType(scope); | ||
| scopeIterable = isIterableType(scopeType); | ||
| /* instanbul ignore next */ | ||
| if (!scopeIterable && hasOnMissingKeyDefault) { | ||
| scope = defaultValue.onMissingKey; | ||
| break; | ||
| } | ||
| scopeOperators = getIterableOperators(scopeType); | ||
| if (scopeIterable && !scopeOperators.getKeys(scope).includes(key) && hasOnMissingKeyDefault) { | ||
| scope = defaultValue.onMissingKey; | ||
| break; | ||
| } | ||
| scope = scopeOperators.read(scope, key); | ||
| } | ||
| } | ||
| catch (error) { | ||
| if (hasOnErrorDefault) { | ||
| scope = defaultValue.onError; | ||
| } | ||
| else { | ||
| throw error; | ||
| } | ||
| } | ||
| return scope; | ||
| }; | ||
| /** | ||
| * Returns the total depth of a value's data structure, | ||
| * and returns a list of locations that are the most deeply nested. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to analyze for depth | ||
| * @returns A tuple containing the maximum depth and an array of paths to the deepest locations | ||
| */ | ||
| const getDepth = (target) => { | ||
| const trackDepth = (key, value, path, state) => { | ||
| if (state.depth < path.length) { | ||
| state.depth = path.length; | ||
| state.locations = [path]; | ||
| return; | ||
| } | ||
| if (state.depth === path.length) { | ||
| state.locations.push(path); | ||
| } | ||
| }; | ||
| const options = { depth: [0, '*'] }; | ||
| const state = { depth: 0, locations: [] }; | ||
| const { depth, locations } = traverse(target, trackDepth, options, state); | ||
| return [depth, locations]; | ||
| }; | ||
| /** | ||
| * Returns a list of locations where the key name matches a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against key names | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where the key pattern was found | ||
| */ | ||
| const locateKey = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => match(nextKey) && state.locations.push([...path, nextKey])); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Safe copies of Set built-in via factory function. | ||
| * | ||
| * Since constructors cannot be safely captured via Object.assign, this module | ||
| * provides a factory function that uses Reflect.construct internally. | ||
| * | ||
| * These references are captured at module initialization time to protect against | ||
| * prototype pollution attacks. Import only what you need for tree-shaking. | ||
| * | ||
| * @module @hyperfrontend/immutable-api-utils/built-in-copy/set | ||
| */ | ||
| // Capture references at module initialization time | ||
| const _Set = globalThis.Set; | ||
| const _Reflect = globalThis.Reflect; | ||
| /** | ||
| * (Safe copy) Creates a new Set using the captured Set constructor. | ||
| * Use this instead of `new Set()`. | ||
| * | ||
| * @param iterable - Optional iterable of values. | ||
| * @returns A new Set instance. | ||
| */ | ||
| const createSet = (iterable) => _Reflect.construct(_Set, iterable ? [iterable] : []); | ||
| /** | ||
| * Returns a list of unique key names that match a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against key names (defaults to matching all keys) | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of unique key names that match the pattern | ||
| */ | ||
| const getUniqueKeys = (target, pattern = /.+/, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => match(nextKey) && state.names.add(nextKey)); | ||
| }; | ||
| return from(traverse(target, callback, { depth: [0, '*'], ...options }, { | ||
| names: createSet(), | ||
| }).names.values()); | ||
| }; | ||
| /** | ||
| * Returns a list of locations where a text value matches a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against text values | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where the text pattern was found | ||
| */ | ||
| const locateText = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (text) => text === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => getType(value) === 'string' && match(value) && state.locations.push(path); | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Renames any key names that match a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of keys that were edited. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against key names | ||
| * @param name - The new name to assign to matching keys | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where keys were renamed | ||
| */ | ||
| const renameKey = (target, pattern, name, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| if (typeof name !== 'string') | ||
| throw createError('Expected name to be a string.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const rename = patternIsString ? () => name : (key) => key.replace(pattern, name); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, read, write, remove } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| if (!match(nextKey)) | ||
| return; | ||
| const newKey = rename(nextKey); | ||
| write(value, read(value, nextKey), newKey); | ||
| remove(value, nextKey); | ||
| state.locations.push([...path, newKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Removes any key names that match a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of keys that were removed. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against key names for removal | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where keys were removed | ||
| */ | ||
| const removeKey = (target, pattern, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| const match = patternIsString ? (key) => key === pattern : (key) => pattern.test(key); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, remove } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| if (!match(nextKey)) | ||
| return; | ||
| remove(value, nextKey); | ||
| state.locations.push([...path, nextKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| /** | ||
| * Edits any text by replacing any string or substring that matches a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of the original text that were edited. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against text values | ||
| * @param text - The replacement text for matching values | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where text was replaced | ||
| */ | ||
| const replaceText = (target, pattern, text, options) => { | ||
| const patternIsString = typeof pattern === 'string'; | ||
| if (!patternIsString && !(pattern instanceof RegExp)) | ||
| throw createError('Expected pattern to be either a string of a regular expression.'); | ||
| if (typeof text !== 'string') | ||
| throw createError('Expected name to be a string.'); | ||
| const match = patternIsString ? (text) => text.includes(pattern) : (text) => pattern.test(text); | ||
| const replace = (original) => original.replace(pattern, text); | ||
| const callback = (key, value, path, state) => { | ||
| const type = getType(value); | ||
| if (!isIterableType(type)) | ||
| return; | ||
| const { getKeys, read, write } = getIterableOperators(type); | ||
| getKeys(value).forEach((nextKey) => { | ||
| const nextValue = read(value, nextKey); | ||
| if (getType(nextValue) !== 'string' || !match(nextValue)) | ||
| return; | ||
| write(value, replace(nextValue), nextKey); | ||
| state.locations.push([...path, nextKey]); | ||
| }); | ||
| }; | ||
| return traverse(target, callback, { depth: [0, '*'], ...options }, { locations: [] }).locations; | ||
| }; | ||
| export { CircularReference, containsKeys, createTraversal, deregisterClassTypes, deregisterIterableClass, getConfig, getDepth, getIterableOperators, getIterableTypes, getKeysFromIterable, getType, getUniqueKeys, getValue, hasCircularReference, isIdentical, isIterable, isIterableType, isMarker, locateCircularReference, locateCircularReferenceRecursive, locateKey, locateText, marker, referenceStack, registerClassTypes, registerIterableClass, registeredClasses, registeredIterableClasses, removeKey, renameKey, replaceText, sameStructure, sameType, selectiveCopy, selectiveCopyForCircularReferencesRecursive, selectiveCopyRecursive, setConfig, traverse }; | ||
| //# sourceMappingURL=index.esm.js.map |
+13
-7
| { | ||
| "name": "@hyperfrontend/data-utils", | ||
| "version": "0.0.4", | ||
| "version": "0.0.5", | ||
| "description": "Data manipulation and transformation utilities.", | ||
@@ -17,6 +17,2 @@ "license": "MIT", | ||
| "require": "./index.cjs.js" | ||
| }, | ||
| "./bundle": { | ||
| "import": "./bundle/index.iife.min.js", | ||
| "require": "./bundle/index.iife.min.js" | ||
| } | ||
@@ -62,3 +58,13 @@ }, | ||
| "unpkg": "./bundle/index.umd.min.js", | ||
| "jsdelivr": "./bundle/index.umd.min.js" | ||
| } | ||
| "jsdelivr": "./bundle/index.umd.min.js", | ||
| "files": [ | ||
| "**/index.*", | ||
| "**/index.d.ts", | ||
| "CHANGELOG.md", | ||
| "FUNDING.md", | ||
| "LICENSE.md", | ||
| "README.md", | ||
| "SECURITY.md", | ||
| "!**/*.js.map" | ||
| ] | ||
| } |
+3
-1
@@ -38,2 +38,4 @@ # @hyperfrontend/data-utils | ||
| • 👉 See [**documentation**](https://www.hyperfrontend.dev/docs/libraries/utils/data/) | ||
| ## What is @hyperfrontend/data-utils? | ||
@@ -354,2 +356,2 @@ | ||
| MIT | ||
| [MIT](https://github.com/AndrewRedican/hyperfrontend/blob/main/LICENSE.md) |
| {"version":3,"file":"index.iife.js","sources":["../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/object/index.ts","../../../../../../../../../../libs/utils/data/src/is-marker.ts","../../../../../../../../../../libs/utils/data/src/shared/consts.ts","../../../../../../../../../../libs/utils/data/src/register-class-types.ts","../../../../../../../../../../libs/utils/data/src/register-iterable-class.ts","../../../../../../../../../../libs/utils/data/src/deregister-class-types.ts","../../../../../../../../../../libs/utils/data/src/deregister-iterable-class.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/array/index.ts","../../../../../../../../../../libs/utils/data/src/get-type.ts","../../../../../../../../../../libs/utils/data/src/same-type.ts","../../../../../../../../../../libs/utils/data/src/get-keys-from-iterable.ts","../../../../../../../../../../libs/utils/data/src/get-iterable-types.ts","../../../../../../../../../../libs/utils/data/src/is-iterable-type.ts","../../../../../../../../../../libs/utils/data/src/same-structure.ts","../../../../../../../../../../libs/utils/data/src/is-iterable.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/error/index.ts","../../../../../../../../../../libs/utils/data/src/circular-reference.ts","../../../../../../../../../../libs/utils/data/src/get-iterable-operators.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/map/index.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/date/index.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/math/index.ts","../../../../../../../../../../libs/utils/data/src/marker.ts","../../../../../../../../../../libs/utils/data/src/reference-stack.ts","../../../../../../../../../../libs/utils/data/src/has-circular-reference.ts","../../../../../../../../../../libs/utils/data/src/locate-circular-reference.ts","../../../../../../../../../../libs/utils/data/src/is-identical.ts","../../../../../../../../../../libs/utils/data/src/contains-keys.ts","../../../../../../../../../../libs/utils/data/src/selective-copy.ts","../../../../../../../../../../libs/utils/data/src/traverse.ts","../../../../../../../../../../libs/utils/data/src/get-value.ts","../../../../../../../../../../libs/utils/data/src/get-depth.ts","../../../../../../../../../../libs/utils/data/src/locate-key.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/set/index.ts","../../../../../../../../../../libs/utils/data/src/get-unique-keys.ts","../../../../../../../../../../libs/utils/data/src/locate-text.ts","../../../../../../../../../../libs/utils/data/src/rename-key.ts","../../../../../../../../../../libs/utils/data/src/remove-key.ts","../../../../../../../../../../libs/utils/data/src/replace-text.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["_Reflect"],"mappings":";;;IAAA;;;;;;;IAOG;IAEH;IACA,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM;IAMjC;;;IAGG;IACI,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM;IAOpC;;IAEG;IACI,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI;;AC9BzB,UAAM,QAAQ,GAAG,CAAC,IAAY,KAAa;QAChD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;I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AAA,MAAM,OAAO,GAAG,CAAC,QAAgB,KAAK,QAAQ,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC;QACrE,MAAM,QAAQ,GAAa,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,KAAI;IACrD,QAAA,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC;IAC3B,QAAA,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC;gBAAE;IAC3B,QAAA,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,oBAAoB,CAAC,IAAI,CAAC;YAC3D,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,KAAI;gBACjC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC;gBACtC,IAAI,OAAO,CAAC,SAAS,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAS,SAAS,CAAC;oBAAE;gBAClE,KAAK,CAAC,KAAK,EAAE,OAAO,CAAS,SAAS,CAAC,EAAE,OAAO,CAAC;IACjD,YAAA,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1C,QAAA,CAAC,CAAC;IACJ,IAAA,CAAC;QACD,OAAO,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAe,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,SAAS;IAC9G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} |
| {"version":3,"file":"index.iife.min.js","sources":["../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/object/index.ts","../../../../../../../../../../libs/utils/data/src/is-marker.ts","../../../../../../../../../../libs/utils/data/src/shared/consts.ts","../../../../../../../../../../libs/utils/data/src/register-class-types.ts","../../../../../../../../../../libs/utils/data/src/deregister-class-types.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/array/index.ts","../../../../../../../../../../libs/utils/data/src/get-type.ts","../../../../../../../../../../libs/utils/data/src/same-type.ts","../../../../../../../../../../libs/utils/data/src/get-keys-from-iterable.ts","../../../../../../../../../../libs/utils/data/src/get-iterable-types.ts","../../../../../../../../../../libs/utils/data/src/is-iterable-type.ts","../../../../../../../../../../libs/utils/data/src/same-structure.ts","../../../../../../../../../../libs/utils/data/src/is-iterable.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/error/index.ts","../../../../../../../../../../libs/utils/data/src/circular-reference.ts","../../../../../../../../../../libs/utils/data/src/get-iterable-operators.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/map/index.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/date/index.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/math/index.ts","../../../../../../../../../../libs/utils/data/src/marker.ts","../../../../../../../../../../libs/utils/data/src/reference-stack.ts","../../../../../../../../../../libs/utils/data/src/has-circular-reference.ts","../../../../../../../../../../libs/utils/data/src/locate-circular-reference.ts","../../../../../../../../../../libs/utils/data/src/is-identical.ts","../../../../../../../../../../libs/utils/data/src/selective-copy.ts","../../../../../../../../../../libs/utils/data/src/traverse.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/set/index.ts","../../../../../../../../../../libs/utils/data/src/contains-keys.ts","../../../../../../../../../../libs/utils/data/src/deregister-iterable-class.ts","../../../../../../../../../../libs/utils/data/src/get-depth.ts","../../../../../../../../../../libs/utils/data/src/get-unique-keys.ts","../../../../../../../../../../libs/utils/data/src/get-value.ts","../../../../../../../../../../libs/utils/data/src/locate-key.ts","../../../../../../../../../../libs/utils/data/src/locate-text.ts","../../../../../../../../../../libs/utils/data/src/register-iterable-class.ts","../../../../../../../../../../libs/utils/data/src/remove-key.ts","../../../../../../../../../../libs/utils/data/src/rename-key.ts","../../../../../../../../../../libs/utils/data/src/replace-text.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["_Object","globalThis","Object","freeze","keys","isMarker","text","startsWith","test","registeredClasses","registeredIterableClasses","classRef","Array","instantiate","getKeys","target","keysArray","getConfig","detectCircularReferences","filter","key","read","write","value","remove","splice","samePositionOfOwnProperties","setConfig","config","registerClassTypes","classRefs","forEach","includes","push","deregisterClassTypes","length","shift","indexes","map","indexOf","index","sort","pop","_Array","isArray","from","getType","nativeDataType","registeredClass","name","sameType","targetA","targetB","firstType","getKeysFromIterable","dataType","iterableClass","find","undefined","getIterableTypes","isIterableType","sameStructure","typeMatch","aKeys","bKeys","aKeyCount","i","isIterable","_Error","Error","_Reflect","Reflect","createError","message","options","construct","CircularReference","location","keyDelimiter","delimiter","constructor","this","path","depth","toString","join","toJSON","getIterableOperators","e","toLowerCase","_Map","Map","_Date","Date","_Math","Math","round","random","marker","args","createDate","getTime","referenceStack","records","iterable","flag","exists","ref","has","add","Symbol","set","size","lastSeen","record","get","clear","hasCircularReferenceRecursive","stack","root","type","result","some","invalidmaxResults","locateCircularReferenceRecursive","maxResults","slice","isIdenticalRecursive","keyCount","noop","isIdenticalForCircularReferencesRecursive","stacks","registerRefs","every","s","allStackEmpty","clearStacks","nextA","nextB","aHasCircularRef","selectiveCopyRecursive","includeKey","skipFunctions","recordSkip","iterableInstance","nextKey","nextTarget","nextPath","concat","nextType","selectiveCopyForCircularReferencesRecursive","circularRefs","startPath","destinationPath","start","destination","j","lastKey","errorMessage","thing","nextIterationDetails","nextValue","circularDependencyTraversal","condition","callback","parent","state","ok","exitEarly","nonCircularDependencyTraversal","createTraversal","startDepth","maxDepth","maxDepthType","initialArgs","traversal","traverseBetweenDepthRange","traverse","_Set","Set","targetKeys","k","findIndex","entry","locations","pattern","patternIsString","RegExp","match","names","values","defaultValue","hasOnMissingKeyDefault","hasOnErrorDefault","scope","scopeType","scopeIterable","scopeOperators","onMissingKey","error","onError","originalSupportStatus","targets","resultsType","NaN","Infinity","existingEntryLocation","unshift","rename","replace","newKey","found","included","includeKeys","excludeKeys","include","exclude","skipped","clone"],"mappings":"oDAUA,MAAMA,EAAUC,WAAWC,OAUdC,EAASH,EAAQG,OAUjBC,EAAOJ,EAAQI,KC9BfC,EAAYC,KACH,iBAATA,IAAsBA,EAAKC,WAAW,SAC1C,eAAeC,KAAKF,GCEhBG,EAAoC,GAEpCC,EAA4D,CACvE,CACEC,SAAUC,MACVC,YAAa,IAAM,GACnBC,QAAUC,IACR,MAAMC,EAAYZ,EAAuBW,GACzC,OAAIE,IAAYC,yBACPF,EAAUG,OAAQC,IAASf,EAASe,IAEtCJ,GAETK,KAAM,CAACN,EAAQK,IAAyBL,EAAgBK,GACxDE,MAAO,CAACP,EAAQQ,EAAOH,IAA0BL,EAAgBK,GAAOG,EACxEC,OAAQ,CAACT,EAAQQ,IAA2BR,EAAQU,OAAeF,EAAO,IAE5E,CACEZ,SAAUT,OACVW,YAAa,KAAA,CAAS,GACtBC,QAAUC,IACR,MAAMC,EAAYZ,EAAuBW,GACzC,OAAIE,IAAYC,yBACPF,EAAUG,OAAQC,IAASf,EAASe,IAEtCJ,GAETK,KAAM,CAACN,EAAQK,IAAkCL,EAAgBK,GACjEE,MAAO,CAACP,EAAQQ,EAAOH,IAAmCL,EAAgBK,GAAOG,EACjFC,OAAQ,CAACT,EAAQQ,WAA2CR,EAAgBQ,KAIhF,IAAIG,GAA8B,EAE9BR,GAA2B,EAOxB,MAAMS,EAAaC,IACxBF,EACgD,kBAAvCE,EAAOF,4BAA4CE,EAAOF,4BAA8BA,IAA+B,EAChIR,EAC6C,kBAApCU,EAAOV,yBAAyCU,EAAOV,yBAA2BA,IAA4B,GAQ5GD,EAAY,KAAA,CACvBS,8BACAR,6BCnDWW,EAAqB,IAAIC,IACpCA,EAAUC,QAASpB,IAAcF,EAAkBuB,SAASrB,IAAaF,EAAkB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,QAAOD"} |
| {"version":3,"file":"index.umd.js","sources":["../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/object/index.ts","../../../../../../../../../../libs/utils/data/src/is-marker.ts","../../../../../../../../../../libs/utils/data/src/shared/consts.ts","../../../../../../../../../../libs/utils/data/src/register-class-types.ts","../../../../../../../../../../libs/utils/data/src/register-iterable-class.ts","../../../../../../../../../../libs/utils/data/src/deregister-class-types.ts","../../../../../../../../../../libs/utils/data/src/deregister-iterable-class.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/array/index.ts","../../../../../../../../../../libs/utils/data/src/get-type.ts","../../../../../../../../../../libs/utils/data/src/same-type.ts","../../../../../../../../../../libs/utils/data/src/get-keys-from-iterable.ts","../../../../../../../../../../libs/utils/data/src/get-iterable-types.ts","../../../../../../../../../../libs/utils/data/src/is-iterable-type.ts","../../../../../../../../../../libs/utils/data/src/same-structure.ts","../../../../../../../../../../libs/utils/data/src/is-iterable.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/error/index.ts","../../../../../../../../../../libs/utils/data/src/circular-reference.ts","../../../../../../../../../../libs/utils/data/src/get-iterable-operators.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/map/index.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/date/index.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/math/index.ts","../../../../../../../../../../libs/utils/data/src/marker.ts","../../../../../../../../../../libs/utils/data/src/reference-stack.ts","../../../../../../../../../../libs/utils/data/src/has-circular-reference.ts","../../../../../../../../../../libs/utils/data/src/locate-circular-reference.ts","../../../../../../../../../../libs/utils/data/src/is-identical.ts","../../../../../../../../../../libs/utils/data/src/contains-keys.ts","../../../../../../../../../../libs/utils/data/src/selective-copy.ts","../../../../../../../../../../libs/utils/data/src/traverse.ts","../../../../../../../../../../libs/utils/data/src/get-value.ts","../../../../../../../../../../libs/utils/data/src/get-depth.ts","../../../../../../../../../../libs/utils/data/src/locate-key.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/set/index.ts","../../../../../../../../../../libs/utils/data/src/get-unique-keys.ts","../../../../../../../../../../libs/utils/data/src/locate-text.ts","../../../../../../../../../../libs/utils/data/src/rename-key.ts","../../../../../../../../../../libs/utils/data/src/remove-key.ts","../../../../../../../../../../libs/utils/data/src/replace-text.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["_Reflect"],"mappings":";;;;;;IAAA;;;;;;;IAOG;IAEH;IACA,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM;IAMjC;;;IAGG;IACI,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM;IAOpC;;IAEG;IACI,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI;;AC9BzB,UAAM,QAAQ,GAAG,CAAC,IAAY,KAAa;QAChD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;IAAE,QAAA,OAAO,KAAK;IACrE,IAAA,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC;IAClC;;ACCO,UAAM,iBAAiB,GAAmB;AAE1C,UAAM,yBAAyB,GAAmC;IACvE,IAAA;IACE,QAAA,QAAQ,EAAE,KAAK;IACf,QAAA,WAAW,EAAE,MAAM,EAAE;IACrB,QAAA,OAAO,EAAE,CAAC,MAAe,KAAI;IAC3B,YAAA,MAAM,SAAS,GAAG,IAAI,CAAmB,MAAM,CAAC;IAChD,YAAA,IAAI,SAAS,EAAE,CAAC,wBAAwB,EAAE;IACxC,gBAAA,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;gBAClD;IACA,YAAA,OAAO,SAAS;YAClB,CAAC;YACD,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,KAAsB,MAAO,CAAS,GAAG,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AAS,SAAS,CAAC;oBAAE;gBAClE,KAAK,CAAC,KAAK,EAAE,OAAO,CAAS,SAAS,CAAC,EAAE,OAAO,CAAC;IACjD,YAAA,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC;IAC1C,QAAA,CAAC,CAAC;IACJ,IAAA,CAAC;QACD,OAAO,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAe,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,SAAS;IAC9G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} |
| {"version":3,"file":"index.umd.min.js","sources":["../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/object/index.ts","../../../../../../../../../../libs/utils/data/src/is-marker.ts","../../../../../../../../../../libs/utils/data/src/shared/consts.ts","../../../../../../../../../../libs/utils/data/src/register-class-types.ts","../../../../../../../../../../libs/utils/data/src/deregister-class-types.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/array/index.ts","../../../../../../../../../../libs/utils/data/src/get-type.ts","../../../../../../../../../../libs/utils/data/src/same-type.ts","../../../../../../../../../../libs/utils/data/src/get-keys-from-iterable.ts","../../../../../../../../../../libs/utils/data/src/get-iterable-types.ts","../../../../../../../../../../libs/utils/data/src/is-iterable-type.ts","../../../../../../../../../../libs/utils/data/src/same-structure.ts","../../../../../../../../../../libs/utils/data/src/is-iterable.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/error/index.ts","../../../../../../../../../../libs/utils/data/src/circular-reference.ts","../../../../../../../../../../libs/utils/data/src/get-iterable-operators.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/map/index.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/date/index.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/math/index.ts","../../../../../../../../../../libs/utils/data/src/marker.ts","../../../../../../../../../../libs/utils/data/src/reference-stack.ts","../../../../../../../../../../libs/utils/data/src/has-circular-reference.ts","../../../../../../../../../../libs/utils/data/src/locate-circular-reference.ts","../../../../../../../../../../libs/utils/data/src/is-identical.ts","../../../../../../../../../../libs/utils/data/src/selective-copy.ts","../../../../../../../../../../libs/utils/data/src/traverse.ts","../../../../../../../../../../libs/utils/immutable-api/src/built-in-copy/set/index.ts","../../../../../../../../../../libs/utils/data/src/contains-keys.ts","../../../../../../../../../../libs/utils/data/src/deregister-iterable-class.ts","../../../../../../../../../../libs/utils/data/src/get-depth.ts","../../../../../../../../../../libs/utils/data/src/get-unique-keys.ts","../../../../../../../../../../libs/utils/data/src/get-value.ts","../../../../../../../../../../libs/utils/data/src/locate-key.ts","../../../../../../../../../../libs/utils/data/src/locate-text.ts","../../../../../../../../../../libs/utils/data/src/register-iterable-class.ts","../../../../../../../../../../libs/utils/data/src/remove-key.ts","../../../../../../../../../../libs/utils/data/src/rename-key.ts","../../../../../../../../../../libs/utils/data/src/replace-text.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["_Object","globalThis","Object","freeze","keys","isMarker","text","startsWith","test","registeredClasses","registeredIterableClasses","classRef","Array","instantiate","getKeys","target","keysArray","getConfig","detectCircularReferences","filter","key","read","write","value","remove","splice","samePositionOfOwnProperties","setConfig","config","registerClassTypes","classRefs","forEach","includes","push","deregisterClassTypes","length","shift","indexes","map","indexOf","index","sort","pop","_Array","isArray","from","getType","nativeDataType","registeredClass","name","sameType","targetA","targetB","firstType","getKeysFromIterable","dataType","iterableClass","find","undefined","getIterableTypes","isIterableType","sameStructure","typeMatch","aKeys","bKeys","aKeyCount","i","isIterable","_Error","Error","_Reflect","Reflect","createError","message","options","construct","CircularReference","location","keyDelimiter","delimiter","constructor","this","path","depth","toString","join","toJSON","getIterableOperators","e","toLowerCase","_Map","Map","_Date","Date","_Math","Math","round","random","marker","args","createDate","getTime","referenceStack","records","iterable","flag","exists","ref","has","add","Symbol","set","size","lastSeen","record","get","clear","hasCircularReferenceRecursive","stack","root","type","result","some","invalidmaxResults","locateCircularReferenceRecursive","maxResults","slice","isIdenticalRecursive","keyCount","noop","isIdenticalForCircularReferencesRecursive","stacks","registerRefs","every","s","allStackEmpty","clearStacks","nextA","nextB","aHasCircularRef","selectiveCopyRecursive","includeKey","skipFunctions","recordSkip","iterableInstance","nextKey","nextTarget","nextPath","concat","nextType","selectiveCopyForCircularReferencesRecursive","circularRefs","startPath","destinationPath","start","destination","j","lastKey","errorMessage","thing","nextIterationDetails","nextValue","circularDependencyTraversal","condition","callback","parent","state","ok","exitEarly","nonCircularDependencyTraversal","createTraversal","startDepth","maxDepth","maxDepthType","initialArgs","traversal","traverseBetweenDepthRange","traverse","_Set","Set","targetKeys","k","findIndex","entry","locations","pattern","patternIsString","RegExp","match","names","values","defaultValue","hasOnMissingKeyDefault","hasOnErrorDefault","scope","scopeType","scopeIterable","scopeOperators","onMissingKey","error","onError","originalSupportStatus","targets","resultsType","NaN","Infinity","existingEntryLocation","unshift","rename","replace","newKey","found","included","includeKeys","excludeKeys","include","exclude","skipped","clone"],"mappings":"6PAUA,MAAMA,EAAUC,WAAWC,OAUdC,EAASH,EAAQG,OAUjBC,EAAOJ,EAAQI,KC9BfC,EAAYC,KACH,iBAATA,IAAsBA,EAAKC,WAAW,SAC1C,eAAeC,KAAKF,GCEhBG,EAAoC,GAEpCC,EAA4D,CACvE,CACEC,SAAUC,MACVC,YAAa,IAAM,GACnBC,QAAUC,IACR,MAAMC,EAAYZ,EAAuBW,GACzC,OAAIE,IAAYC,yBACPF,EAAUG,OAAQC,IAASf,EAASe,IAEtCJ,GAETK,KAAM,CAACN,EAAQK,IAAyBL,EAAgBK,GACxDE,MAAO,CAACP,EAAQQ,EAAOH,IAA0BL,EAAgBK,GAAOG,EACxEC,O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,GACN,IAAK,cACHtE,EAAa,CAAC9H,EAAQmE,EAAM9D,EAAKmC,IAA8B,IAAhB2B,EAAK/C,QAAekL,EAAYrL,SAAiBZ,GAChG,MACF,IAAK,cACHyH,EAAa,CAAC9H,EAAQmE,EAAM9D,EAAKmC,IAA8B,IAAhB2B,EAAK/C,SAAgBmL,EAAYtL,SAAiBZ,GACjG,MACF,IAAK,UACHyH,EAAa0E,EACb,MACF,IAAK,UACH1E,EAAa,CAAC9H,EAAQmE,EAAM9D,EAAKmC,KAAciK,EAAQzM,EAAQmE,EAAM9D,EAAKmC,GAG9E,MAAMkK,EAAuB,GACvB1E,EAAiC,CAAChI,EAAQmE,EAAM9D,EAAKmC,IAAakK,EAAQxL,KAAK,CAAElB,SAAQmE,OAAM9D,MAAKmC,aAC1G,IAAImK,EAiBJ,OAfEA,EADEzM,IAAYC,yBAEZoI,EAC2BvI,EACzB,GACA8H,EACAC,EACAC,EACAzC,IACA,IACA,GAIOsC,EAAgD7H,EAAQ,GAAI8H,EAAYC,EAAeC,GAE7F,CAAE2E,QAAOD"} |
| export interface Location { | ||
| path: [string, ...string[]]; | ||
| } | ||
| export interface Target { | ||
| path: string[]; | ||
| } | ||
| export interface ICircularReference { | ||
| readonly location: Location; | ||
| readonly target: Target; | ||
| readonly depth: number; | ||
| } | ||
| export declare class CircularReference implements ICircularReference { | ||
| readonly location: Location; | ||
| readonly target: Target; | ||
| readonly keyDelimiter = "\u00B7"; | ||
| private readonly delimiter; | ||
| constructor(location: Location['path'], target: Target['path']); | ||
| get depth(): number; | ||
| readonly toString: () => string; | ||
| readonly toJSON: () => string; | ||
| private readonly join; | ||
| } | ||
| //# sourceMappingURL=circular-reference.d.ts.map |
| {"version":3,"file":"circular-reference.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/circular-reference.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAA;CAC5B;AAED,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,EAAE,CAAA;CACf;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAA;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED,qBAAa,iBAAkB,YAAW,kBAAkB;IAC1D,SAAgB,QAAQ,EAAE,QAAQ,CAAA;IAClC,SAAgB,MAAM,EAAE,MAAM,CAAA;IAC9B,SAAgB,YAAY,YAAW;IACvC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAa;gBAE3B,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC;IAW9D,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,SAAgB,QAAQ,QAAO,MAAM,CAA2E;IAEhH,SAAgB,MAAM,QAAO,MAAM,CAAmB;IAEtD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAwE;CAC9F"} |
| /** | ||
| * Checks if the target contains all specified keys. | ||
| * | ||
| * @param target - The target to check. | ||
| * @param keys - The keys to check for. | ||
| * @returns True if the target contains all specified keys, false otherwise. | ||
| * @remarks | ||
| * Works with objects, arrays, and registered iterable classes. | ||
| * An empty keys array will always return `false`. | ||
| */ | ||
| export declare const containsKeys: (target: unknown, keys: string[]) => boolean; | ||
| //# sourceMappingURL=contains-keys.d.ts.map |
| {"version":3,"file":"contains-keys.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/contains-keys.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,GAAI,QAAQ,OAAO,EAAE,MAAM,MAAM,EAAE,KAAG,OAM9D,CAAA"} |
| import type { UnknownClass } from './models'; | ||
| /** | ||
| * Removes one or more registered classes used to identify values as distinct data types. | ||
| * | ||
| * @param classRefs - One or more class references to deregister. If none provided, all registered classes will be deregistered. | ||
| */ | ||
| export declare const deregisterClassTypes: (...classRefs: UnknownClass<unknown>[]) => void; | ||
| //# sourceMappingURL=deregister-class-types.d.ts.map |
| {"version":3,"file":"deregister-class-types.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/deregister-class-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAG5C;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,GAAG,WAAW,YAAY,CAAC,OAAO,CAAC,EAAE,KAAG,IAa5E,CAAA"} |
| import type { UnknownClass } from './models'; | ||
| /** | ||
| * Removes one or more registered iterable classes. | ||
| * Removes all registered iterable classes except built-ins (Array and Object) when no references are provided. | ||
| * | ||
| * @param classRefs - The class constructors to deregister | ||
| */ | ||
| export declare const deregisterIterableClass: <T = unknown>(...classRefs: UnknownClass<T>[]) => void; | ||
| //# sourceMappingURL=deregister-iterable-class.d.ts.map |
| {"version":3,"file":"deregister-iterable-class.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/deregister-iterable-class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAI5C;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,CAAC,GAAG,OAAO,EAAE,GAAG,WAAW,YAAY,CAAC,CAAC,CAAC,EAAE,KAAG,IAmBtF,CAAA"} |
| /** | ||
| * Returns the total depth of a value's data structure, | ||
| * and returns a list of locations that are the most deeply nested. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to analyze for depth | ||
| * @returns A tuple containing the maximum depth and an array of paths to the deepest locations | ||
| */ | ||
| export declare const getDepth: (target: unknown) => [number, string[][]]; | ||
| //# sourceMappingURL=get-depth.d.ts.map |
| {"version":3,"file":"get-depth.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/get-depth.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,GAAI,QAAQ,OAAO,KAAG,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,CAe7D,CAAA"} |
| import type { DataType, IterableOperators } from './models'; | ||
| export declare const getIterableOperators: <T extends string = DataType>(dataType: T) => IterableOperators; | ||
| //# sourceMappingURL=get-iterable-operators.d.ts.map |
| {"version":3,"file":"get-iterable-operators.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/get-iterable-operators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAgC,MAAM,UAAU,CAAA;AAGzF,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,MAAM,GAAG,QAAQ,EAAE,UAAU,CAAC,KAAG,iBAK/E,CAAA"} |
| import type { DataType } from './models'; | ||
| /** | ||
| * Returns a list of iterable data types. By default 'array' and 'object' are included., | ||
| * but can be extended by using `registerIterableClass`. | ||
| * | ||
| * @returns Array of iterable data types. | ||
| */ | ||
| export declare const getIterableTypes: <T extends string = DataType>() => T[]; | ||
| //# sourceMappingURL=get-iterable-types.d.ts.map |
| {"version":3,"file":"get-iterable-types.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/get-iterable-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAGxC;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAAI,CAAC,SAAS,MAAM,GAAG,QAAQ,OAAK,CAAC,EAM9D,CAAA"} |
| import type { DataType } from './models'; | ||
| /** | ||
| * Gets the keys from an iterable target based on its data type. | ||
| * | ||
| * @param target - The target to get the keys from. | ||
| * @param dataType - The data type of the target. | ||
| * @returns The keys from the iterable target. | ||
| */ | ||
| export declare const getKeysFromIterable: <T extends string = DataType>(target: unknown, dataType: T) => string[]; | ||
| //# sourceMappingURL=get-keys-from-iterable.d.ts.map |
| {"version":3,"file":"get-keys-from-iterable.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/get-keys-from-iterable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAGxC;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,MAAM,GAAG,QAAQ,EAAE,QAAQ,OAAO,EAAE,UAAU,CAAC,KAAG,MAAM,EAMrG,CAAA"} |
| import type { DataType } from './models'; | ||
| /** | ||
| * Returns the data type of the target. | ||
| * Uses native `typeof` operator, however, makes distinction between `null`, `array`, and `object`. | ||
| * Also, when classes are registered via `registerClass`, it checks if objects are instance of any known registered class. | ||
| * | ||
| * @param target - The target to get the data type of. | ||
| * @returns The data type of the target. | ||
| */ | ||
| export declare const getType: <T extends string = DataType>(target: unknown) => T; | ||
| //# sourceMappingURL=get-type.d.ts.map |
| {"version":3,"file":"get-type.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/get-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAIxC;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,GAAI,CAAC,SAAS,MAAM,GAAG,QAAQ,EAAE,QAAQ,OAAO,KAAG,CAUtE,CAAA"} |
| import type { DepthConfig } from './models'; | ||
| /** | ||
| * Returns a list of unique key names that match a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against key names (defaults to matching all keys) | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of unique key names that match the pattern | ||
| */ | ||
| export declare const getUniqueKeys: (target: unknown, pattern?: string | RegExp, options?: DepthConfig) => string[]; | ||
| //# sourceMappingURL=get-unique-keys.d.ts.map |
| {"version":3,"file":"get-unique-keys.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/get-unique-keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,WAAW,EAAE,MAAM,UAAU,CAAA;AASrD;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,OAAO,EAAE,UAAS,MAAM,GAAG,MAAa,EAAE,UAAU,WAAW,KAAG,MAAM,EAe7G,CAAA"} |
| import { DefaultValueOptions } from './get-value.model'; | ||
| /** | ||
| * Gets the value at the specified path from the target. | ||
| * | ||
| * @param target - The target to get the value from. | ||
| * @param path - The path to the value. | ||
| * @param defaultValue - The default value to return if the path does not exist or an error occurs. | ||
| * @returns The value at the specified path or the default value. | ||
| * @throws {Error} Will throw an error if the path is not a non-empty array of strings and no default value for errors is provided. | ||
| * @remarks | ||
| * - If `defaultValue.onMissingKey` is provided, it will be returned when a key in the path is missing. | ||
| * - If `defaultValue.onError` is provided, it will be returned when any error occurs during the retrieval process. | ||
| */ | ||
| export declare const getValue: <T = unknown>(target: unknown, path: [string, ...string[]], defaultValue?: DefaultValueOptions<T>) => T; | ||
| //# sourceMappingURL=get-value.d.ts.map |
| {"version":3,"file":"get-value.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/get-value.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AAGvD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,GAAG,OAAO,EAAE,QAAQ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,EAAE,eAAe,mBAAmB,CAAC,CAAC,CAAC,KAAG,CAyC3H,CAAA"} |
| /** | ||
| * Options for providing default values when retrieving data. | ||
| */ | ||
| export interface DefaultValueOptions<T = unknown> { | ||
| /** Default value to return when a key in the path is missing. */ | ||
| onMissingKey?: T; | ||
| /** Default value to return when an error occurs during retrieval. */ | ||
| onError?: T; | ||
| } | ||
| //# sourceMappingURL=get-value.model.d.ts.map |
| {"version":3,"file":"get-value.model.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/get-value.model.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,OAAO;IAC9C,iEAAiE;IACjE,YAAY,CAAC,EAAE,CAAC,CAAA;IAChB,qEAAqE;IACrE,OAAO,CAAC,EAAE,CAAC,CAAA;CACZ"} |
| /** | ||
| * Returns true for values that have circular references. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The value to check for circular references | ||
| * @returns True if the value contains circular references, false otherwise | ||
| */ | ||
| export declare const hasCircularReference: (target: unknown) => boolean; | ||
| //# sourceMappingURL=has-circular-reference.d.ts.map |
| {"version":3,"file":"has-circular-reference.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/has-circular-reference.ts"],"names":[],"mappings":"AAmBA;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,OAAO,KAAG,OAUtD,CAAA"} |
| {"version":3,"file":"index.cjs.js","sources":["../../../../../../../../libs/utils/immutable-api/src/built-in-copy/object/index.ts","../../../../../../../../libs/utils/data/src/is-marker.ts","../../../../../../../../libs/utils/data/src/shared/consts.ts","../../../../../../../../libs/utils/data/src/register-class-types.ts","../../../../../../../../libs/utils/data/src/register-iterable-class.ts","../../../../../../../../libs/utils/data/src/deregister-class-types.ts","../../../../../../../../libs/utils/data/src/deregister-iterable-class.ts","../../../../../../../../libs/utils/immutable-api/src/built-in-copy/array/index.ts","../../../../../../../../libs/utils/data/src/get-type.ts","../../../../../../../../libs/utils/data/src/same-type.ts","../../../../../../../../libs/utils/data/src/get-keys-from-iterable.ts","../../../../../../../../libs/utils/data/src/get-iterable-types.ts","../../../../../../../../libs/utils/data/src/is-iterable-type.ts","../../../../../../../../libs/utils/data/src/same-structure.ts","../../../../../../../../libs/utils/data/src/is-iterable.ts","../../../../../../../../libs/utils/immutable-api/src/built-in-copy/error/index.ts","../../../../../../../../libs/utils/data/src/circular-reference.ts","../../../../../../../../libs/utils/data/src/get-iterable-operators.ts","../../../../../../../../libs/utils/immutable-api/src/built-in-copy/map/index.ts","../../../../../../../../libs/utils/immutable-api/src/built-in-copy/date/index.ts","../../../../../../../../libs/utils/immutable-api/src/built-in-copy/math/index.ts","../../../../../../../../libs/utils/data/src/marker.ts","../../../../../../../../libs/utils/data/src/reference-stack.ts","../../../../../../../../libs/utils/data/src/has-circular-reference.ts","../../../../../../../../libs/utils/data/src/locate-circular-reference.ts","../../../../../../../../libs/utils/data/src/is-identical.ts","../../../../../../../../libs/utils/data/src/contains-keys.ts","../../../../../../../../libs/utils/data/src/selective-copy.ts","../../../../../../../../libs/utils/data/src/traverse.ts","../../../../../../../../libs/utils/data/src/get-value.ts","../../../../../../../../libs/utils/data/src/get-depth.ts","../../../../../../../../libs/utils/data/src/locate-key.ts","../../../../../../../../libs/utils/immutable-api/src/built-in-copy/set/index.ts","../../../../../../../../libs/utils/data/src/get-unique-keys.ts","../../../../../../../../libs/utils/data/src/locate-text.ts","../../../../../../../../libs/utils/data/src/rename-key.ts","../../../../../../../../libs/utils/data/src/remove-key.ts","../../../../../../../../libs/utils/data/src/replace-text.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["_Reflect"],"mappings":";;AAAA;;;;;;;AAOG;AAEH;AACA,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM;AAMjC;;;AAGG;AACI,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM;AAOpC;;AAEG;AACI,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI;;AC9BzB,MAAM,QAAQ,GAAG,CAAC,IAAY,KAAa;IAChD,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;AAAE,Q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AC,OAAO,EAAE,IAAI,CAAC;IACrE,MAAM,QAAQ,GAAa,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,KAAI;AACrD,QAAA,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC;AAC3B,QAAA,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC;YAAE;AAC3B,QAAA,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,oBAAoB,CAAC,IAAI,CAAC;QAC3D,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,KAAI;YACjC,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC;YACtC,IAAI,OAAO,CAAC,SAAS,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAS,SAAS,CAAC;gBAAE;YAClE,KAAK,CAAC,KAAK,EAAE,OAAO,CAAS,SAAS,CAAC,EAAE,OAAO,CAAC;AACjD,YAAA,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC,CAAC;AAC1C,QAAA,CAAC,CAAC;AACJ,IAAA,CAAC;IACD,OAAO,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAe,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,OAAO,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,SAAS;AAC9G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} |
| {"version":3,"file":"index.esm.js","sources":["../../../../../../../../libs/utils/immutable-api/src/built-in-copy/object/index.ts","../../../../../../../../libs/utils/data/src/is-marker.ts","../../../../../../../../libs/utils/data/src/shared/consts.ts","../../../../../../../../libs/utils/data/src/register-class-types.ts","../../../../../../../../libs/utils/data/src/register-iterable-class.ts","../../../../../../../../libs/utils/data/src/deregister-class-types.ts","../../../../../../../../libs/utils/data/src/deregister-iterable-class.ts","../../../../../../../../libs/utils/immutable-api/src/built-in-copy/array/index.ts","../../../../../../../../libs/utils/data/src/get-type.ts","../../../../../../../../libs/utils/data/src/same-type.ts","../../../../../../../../libs/utils/data/src/get-keys-from-iterable.ts","../../../../../../../../libs/utils/data/src/get-iterable-types.ts","../../../../../../../../libs/utils/data/src/is-iterable-type.ts","../../../../../../../../libs/utils/data/src/same-structure.ts","../../../../../../../../libs/utils/data/src/is-iterable.ts","../../../../../../../../libs/utils/immutable-api/src/built-in-copy/error/index.ts","../../../../../../../../libs/utils/data/src/circular-reference.ts","../../../../../../../../libs/utils/data/src/get-iterable-operators.ts","../../../../../../../../libs/utils/immutable-api/src/built-in-copy/map/index.ts","../../../../../../../../libs/utils/immutable-api/src/built-in-copy/date/index.ts","../../../../../../../../libs/utils/immutable-api/src/built-in-copy/math/index.ts","../../../../../../../../libs/utils/data/src/marker.ts","../../../../../../../../libs/utils/data/src/reference-stack.ts","../../../../../../../../libs/utils/data/src/has-circular-reference.ts","../../../../../../../../libs/utils/data/src/locate-circular-reference.ts","../../../../../../../../libs/utils/data/src/is-identical.ts","../../../../../../../../libs/utils/data/src/contains-keys.ts","../../../../../../../../libs/utils/data/src/selective-copy.ts","../../../../../../../../libs/utils/data/src/traverse.ts","../../../../../../../../libs/utils/data/src/get-value.ts","../../../../../../../../libs/utils/data/src/get-depth.ts","../../../../../../../../libs/utils/data/src/locate-key.ts","../../../../../../../../libs/utils/immutable-api/src/built-in-copy/set/index.ts","../../../../../../../../libs/utils/data/src/get-unique-keys.ts","../../../../../../../../libs/utils/data/src/locate-text.ts","../../../../../../../../libs/utils/data/src/rename-key.ts","../../../../../../../../libs/utils/data/src/remove-key.ts","../../../../../../../../libs/utils/data/src/replace-text.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["_Reflect"],"mappings":"AAAA;;;;;;;AAOG;AAE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* Returns true when both values are identical. | ||
| * For primitive values, use strict equality comparison. | ||
| * For non-primitive values, it checks equality by reviewing values' properties and values. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param targetA - The first value to compare | ||
| * @param targetB - The second value to compare | ||
| * @returns True if the values are identical, false otherwise | ||
| */ | ||
| export declare const isIdentical: (targetA: unknown, targetB: unknown) => boolean; | ||
| //# sourceMappingURL=is-identical.d.ts.map |
| {"version":3,"file":"is-identical.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/is-identical.ts"],"names":[],"mappings":"AAoGA;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW,GAAI,SAAS,OAAO,EAAE,SAAS,OAAO,KAAG,OAMhE,CAAA"} |
| import type { DataType } from './models'; | ||
| /** | ||
| * Checks if the provided data type is registered as an iterable type. | ||
| * | ||
| * @param dataType - The data type to check | ||
| * @returns `true` if the data type is iterable, otherwise `false` | ||
| */ | ||
| export declare const isIterableType: <T extends string = DataType>(dataType: T) => boolean; | ||
| //# sourceMappingURL=is-iterable-type.d.ts.map |
| {"version":3,"file":"is-iterable-type.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/is-iterable-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAGxC;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,CAAC,SAAS,MAAM,GAAG,QAAQ,EAAE,UAAU,CAAC,KAAG,OAAmD,CAAA"} |
| /** | ||
| * Checks if the target is iterable. | ||
| * | ||
| * @param target - The target to check. | ||
| * @returns `true` if the target is iterable, `false` otherwise. | ||
| */ | ||
| export declare const isIterable: (target: unknown) => boolean; | ||
| //# sourceMappingURL=is-iterable.d.ts.map |
| {"version":3,"file":"is-iterable.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/is-iterable.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,QAAQ,OAAO,KAAG,OAA0C,CAAA"} |
| export declare const isMarker: (text: string) => boolean; | ||
| //# sourceMappingURL=is-marker.d.ts.map |
| {"version":3,"file":"is-marker.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/is-marker.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,QAAQ,GAAI,MAAM,MAAM,KAAG,OAGvC,CAAA"} |
| import type { ReferenceStack } from './models'; | ||
| import { CircularReference } from './circular-reference'; | ||
| export declare const locateCircularReferenceRecursive: (target: unknown, maxResults: "*" | number, path: string[], stack: ReferenceStack, result: CircularReference[], root?: boolean) => CircularReference[]; | ||
| /** | ||
| * Returns a list of locations where circular references occur. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The value to search for circular references | ||
| * @param maxResults - Maximum number of circular references to find (number or '*' for all) | ||
| * @returns An array of CircularReference objects indicating locations of circular references | ||
| */ | ||
| export declare const locateCircularReference: (target: unknown, maxResults?: "*" | number) => CircularReference[]; | ||
| //# sourceMappingURL=locate-circular-reference.d.ts.map |
| {"version":3,"file":"locate-circular-reference.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/locate-circular-reference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AASxD,eAAO,MAAM,gCAAgC,GAC3C,QAAQ,OAAO,EACf,YAAY,GAAG,GAAG,MAAM,EACxB,MAAM,MAAM,EAAE,EACd,OAAO,cAAc,EACrB,QAAQ,iBAAiB,EAAE,EAC3B,cAAY,KACX,iBAAiB,EAcnB,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,GAAI,QAAQ,OAAO,EAAE,aAAY,GAAG,GAAG,MAAU,KAAG,iBAAiB,EAexG,CAAA"} |
| import type { DepthConfig } from './models'; | ||
| /** | ||
| * Returns a list of locations where the key name matches a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against key names | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where the key pattern was found | ||
| */ | ||
| export declare const locateKey: (target: unknown, pattern: string | RegExp, options?: DepthConfig) => string[][]; | ||
| //# sourceMappingURL=locate-key.d.ts.map |
| {"version":3,"file":"locate-key.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/locate-key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,WAAW,EAAE,MAAM,UAAU,CAAA;AAOrD;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,GAAI,QAAQ,OAAO,EAAE,SAAS,MAAM,GAAG,MAAM,EAAE,UAAU,WAAW,KAAG,MAAM,EAAE,EAWpG,CAAA"} |
| import type { DepthConfig } from './models'; | ||
| /** | ||
| * Returns a list of locations where a text value matches a pattern or an exact value anywhere in the data structure of the target. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to search within | ||
| * @param pattern - The string or regular expression pattern to match against text values | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where the text pattern was found | ||
| */ | ||
| export declare const locateText: (target: unknown, pattern: string | RegExp, options?: DepthConfig) => string[][]; | ||
| //# sourceMappingURL=locate-text.d.ts.map |
| {"version":3,"file":"locate-text.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/locate-text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,WAAW,EAAE,MAAM,UAAU,CAAA;AAKrD;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,GAAI,QAAQ,OAAO,EAAE,SAAS,MAAM,GAAG,MAAM,EAAE,UAAU,WAAW,KAAG,MAAM,EAAE,EAMrG,CAAA"} |
| export declare const marker: () => string; | ||
| //# sourceMappingURL=marker.d.ts.map |
| {"version":3,"file":"marker.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/marker.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM,QAAO,MAMzB,CAAA"} |
-99
| export type Predicate = (x: unknown) => boolean; | ||
| export type DataType = 'undefined' | 'object' | 'boolean' | 'number' | 'bigint' | 'string' | 'symbol' | 'function' | 'null' | 'array'; | ||
| export type UnknownIterable = Iterable<unknown>; | ||
| export type UnknownIterableKey = keyof UnknownIterable & string; | ||
| export type UnknownClass<T = unknown> = { | ||
| new (...args: any[]): T; | ||
| }; | ||
| export interface RegisteredIterableClassEntry<T = unknown> { | ||
| /** A reference to a class definition. */ | ||
| classRef: UnknownClass<T>; | ||
| /** Returns a new (empty) instance. */ | ||
| instantiate: () => T; | ||
| /** Returns list of iterable keys. */ | ||
| getKeys: (target: any) => string[]; | ||
| /** Returns a value corresponding to a key of class instance. */ | ||
| read: (target: any, key: unknown) => unknown; | ||
| /** Sets a new value with specific key optionally on class instance. */ | ||
| write: (instance: T, value: unknown, key?: unknown) => void; | ||
| /** Removes a key from the class instance. */ | ||
| remove: (instance: T, key: unknown) => void; | ||
| } | ||
| export interface IterableOperators<T = unknown> { | ||
| /** Returns a new (empty) instance. */ | ||
| instantiate: () => T; | ||
| /** Returns list of iterable keys. */ | ||
| getKeys: (target: any) => string[]; | ||
| /** Returns a value corresponding to a key of class instance. */ | ||
| read: (target: any, key: unknown) => unknown; | ||
| /** Sets a new value with specific key optionally on class instance. */ | ||
| write: (instance: T, value: unknown, key?: unknown) => void; | ||
| /** Removes a key from the class instance. */ | ||
| remove: (instance: T, key: unknown) => void; | ||
| } | ||
| export interface Config { | ||
| /** | ||
| * A flag that indicates the API that two values can match only if their properties | ||
| * are in the same order when set to `true` | ||
| */ | ||
| samePositionOfOwnProperties: boolean; | ||
| /** | ||
| * A flag that indicates the API that circular references may exist and should keep a tally of reference stack. | ||
| * Turning this flag ON comes at a performance cost, so enable only when necessary. | ||
| */ | ||
| detectCircularReferences: boolean; | ||
| } | ||
| export interface ReferenceStack { | ||
| /** | ||
| * Total number of references in the stack. | ||
| */ | ||
| size: number; | ||
| /** | ||
| * Returns true if reference is already registered. | ||
| * | ||
| * @param reference | ||
| * @returns | ||
| */ | ||
| exists: (reference: unknown) => boolean; | ||
| /** | ||
| * Returns a negative number corresponding to how many iterations ago the reference | ||
| * was registered in the stack relative to the last entry or null when it is not in the stack. | ||
| * | ||
| * @param reference | ||
| * @returns | ||
| */ | ||
| lastSeen: (reference: unknown) => number | null; | ||
| /** | ||
| * Adds a new reference into the stack. | ||
| */ | ||
| add: (reference: unknown) => void; | ||
| /** | ||
| * Empties the reference stack and removes any flags added. | ||
| */ | ||
| clear: () => void; | ||
| } | ||
| export interface DepthConfig { | ||
| depth: [number, number | '*'] | [number] | []; | ||
| } | ||
| export interface TraverseConfig { | ||
| depth: [number, number | '*']; | ||
| exitEarly: boolean; | ||
| } | ||
| export type Condition = (config: TraverseConfig, key: string, value: unknown, path: string[], parent: unknown) => boolean; | ||
| export type Callback = (key: string, value: unknown, path: string[], state: any, parent: unknown) => void; | ||
| export type TraversalArgs<T = unknown, S extends Record<string, unknown> = Record<string, unknown>> = [ | ||
| Condition, | ||
| Callback, | ||
| TraverseConfig, | ||
| string, | ||
| string[], | ||
| T, | ||
| unknown, | ||
| S | ||
| ]; | ||
| export type TraversalNonCircular<S extends Record<string, unknown> = Record<string, unknown>> = (condition: Condition, callback: Callback, config: TraverseConfig, key: string, path: string[], value: unknown, parent: unknown, state: S) => S; | ||
| export type TraversalCircular = (condition: Condition, callback: Callback, config: TraverseConfig, key: string, path: string[], value: unknown, parent: unknown, state: any, stack: ReferenceStack, root?: boolean) => any; | ||
| export type Traversal<T = unknown> = (target: T, condition: Condition, callback: Callback, options: DepthConfig, state: any) => any; | ||
| export type TraversalCreator<T = unknown> = (condition: Condition) => Traverse<T>; | ||
| export type Traverse<T = unknown> = (target: T, callback: Callback, options?: DepthConfig, state?: any) => any; | ||
| //# sourceMappingURL=models.d.ts.map |
| {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/models.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAA;AAE/C,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,CAAA;AAErI,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAA;AAE/C,MAAM,MAAM,kBAAkB,GAAG,MAAM,eAAe,GAAG,MAAM,CAAA;AAE/D,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,OAAO,IAAI;IACtC,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;CACxB,CAAA;AAED,MAAM,WAAW,4BAA4B,CAAC,CAAC,GAAG,OAAO;IACvD,yCAAyC;IACzC,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;IAEzB,sCAAsC;IACtC,WAAW,EAAE,MAAM,CAAC,CAAA;IAEpB,qCAAqC;IACrC,OAAO,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,MAAM,EAAE,CAAA;IAElC,gEAAgE;IAChE,IAAI,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,KAAK,OAAO,CAAA;IAE5C,uEAAuE;IACvE,KAAK,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;IAE3D,6CAA6C;IAC7C,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,KAAK,IAAI,CAAA;CAC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AE,cAAc,EACrB,IAAI,CAAC,EAAE,OAAO,KACX,GAAG,CAAA;AAER,MAAM,MAAM,SAAS,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,KAAK,GAAG,CAAA;AAEnI,MAAM,MAAM,gBAAgB,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,SAAS,EAAE,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAA;AAEjF,MAAM,MAAM,QAAQ,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,WAAW,EAAE,KAAK,CAAC,EAAE,GAAG,KAAK,GAAG,CAAA"} |
| import type { ReferenceStack } from './models'; | ||
| /** | ||
| * Creates a new ReferenceStack instance. | ||
| * | ||
| * @remarks | ||
| * A ReferenceStack is used to keep track of iterables that have already been processed. | ||
| * This is particularly useful for handling circular references in data structures. | ||
| * @returns A new ReferenceStack instance. | ||
| */ | ||
| export declare const referenceStack: () => ReferenceStack; | ||
| //# sourceMappingURL=reference-stack.d.ts.map |
| {"version":3,"file":"reference-stack.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/reference-stack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAuC,cAAc,EAAE,MAAM,UAAU,CAAA;AAKnF;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,QAAO,cAkCjC,CAAA"} |
| import type { UnknownClass } from './models'; | ||
| /** | ||
| * Registers one or more classes which will be used to identify values as distinct data types. | ||
| * | ||
| * @param classRefs - One or more class references to register. | ||
| * @returns The result of the forEach operation (void) | ||
| */ | ||
| export declare const registerClassTypes: (...classRefs: UnknownClass[]) => void; | ||
| //# sourceMappingURL=register-class-types.d.ts.map |
| {"version":3,"file":"register-class-types.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/register-class-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAG5C;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,GAAG,WAAW,YAAY,EAAE,KAAG,IAC0C,CAAA"} |
| import type { UnknownClass } from './models'; | ||
| /** | ||
| * Registers a custom class as iterable, allowing the data utilities API to treat instances | ||
| * as map-like objects with their own unique data type. | ||
| * | ||
| * @param classRef - The class constructor to register | ||
| * @param getKeys - Function that returns all keys from an instance | ||
| * @param read - Function to read a value from an instance by key | ||
| * @param write - Function to write a value to an instance (with optional key) | ||
| * @param remove - Function to remove a key from an instance | ||
| * @param instantiate - Factory function to create new instances (defaults to calling constructor) | ||
| * @remarks | ||
| * If the class is already registered, its entry will be updated with the new handlers. | ||
| */ | ||
| export declare const registerIterableClass: <T = unknown>(classRef: UnknownClass<T>, getKeys: (target: T) => string[], read: (target: T, key: unknown) => unknown, write: (instance: T, value: unknown, key?: unknown) => void, remove: (instance: T, key: unknown) => void, instantiate?: () => T) => void; | ||
| //# sourceMappingURL=register-iterable-class.d.ts.map |
| {"version":3,"file":"register-iterable-class.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/register-iterable-class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAgC,YAAY,EAAE,MAAM,UAAU,CAAA;AAM1E;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,GAAI,CAAC,GAAG,OAAO,EAC/C,UAAU,YAAY,CAAC,CAAC,CAAC,EACzB,SAAS,CAAC,MAAM,EAAE,CAAC,KAAK,MAAM,EAAE,EAChC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,KAAK,OAAO,EAC1C,OAAO,CAAC,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,OAAO,KAAK,IAAI,EAC3D,QAAQ,CAAC,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,KAAK,IAAI,EAC3C,qBAAkC,KACjC,IAkBF,CAAA"} |
| import type { DepthConfig } from './models'; | ||
| /** | ||
| * Removes any key names that match a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of keys that were removed. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against key names for removal | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where keys were removed | ||
| */ | ||
| export declare const removeKey: (target: unknown, pattern: string | RegExp, options?: DepthConfig) => string[][]; | ||
| //# sourceMappingURL=remove-key.d.ts.map |
| {"version":3,"file":"remove-key.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/remove-key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,WAAW,EAAE,MAAM,UAAU,CAAA;AAOrD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,GAAI,QAAQ,OAAO,EAAE,SAAS,MAAM,GAAG,MAAM,EAAE,UAAU,WAAW,KAAG,MAAM,EAAE,EAepG,CAAA"} |
| import type { DepthConfig } from './models'; | ||
| /** | ||
| * Renames any key names that match a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of keys that were edited. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against key names | ||
| * @param name - The new name to assign to matching keys | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where keys were renamed | ||
| */ | ||
| export declare const renameKey: (target: unknown, pattern: string | RegExp, name: string, options?: DepthConfig) => string[][]; | ||
| //# sourceMappingURL=rename-key.d.ts.map |
| {"version":3,"file":"rename-key.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/rename-key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,WAAW,EAAE,MAAM,UAAU,CAAA;AAOrD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,SAAS,GAAI,QAAQ,OAAO,EAAE,SAAS,MAAM,GAAG,MAAM,EAAE,MAAM,MAAM,EAAE,UAAU,WAAW,KAAG,MAAM,EAAE,EAmBlH,CAAA"} |
| import type { DepthConfig } from './models'; | ||
| /** | ||
| * Edits any text by replacing any string or substring that matches a pattern or an exact value anywhere in the data structure of the target | ||
| * and returns the location of the original text that were edited. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The target value to modify | ||
| * @param pattern - The string or regular expression pattern to match against text values | ||
| * @param text - The replacement text for matching values | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @returns An array of paths to locations where text was replaced | ||
| */ | ||
| export declare const replaceText: (target: unknown, pattern: string | RegExp, text: string, options?: DepthConfig) => string[][]; | ||
| //# sourceMappingURL=replace-text.d.ts.map |
| {"version":3,"file":"replace-text.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/replace-text.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,WAAW,EAAE,MAAM,UAAU,CAAA;AAOrD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW,GAAI,QAAQ,OAAO,EAAE,SAAS,MAAM,GAAG,MAAM,EAAE,MAAM,MAAM,EAAE,UAAU,WAAW,KAAG,MAAM,EAAE,EAkBpH,CAAA"} |
| import type { DataType } from './models'; | ||
| /** | ||
| * Checks whether two targets have the same structure. | ||
| * | ||
| * @remarks | ||
| * For iterable types (arrays, sets, maps, and objects), it checks whether they have the same keys. | ||
| * For other types, it simply checks whether they are of the same type. | ||
| * It supports configuration via `getConfig().samePositionOfOwnProperties` to determine whether the order of keys matters for objects. | ||
| * If supports other registered iterable classes as well. See `registerIterableClass`. | ||
| * @param targetA data to compare | ||
| * @param targetB data to compare | ||
| * @returns The data type if both targets have the same structure, otherwise `false`. | ||
| */ | ||
| export declare const sameStructure: (targetA: unknown, targetB: unknown) => DataType | false; | ||
| //# sourceMappingURL=same-structure.d.ts.map |
| {"version":3,"file":"same-structure.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/same-structure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAMxC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,GAAI,SAAS,OAAO,EAAE,SAAS,OAAO,KAAG,QAAQ,GAAG,KAqB7E,CAAA"} |
| import type { DataType } from './models'; | ||
| /** | ||
| * Checks if two targets are of the same data type. | ||
| * | ||
| * @param targetA The first target to compare | ||
| * @param targetB The second target to compare | ||
| * @returns The common data type if both targets are of the same type; otherwise, false. | ||
| */ | ||
| export declare const sameType: <T extends string = DataType>(targetA: unknown, targetB: unknown) => T | false; | ||
| //# sourceMappingURL=same-type.d.ts.map |
| {"version":3,"file":"same-type.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/same-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAGxC;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,SAAS,MAAM,GAAG,QAAQ,EAAE,SAAS,OAAO,EAAE,SAAS,OAAO,KAAG,CAAC,GAAG,KAI9F,CAAA"} |
| import { ReferenceStack } from './models'; | ||
| import { SelectiveCopyOptions, SelectiveCopyPredicate, DataPointOperation, DataPoint, ReferenceLoop } from './selective-copy.model'; | ||
| export declare const selectiveCopyRecursive: <T extends Record<string, unknown>>(target: T, path: string[], includeKey: SelectiveCopyPredicate, skipFunctions: boolean, recordSkip: DataPointOperation) => Partial<T>; | ||
| /** | ||
| * Creates a clone of the target. Options can be provided to selectively copy values. | ||
| * This algorithm is able detect circular references, and optionally clone them. | ||
| * | ||
| * @param target - The object to clone | ||
| * @param path - The current path in the data structure | ||
| * @param includeKey - Predicate function to determine if a key should be included | ||
| * @param skipFunctions - Whether to skip function values | ||
| * @param recordSkip - Callback to record skipped data points | ||
| * @param stack - Reference stack for tracking circular references | ||
| * @param circularRefs - Array to store circular reference information | ||
| * @param root - Whether this is the root call | ||
| * @returns A partial clone of the target object | ||
| */ | ||
| export declare const selectiveCopyForCircularReferencesRecursive: <T extends Record<string, unknown>>(target: T, path: string[], includeKey: SelectiveCopyPredicate, skipFunctions: boolean, recordSkip: DataPointOperation, stack: ReferenceStack, circularRefs: ReferenceLoop[], root?: boolean) => Partial<T>; | ||
| /** | ||
| * Creates a clone of the target. Options can be provided to selectively copy values. | ||
| * Due to JavaScript language limitations context of bound functions is not known, thus functions cannot be reliably cloned. | ||
| * This algorithm instead copies function references by default instead. For the same reason getters and setters are not replicate, only their | ||
| * return values. This algorithm can replicate circular references, when configured to do so. | ||
| * It supports other iterable data types, provided these have been made known using registerIterableClass. | ||
| * | ||
| * @param target - The value to clone | ||
| * @param options - Configuration options for selective copying | ||
| * @returns An object containing the cloned value and array of skipped data points | ||
| */ | ||
| export declare const selectiveCopy: <T = unknown>(target: T, options?: SelectiveCopyOptions) => { | ||
| clone: Partial<T>; | ||
| skipped: DataPoint[]; | ||
| }; | ||
| //# sourceMappingURL=selective-copy.d.ts.map |
| {"version":3,"file":"selective-copy.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/selective-copy.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAEzC,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAGnI,eAAO,MAAM,sBAAsB,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtE,QAAQ,CAAC,EACT,MAAM,MAAM,EAAE,EACd,YAAY,sBAAsB,EAClC,eAAe,OAAO,EACtB,YAAY,kBAAkB,KAC7B,OAAO,CAAC,CAAC,CAwBX,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,2CAA2C,GAAI,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3F,QAAQ,CAAC,EACT,MAAM,MAAM,EAAE,EACd,YAAY,sBAAsB,EAClC,eAAe,OAAO,EACtB,YAAY,kBAAkB,EAC9B,OAAO,cAAc,EACrB,cAAc,aAAa,EAAE,EAC7B,cAAY,KACX,OAAO,CAAC,CAAC,CAuEX,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,GAAG,OAAO,EAAE,QAAQ,CAAC,EAAE,UAAU,oBAAoB,KAAG;IAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAAC,OAAO,EAAE,SAAS,EAAE,CAAA;CA+C/H,CAAA"} |
| import type { DataType } from './models'; | ||
| export type SelectiveCopyPredicate = <T extends DataType = DataType>(target: unknown, path: string[], key: string, dataType: T) => boolean; | ||
| export type DataPointOperation = <T extends DataType = DataType>(target: unknown, path: string[], key: string, dataType: T) => void; | ||
| /** | ||
| * Settings used to determine what to copy. | ||
| */ | ||
| export interface SelectiveCopyOptions { | ||
| /** Set flag true to ignore all functions. */ | ||
| skipFunctions?: boolean; | ||
| /** A list of top-level properties that should be included. */ | ||
| includeKeys?: string[]; | ||
| /** A list of top-level properties that should be excluded. */ | ||
| excludeKeys?: string[]; | ||
| /** A condition that is evaluated to determine if data point should be included. */ | ||
| include?: SelectiveCopyPredicate; | ||
| /** A condition that is evaluated to determine if data point should be excluded. */ | ||
| exclude?: SelectiveCopyPredicate; | ||
| } | ||
| export interface DataPoint { | ||
| target: unknown; | ||
| path: string[]; | ||
| key: string; | ||
| dataType: DataType; | ||
| } | ||
| export interface ReferenceLoop { | ||
| startPath: string[]; | ||
| destinationPath: string[]; | ||
| } | ||
| //# sourceMappingURL=selective-copy.model.d.ts.map |
| {"version":3,"file":"selective-copy.model.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/selective-copy.model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,OAAO,CAAA;AAE1I,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,SAAS,QAAQ,GAAG,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,IAAI,CAAA;AAEnI;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,6CAA6C;IAC7C,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,mFAAmF;IACnF,OAAO,CAAC,EAAE,sBAAsB,CAAA;IAChC,mFAAmF;IACnF,OAAO,CAAC,EAAE,sBAAsB,CAAA;CACjC;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,OAAO,CAAA;IACf,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,QAAQ,CAAA;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,EAAE,CAAA;IACnB,eAAe,EAAE,MAAM,EAAE,CAAA;CAC1B"} |
| import type { TraversalCreator, Callback, DepthConfig } from './models'; | ||
| /** | ||
| * A higher-order function that takes a single predicate function to generate an algorithm that traverses data points | ||
| * on a data structure. See traverse. | ||
| * | ||
| * @param condition - Predicate function to determine whether to traverse a data point | ||
| * @returns A traversal function configured with the condition | ||
| */ | ||
| export declare const createTraversal: TraversalCreator<unknown>; | ||
| /** | ||
| * Invokes a callback function for every data point in the data structure of the target value to let you do read and write operations. | ||
| * A depth option is available to narrow down the iteration scope. | ||
| * | ||
| * @param target - The value to traverse | ||
| * @param callback - Function to invoke for each data point | ||
| * @param options - Optional configuration to control traversal depth | ||
| * @param state - Optional state object to maintain across traversal callbacks | ||
| * @returns The state object after traversal completes | ||
| */ | ||
| export declare const traverse: <T = unknown, S extends Record<string, unknown> = Record<string, unknown>>(target: T, callback: Callback, options?: DepthConfig, state?: S) => S; | ||
| //# sourceMappingURL=traverse.d.ts.map |
| {"version":3,"file":"traverse.d.ts","sourceRoot":"","sources":["../../../../../../../../libs/utils/data/src/traverse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,gBAAgB,EAIhB,QAAQ,EACR,WAAW,EACZ,MAAM,UAAU,CAAA;AAiFjB;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,EAAE,gBAAgB,CAAC,OAAO,CAC+B,CAAA;AAMrF;;;;;;;;;GASG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,GAAG,OAAO,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/F,QAAQ,CAAC,EACT,UAAU,QAAQ,EAClB,UAAU,WAAW,EACrB,QAAQ,CAAC,KACR,CAAgE,CAAA"} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
6521
20.34%356
0.56%323688
-34.88%28
-67.44%1
Infinity%