@bemoje/object 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # @bemoje/object
2
+ Object related tools/util.
3
+
4
+ ![GitHub Top Language](https://img.shields.io/github/languages/top/bemoje/https://github.com/bemoje/tsmono)
5
+
6
+ ##### Github
7
+ ![GitHub Last Commit](https://img.shields.io/github/last-commit/bemoje/https://github.com/bemoje/tsmono?color=red)
8
+ ![GitHub Stars](https://img.shields.io/github/stars/bemoje/https://github.com/bemoje/tsmono)
9
+ ![GitHub Forks](https://img.shields.io/github/forks/bemoje/https://github.com/bemoje/tsmono)
10
+ ![GitHub Watchers](https://img.shields.io/github/watchers/bemoje/https://github.com/bemoje/tsmono)
11
+ ![GitHub Repo Size](https://img.shields.io/github/repo-size/bemoje/https://github.com/bemoje/tsmono)
12
+
13
+ ##### NPM
14
+ <span><a href="https://npmjs.org/@bemoje/object" title="View this project on NPM"><img src="https://img.shields.io/npm/v/@bemoje/object" alt="NPM Version" /></a></span>
15
+ <span><a href="https://npmjs.org/@bemoje/object" title="NPM Downloads"><img src="https://img.shields.io/npm/dt/@bemoje/object" alt="NPM Downloads" /></a></span>
16
+
17
+ ## Documentation
18
+ [object docs](https://bemoje.github.io/tsmono/html/object/modules.html)
19
+
20
+ ##### Donate
21
+ <span><a href="https://www.patreon.com/user?u=40752770" title="Donate using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon Donation" /></a></span>
22
+
23
+ ## Installation
24
+ This library is published in the NPM registry and can be installed using any compatible package manager.
25
+
26
+ #### NPM
27
+ ```sh
28
+ npm install @bemoje/object
29
+ ```
30
+
31
+
32
+ ## Issues
33
+ Please let me know of any bugs or [issues](https://github.com/bemoje/https://github.com/bemoje/tsmono/issues).
34
+
35
+ ## Contribute
36
+ Contributors are welcome to open a [pull request](https://github.com/bemoje/https://github.com/bemoje/tsmono/pulls).
37
+
38
+ ## License
39
+ Released under the [MIT License](./LICENSE).
package/dist/index.cjs.js CHANGED
@@ -2,5 +2,5 @@
2
2
  * @bemoje/object v0.0.1
3
3
  * (c) Benjamin Møller Jensen
4
4
  * Released under the MIT License.
5
- */"use strict";var nodeUtil=require("@bemoje/node-util");function createObjectFactory(keys,defaultValues){const numKeys=keys.length;if(defaultValues&&defaultValues.length>numKeys)throw new Error("defaultValues length larger than keys length.");return function(values){if(values&&values.length>numKeys)throw new Error("values length larger than keys length.");const o={};for(let i=0;i<numKeys;i++){let value;values?(value=values[i],value===void 0&&defaultValues&&(value=defaultValues[i])):defaultValues&&(value=defaultValues[i]),Object.defineProperty(o,keys[i],{enumerable:!0,writable:!0,configurable:!0,value})}return o}}function getConstructor(o){return Object.getPrototypeOf(o).constructor}function inheritStaticMembers(target,source,ignoreKeys=[]){const ignore=new Set([...ignoreKeys,"prototype","name","constructor"]);for(const key of Reflect.ownKeys(source)){if(ignore.has(key))continue;if(Reflect.has(target,key))continue;const des=Object.getOwnPropertyDescriptor(source,key);Object.defineProperty(target,key,des)}return target}function iterableFirstElement(iterable){for(const item of iterable)return item}function*iteratePrototypeChain(object){nodeUtil.isPrototype(object)||nodeUtil.isConstructor(object)||object===Function.prototype||(yield object,object=object.constructor.prototype);for(let objectOrNull=object;objectOrNull;)yield objectOrNull,objectOrNull=Reflect.getPrototypeOf(objectOrNull)}function objDeepFreeze(o){for(const key of Reflect.ownKeys(o)){const value=o[key];(value&&"object"==typeof value||"function"==typeof value)&&objDeepFreeze(value)}return Object.freeze(o)}function objDelete(obj,key){return delete obj[key],obj}function*objEntries(obj){yield*Object.entries(obj)}function objEntriesArray(obj){return Array.from(Object.entries(obj))}function objFilter(object,callback,getKeys=Object.keys){const result={};for(const key of getKeys(object))callback(object[key],key)&&(result[key]=object[key]);return result}function objForEach(object,callback,getKeys=Object.keys){for(const key of getKeys(object))callback(object[key],key);return object}function objGet(obj,key){return obj[key]}function objGetOrElse(obj,key,callback){const value=obj[key];return void 0===value?obj[key]=callback(key):value}function objHas(obj,key){return Object.hasOwn(obj,key)}function objIsEmpty(obj){for(const key of Object.keys(obj))if(key!==void 0)return!1;return!0}function*objKeys(obj){yield*Object.keys(obj)}function objKeysArray(obj){return Array.from(Object.keys(obj))}function objMap(object,callback,getKeys=Object.keys){const result={};for(const key of getKeys(object))result[key]=callback(object[key],key);return result}function objMapKeys(object,callback,getKeys=Object.keys){const result={};for(const key of getKeys(object))result[callback(key,object[key])]=object[key];return result}function objMapMutable(object,callback,getKeys=Object.keys){for(const key of getKeys(object))object[key]=callback(object[key],key);return object}function objOmitKeys(obj,...keys){return objFilter(obj,(_,key)=>!keys.includes(key))}function objOmitKeysMutable(obj,...keys){for(const key of keys)Reflect.deleteProperty(obj,key);return obj}function objPropertyValueToGetter(object,...propertyNames){for(const propertyName of propertyNames){const descriptor=Object.getOwnPropertyDescriptor(object,propertyName);if(!descriptor)throw new Error(`Property descriptor for '${propertyName+""}' not found.`);const{enumerable,configurable,value}=descriptor;Object.defineProperty(object,propertyName,{enumerable,configurable,get:()=>value})}return object}function objReduce(object,callback,accum,getKeys=Object.keys){for(const key of getKeys(object))accum=callback(accum,object[key],key);return accum}function objReverse(obj){return Object.fromEntries(objEntriesArray(obj).reverse())}function objSet(obj,key,value){return obj[key]=value}function objSize(obj){return Object.keys(obj).length}function objSortKeys(o){return Object.fromEntries(Object.entries(o).sort((a,b)=>a[0].localeCompare(b[0])))}function objToMap(obj){return new Map(Object.entries(obj))}function objUpdate(obj,key,callback){return obj[key]=callback(obj[key],key)}function objUpdatePropertyDescriptors(object,properties,update){for(const p of properties){if(!Object.hasOwn(object,p))throw new Error(`Property, '${p}' does not exist on object.`);const descriptor=update(Object.getOwnPropertyDescriptor(object,p),p);Object.defineProperty(object,p,descriptor)}}function*objValues(obj){yield*Object.values(obj)}function objValuesArray(obj){return Array.from(Object.values(obj))}function objWalk(node,callback){function recurse(node,path=[]){for(const[key,child]of Object.entries(node))"object"==typeof child&&null!==child?Array.isArray(child)?child.forEach((node,index)=>{recurse(node,path.concat([`${key}[${index}]`]))}):recurse(child,path.concat(key)):callback(child,path.concat(key))}recurse(node)}function setEnumerable(object,...properties){objUpdatePropertyDescriptors(object,properties,descriptor=>(descriptor.enumerable=!0,descriptor))}function setNonConfigurable(object,...properties){objUpdatePropertyDescriptors(object,properties,descriptor=>(descriptor.configurable=!1,descriptor))}function setNonEnumerable(object,...properties){objUpdatePropertyDescriptors(object,properties,descriptor=>(descriptor.enumerable=!1,descriptor))}function setNonWritable(object,...properties){objUpdatePropertyDescriptors(object,properties,descriptor=>(descriptor.writable=!1,descriptor))}function setWritable(object,...properties){objUpdatePropertyDescriptors(object,properties,descriptor=>(descriptor.writable=!0,descriptor))}function toJson(data,pretty=!1){return pretty?JSON.stringify(data,null,2):JSON.stringify(data)}exports.createObjectFactory=createObjectFactory,exports.getConstructor=getConstructor,exports.inheritStaticMembers=inheritStaticMembers,exports.iterableFirstElement=iterableFirstElement,exports.iteratePrototypeChain=iteratePrototypeChain,exports.objDeepFreeze=objDeepFreeze,exports.objDelete=objDelete,exports.objEntries=objEntries,exports.objEntriesArray=objEntriesArray,exports.objFilter=objFilter,exports.objForEach=objForEach,exports.objGet=objGet,exports.objGetOrElse=objGetOrElse,exports.objHas=objHas,exports.objIsEmpty=objIsEmpty,exports.objKeys=objKeys,exports.objKeysArray=objKeysArray,exports.objMap=objMap,exports.objMapKeys=objMapKeys,exports.objMapMutable=objMapMutable,exports.objOmitKeys=objOmitKeys,exports.objOmitKeysMutable=objOmitKeysMutable,exports.objPropertyValueToGetter=objPropertyValueToGetter,exports.objReduce=objReduce,exports.objReverse=objReverse,exports.objSet=objSet,exports.objSize=objSize,exports.objSortKeys=objSortKeys,exports.objToMap=objToMap,exports.objUpdate=objUpdate,exports.objUpdatePropertyDescriptors=objUpdatePropertyDescriptors,exports.objValues=objValues,exports.objValuesArray=objValuesArray,exports.objWalk=objWalk,exports.setEnumerable=setEnumerable,exports.setNonConfigurable=setNonConfigurable,exports.setNonEnumerable=setNonEnumerable,exports.setNonWritable=setNonWritable,exports.setWritable=setWritable,exports.toJson=toJson;
5
+ */"use strict";var validation=require("@bemoje/validation");function createObjectFactory(keys,defaultValues){const numKeys=keys.length;if(defaultValues&&defaultValues.length>numKeys)throw new Error("defaultValues length larger than keys length.");return function(values){if(values&&values.length>numKeys)throw new Error("values length larger than keys length.");const o={};for(let i=0;i<numKeys;i++){let value;values?(value=values[i],value===void 0&&defaultValues&&(value=defaultValues[i])):defaultValues&&(value=defaultValues[i]),Object.defineProperty(o,keys[i],{enumerable:!0,writable:!0,configurable:!0,value})}return o}}function getConstructor(o){return Object.getPrototypeOf(o).constructor}function inheritStaticMembers(target,source,ignoreKeys=[]){const ignore=new Set([...ignoreKeys,"prototype","name","constructor"]);for(const key of Reflect.ownKeys(source)){if(ignore.has(key))continue;if(Reflect.has(target,key))continue;const des=Object.getOwnPropertyDescriptor(source,key);Object.defineProperty(target,key,des)}return target}function iterableFirstElement(iterable){for(const item of iterable)return item}function*iteratePrototypeChain(object){validation.isPrototype(object)||validation.isConstructor(object)||object===Function.prototype||(yield object,object=object.constructor.prototype);for(let objectOrNull=object;objectOrNull;)yield objectOrNull,objectOrNull=Reflect.getPrototypeOf(objectOrNull)}function objDeepFreeze(o){for(const key of Reflect.ownKeys(o)){const value=o[key];(value&&"object"==typeof value||"function"==typeof value)&&objDeepFreeze(value)}return Object.freeze(o)}function objDelete(obj,key){return delete obj[key],obj}function*objEntries(obj){yield*Object.entries(obj)}function objEntriesArray(obj){return Array.from(Object.entries(obj))}function objFilter(object,callback,getKeys=Object.keys){const result={};for(const key of getKeys(object))callback(object[key],key)&&(result[key]=object[key]);return result}function objForEach(object,callback,getKeys=Object.keys){for(const key of getKeys(object))callback(object[key],key);return object}function objGet(obj,key){return obj[key]}function objGetOrElse(obj,key,callback){const value=obj[key];return void 0===value?obj[key]=callback(key):value}function objHas(obj,key){return Object.hasOwn(obj,key)}function objIsEmpty(obj){for(const key of Object.keys(obj))if(key!==void 0)return!1;return!0}function*objKeys(obj){yield*Object.keys(obj)}function objKeysArray(obj){return Array.from(Object.keys(obj))}function objMap(object,callback,getKeys=Object.keys){const result={};for(const key of getKeys(object))result[key]=callback(object[key],key);return result}function objMapKeys(object,callback,getKeys=Object.keys){const result={};for(const key of getKeys(object))result[callback(key,object[key])]=object[key];return result}function objMapMutable(object,callback,getKeys=Object.keys){for(const key of getKeys(object))object[key]=callback(object[key],key);return object}function objOmitKeys(obj,...keys){return objFilter(obj,(_,key)=>!keys.includes(key))}function objOmitKeysMutable(obj,...keys){for(const key of keys)Reflect.deleteProperty(obj,key);return obj}function objPropertyValueToGetter(object,...propertyNames){for(const propertyName of propertyNames){const descriptor=Object.getOwnPropertyDescriptor(object,propertyName);if(!descriptor)throw new Error(`Property descriptor for '${propertyName+""}' not found.`);const{enumerable,configurable,value}=descriptor;Object.defineProperty(object,propertyName,{enumerable,configurable,get:()=>value})}return object}function objReduce(object,callback,accum,getKeys=Object.keys){for(const key of getKeys(object))accum=callback(accum,object[key],key);return accum}function objReverse(obj){return Object.fromEntries(objEntriesArray(obj).reverse())}function objSet(obj,key,value){return obj[key]=value}function objSize(obj){return Object.keys(obj).length}function objSortKeys(o){return Object.fromEntries(Object.entries(o).sort((a,b)=>a[0].localeCompare(b[0])))}function objToMap(obj){return new Map(Object.entries(obj))}function objUpdate(obj,key,callback){return obj[key]=callback(obj[key],key)}function objUpdatePropertyDescriptors(object,properties,update){for(const p of properties){if(!Object.hasOwn(object,p))throw new Error(`Property, '${p}' does not exist on object.`);const descriptor=update(Object.getOwnPropertyDescriptor(object,p),p);Object.defineProperty(object,p,descriptor)}}function*objValues(obj){yield*Object.values(obj)}function objValuesArray(obj){return Array.from(Object.values(obj))}function objWalk(node,callback){function recurse(node,path=[]){for(const[key,child]of Object.entries(node))"object"==typeof child&&null!==child?Array.isArray(child)?child.forEach((node,index)=>{recurse(node,path.concat([`${key}[${index}]`]))}):recurse(child,path.concat(key)):callback(child,path.concat(key))}recurse(node)}function setEnumerable(object,...properties){objUpdatePropertyDescriptors(object,properties,descriptor=>(descriptor.enumerable=!0,descriptor))}function setNonConfigurable(object,...properties){objUpdatePropertyDescriptors(object,properties,descriptor=>(descriptor.configurable=!1,descriptor))}function setNonEnumerable(object,...properties){objUpdatePropertyDescriptors(object,properties,descriptor=>(descriptor.enumerable=!1,descriptor))}function setNonWritable(object,...properties){objUpdatePropertyDescriptors(object,properties,descriptor=>(descriptor.writable=!1,descriptor))}function setWritable(object,...properties){objUpdatePropertyDescriptors(object,properties,descriptor=>(descriptor.writable=!0,descriptor))}function toJson(data,pretty=!1){return pretty?JSON.stringify(data,null,2):JSON.stringify(data)}exports.createObjectFactory=createObjectFactory,exports.getConstructor=getConstructor,exports.inheritStaticMembers=inheritStaticMembers,exports.iterableFirstElement=iterableFirstElement,exports.iteratePrototypeChain=iteratePrototypeChain,exports.objDeepFreeze=objDeepFreeze,exports.objDelete=objDelete,exports.objEntries=objEntries,exports.objEntriesArray=objEntriesArray,exports.objFilter=objFilter,exports.objForEach=objForEach,exports.objGet=objGet,exports.objGetOrElse=objGetOrElse,exports.objHas=objHas,exports.objIsEmpty=objIsEmpty,exports.objKeys=objKeys,exports.objKeysArray=objKeysArray,exports.objMap=objMap,exports.objMapKeys=objMapKeys,exports.objMapMutable=objMapMutable,exports.objOmitKeys=objOmitKeys,exports.objOmitKeysMutable=objOmitKeysMutable,exports.objPropertyValueToGetter=objPropertyValueToGetter,exports.objReduce=objReduce,exports.objReverse=objReverse,exports.objSet=objSet,exports.objSize=objSize,exports.objSortKeys=objSortKeys,exports.objToMap=objToMap,exports.objUpdate=objUpdate,exports.objUpdatePropertyDescriptors=objUpdatePropertyDescriptors,exports.objValues=objValues,exports.objValuesArray=objValuesArray,exports.objWalk=objWalk,exports.setEnumerable=setEnumerable,exports.setNonConfigurable=setNonConfigurable,exports.setNonEnumerable=setNonEnumerable,exports.setNonWritable=setNonWritable,exports.setWritable=setWritable,exports.toJson=toJson;
6
6
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs.js","sources":["../src/lib/createObjectFactory.ts","../src/lib/getConstructor.ts","../src/lib/inheritStaticMembers.ts","../src/lib/iterableFirstElement.ts","../src/lib/iteratePrototypeChain.ts","../src/lib/objDeepFreeze.ts","../src/lib/objDelete.ts","../src/lib/objEntries.ts","../src/lib/objEntriesArray.ts","../src/lib/objFilter.ts","../src/lib/objForEach.ts","../src/lib/objGet.ts","../src/lib/objGetOrElse.ts","../src/lib/objHas.ts","../src/lib/objIsEmpty.ts","../src/lib/objKeys.ts","../src/lib/objKeysArray.ts","../src/lib/objMap.ts","../src/lib/objMapKeys.ts","../src/lib/objMapMutable.ts","../src/lib/objOmitKeys.ts","../src/lib/objOmitKeysMutable.ts","../src/lib/objPropertyValueToGetter.ts","../src/lib/objReduce.ts","../src/lib/objReverse.ts","../src/lib/objSet.ts","../src/lib/objSize.ts","../src/lib/objSortKeys.ts","../src/lib/objToMap.ts","../src/lib/objUpdate.ts","../src/lib/objUpdatePropertyDescriptors.ts","../src/lib/objValues.ts","../src/lib/objValuesArray.ts","../src/lib/objWalk.ts","../src/lib/setEnumerable.ts","../src/lib/setNonConfigurable.ts","../src/lib/setNonEnumerable.ts","../src/lib/setNonWritable.ts","../src/lib/setWritable.ts","../src/lib/toJson.ts"],"sourcesContent":["/**\n * Creates a factory function for creating objects with specified keys and default values.\n * @template T The type of the values.\n * @param keys An array of strings representing the keys of the objects to be created.\n * @param defaultValues An optional array of default values for the keys. If provided, its length should not be larger than the length of the keys array.\n * @returns An `ObjectFactory` function. When called, this function takes an optional array of values and returns an object with the specified keys and values. If the values array is not provided or if a value is `undefined`, the corresponding default value is used.\n * @throws If the length of the `defaultValues` array is larger than the length of the `keys` array, or if the length of the `values` array passed to the factory function is larger than the length of the `keys` array.\n * @example ```ts\n * createObjectFactory(['key1', 'key2'], ['default1', 'default2'])(['value1']);\n * //=> { key1: 'value1', key2: 'default2' }\n * ```\n */\nexport function createObjectFactory<T>(keys: string[], defaultValues?: T[]): (values?: T[]) => Record<string, T> {\n const numKeys = keys.length\n if (defaultValues && defaultValues.length > numKeys) {\n throw new Error('defaultValues length larger than keys length.')\n }\n return function factory(values?: T[]) {\n if (values && values.length > numKeys) {\n throw new Error('values length larger than keys length.')\n }\n const o = {}\n for (let i = 0; i < numKeys; i++) {\n let value\n if (values) {\n value = values[i]\n if (value === undefined && defaultValues) {\n value = defaultValues[i]\n }\n } else if (defaultValues) {\n value = defaultValues[i]\n }\n Object.defineProperty(o, keys[i], {\n enumerable: true,\n writable: true,\n configurable: true,\n value,\n })\n }\n return o\n }\n}\n","import type { ConstructorOf } from '../types/ConstructorOf'\n\n/**\n * Returns the constructor of the given object.\n * @template T - The type of the object.\n * @param o The object whose constructor is to be returned.\n * @returns The constructor of the object.\n * @example ```ts\n * class MyClass {}\n * getConstructor(new MyClass()) === MyClass;;\n * //=> true\n * ```\n */\nexport function getConstructor<T>(o: T): ConstructorOf<T> {\n return Object.getPrototypeOf(o).constructor\n}\n","import type { Constructor } from '../types/Constructor'\n\n/**\n * Copies static members from a source constructor to a target constructor, excluding specified keys.\n * @param target The target constructor to inherit static members.\n * @param source The source constructor to copy static members from.\n * @param ignoreKeys An optional array of keys to exclude from copying.\n * @returns The target constructor with the inherited static members.\n * @throws If `target` or `source` is not a constructor.\n * @param - The keys that should not be inherited.\n * @example ```ts\n * class Parent {\n * static parentStaticMethod() {\n * return 'Parent static method'\n * }\n * }\n * class Child {\n * static childStaticMethod() {\n * return 'Child static method'\n * }\n * }\n * inheritStaticMembers(Child, Parent)\n * Child.parentStaticMethod() //=> 'Parent static method'\n * ```\n */\nexport function inheritStaticMembers(target: Constructor, source: Constructor, ignoreKeys: string[] = []): Constructor {\n const ignore: Set<string | symbol> = new Set([...ignoreKeys, 'prototype', 'name', 'constructor'])\n for (const key of Reflect.ownKeys(source)) {\n if (ignore.has(key)) continue\n if (Reflect.has(target, key)) continue\n const des = Object.getOwnPropertyDescriptor(source, key)\n Object.defineProperty(target, key, des as PropertyDescriptor)\n }\n return target\n}\n","/**\n * Returns the first element of an iterable object.\n * @template T - The type of elements in the iterable.\n * @param iterable The iterable object.\n * @returns The first element of the iterable object, or `undefined` if the iterable is empty.\n * @example ```ts\n * iterableFirstElement([1, 2, 3, 4, 5]);;\n * //=> 1\n * ```\n */\nexport function iterableFirstElement<T>(iterable: Iterable<T>): T | undefined {\n for (const item of iterable) return item\n}\n","import { isConstructor, isPrototype } from '@bemoje/node-util'\n\n/**\n * Iterate the prototype chain of a given object.\n * @remarks This function uses the `Reflect.getPrototypeOf` method to traverse the prototype chain.\n * It also uses the `isPrototype` and `isConstructor` helper functions to determine whether\n * the given object is a prototype or a constructor function.\n * @param object The object whose prototype chain is to be iterated over.\n * @throws If the provided object is not an object or a function, a TypeError will be thrown.\n * @returns A generator that yields each prototype in the chain.\n * @example ```ts\n * class A {}\n * class B extends A {}\n * class C extends B {}\n * const instance = new C()\n * iteratePrototypeChain(C)\n * //=> [ C, B, A, Function.prototype, Object.prototype]\n * iteratePrototypeChain(C.prototype)\n * //=> [C.prototype, B.prototype, A.prototype, Object.prototype]\n * iteratePrototypeChain(instance)\n * //=> [instance, C.prototype, B.prototype, A.prototype, Object.prototype]\n * ```\n */\nexport function* iteratePrototypeChain(object: Record<string, any>): Generator<Record<string, any>> {\n if (\n // if the below false, then object must be an instance\n !isPrototype(object) &&\n !isConstructor(object) &&\n // the two above depend on checking that typeof object is 'object',\n // so this last check is in case of arrow functions and generator functions\n object !== Function.prototype\n ) {\n yield object\n object = object.constructor.prototype\n }\n let objectOrNull: Record<string, any> | null = object\n while (objectOrNull) {\n yield objectOrNull\n objectOrNull = Reflect.getPrototypeOf(objectOrNull)\n }\n}\n","/**\n * Deep freezes an object, making it immutable by recursively freezing all nested objects and functions.\n * @returns The same object, but deeply frozen.\n * @throws If the object is not an object or function.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze | Object.freeze}\n * @param o The object to deep freeze.\n * This function uses `Object.freeze()` to freeze the object and all its nested objects and functions.\n * @example ```ts\n * const obj = {\n * prop1: 'value1',\n * prop2: {\n * nestedProp1: 'nestedValue1',\n * nestedProp2: {\n * deeplyNestedProp: 'deeplyNestedValue'\n * }\n * },\n * prop3: () => {\n * //=> Hello, world!\n * }\n * }\n * const frozenObj = objDeepFreeze(obj)\n * // Attempting to modify the frozen object will throw an error\n * frozenObj.prop1 //=> 'value1'\n * frozenObj.prop2.nestedProp1 //=> 'nestedValue1'\n * frozenObj.prop2.nestedProp2.deeplyNestedProp //=> 'deeplyNestedValue'\n * frozenObj.prop3() //=> undefined\n * ```\n */\nexport function objDeepFreeze(o: Record<string | symbol, any>): Record<string | symbol, any> {\n for (const key of Reflect.ownKeys(o)) {\n const value = o[key]\n if ((value && typeof value === 'object') || typeof value === 'function') {\n objDeepFreeze(value)\n }\n }\n return Object.freeze(o)\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Deletes a property from an object and returns the modified object.\n * @param obj The object from which to delete the property.\n * @template K - The type of the keys in the object.\n * @returns The modified object with the key deleted.\n * @param key The key of the property to delete.\n * @example ```ts\n * const obj = { name: 'John', age: 30 };\n * objDelete(obj, 'age');\n * //=> { name: 'John' }\n * ```\n */\nexport function objDelete<K extends ObjectKey, V>(obj: Record<K, V>, key: K): Omit<Record<K, V>, K> {\n delete obj[key]\n return obj\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an iterable of key-value pairs from the given object.\n * @remarks This function is a part of Object Utilities.\n * @typeparam V - The type of values in the object.\n * @returns An iterable of tuples where each tuple is a key-value pair from the object.\n * @param obj The object to iterate over.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * for (const [key, value] of objEntries(obj)) {\n * //=> a //=> b //=> c 3\n * }\n * ```\n */\nexport function* objEntries<V>(obj: Record<ObjectKey, V>): Iterable<[string, V]> {\n yield* Object.entries(obj)\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an array of key-value pairs from the given object.\n * @remarks This function is a utility for converting an object into an array of its entries.\n * Each entry is a tuple where the first element is the key and the second is the value.\n * @typeparam V - The type of the values in the object.\n * @returns An array of entries, where each entry is a tuple of a string and a value of type `V`.\n * @param obj The object to extract keyvalue pairs from.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * objEntriesArray(obj);\n * //=> [['a', 1], ['b', 2], ['c', 3]]\n * ```\n */\nexport function objEntriesArray<V>(obj: Record<ObjectKey, V>): Array<[string, V]> {\n return Array.from(Object.entries(obj))\n}\n","/**\n * Filters the properties of an object based on a callback function.\n * @param object The object to filter.\n * @param callback The callback function used to filter the object properties.\n * @template T - The type of the values in the object.\n * @param - The function to get the keys of the object. Defaults to `Object.keys`.\n * @returns A new object with the properties that passed the test. If no properties passed the test, an empty object will be returned.\n * @param getKeys The function used to get the keys of the object.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * objFilter(obj, (value, key) => value > 1);\n * //=> { b: 2, c: 3 }\n * ```\n */\nexport function objFilter<T>(\n object: Record<string, T>,\n callback: (value: T, key: string) => boolean,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): Record<string, T> {\n const result: Record<string, T> = {}\n for (const key of getKeys(object)) {\n if (callback(object[key], key)) {\n result[key] = object[key]\n }\n }\n return result\n}\n","/**\n * Applies a callback function to each key-value pair in an object.\n * @param object The object to iterate over.\n * @param callback The function to apply to each keyvalue pair.\n * @template T - The type of the object's properties.\n * @param - An optional function to determine the keys to iterate over. Defaults to `Object.keys`.\n * @returns The original object.\n * @param getKeys The function to retrieve the keys of the object.\n * @example ```ts\n * const myObject = { a: 1, b: 2, c: 3 };\n * objForEach(myObject, (value, key) => {\n * //=> ${key}: ${value}\n * });\n * ```\n */\nexport function objForEach<T>(\n object: Record<string, T>,\n callback: (value: T, key: string) => void,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): typeof object {\n for (const key of getKeys(object)) {\n callback(object[key], key)\n }\n return object\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Retrieves the value associated with the specified key from an object.\n * @param obj The object from which to retrieve the value.\n * @template K - The type of the keys in the object.\n * @returns The value of the specified key in the object, or `undefined` if the key does not exist.\n * @param key The key of the value to retrieve.\n * @example ```ts\n * const myObj = { name: 'John', age: 30 };\n * objGet(myObj, 'name');\n * //=> 'John'\n * objGet(myObj, 'age');\n * //=> 30\n * objGet(myObj, 'address');\n * //=> undefined\n * ```\n */\nexport function objGet<V>(obj: Record<ObjectKey, V>, key: ObjectKey): V | undefined {\n return obj[key]\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * This function attempts to retrieve a value from an object using a provided key.\n * If the key does not exist in the object, it uses a callback function to generate a default value.\n * @param obj The object from which to retrieve the value.\n * @param key The key to use when retrieving the value.\n * @param callback The function to call when the key does not exist in the object. This function should return the default value.\n * @returns The value associated with the key in the object, or the result of the callback function if the key does not exist in the object.\n * @example ```ts\n * objGetOrElse({ a: 1, b: 2 }, 'c', (key) => 3);;\n * //=> 3\n * ```\n * @typeparam V - The type of the values in the object.\n */\nexport function objGetOrElse<V>(obj: Record<ObjectKey, V>, key: ObjectKey, callback: (key: ObjectKey) => V): V {\n const value = obj[key]\n if (value !== undefined) return value\n return (obj[key] = callback(key))\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Checks if an object has a specific key.\n * @param obj The object to check.\n * @template K - The type of the keys in the object.\n * @returns Returns true if the object has the key, false otherwise.\n * @param key The key to check for.\n * @example ```ts\n * const myObj = { name: 'John', age: 30 };\n * objHas(myObj, 'name');\n * //=> true\n * objHas(myObj, 'email');\n * //=> false\n * ```\n */\nexport function objHas<V>(obj: Record<ObjectKey, V>, key: ObjectKey): boolean {\n return Object.hasOwn(obj, key)\n}\n","/**\n * Checks if an object is empty. This function iterates over the keys of the provided object and checks if any key is defined.\n * @remarks This function uses the `Object.keys()` method to check if the object has any keys.\n * If the object has at least one key, the function returns `false`, otherwise it returns `true`.\n * @typeparam T - The type of the values in the object.\n * @returns A boolean indicating whether the object is empty or not.\n * @param obj The object to check.\n * @example ```ts\n * const emptyObject = {};\n * const nonEmptyObject = { key: 'value' };\n * objIsEmpty(emptyObject);\n * //=> true\n * objIsEmpty(nonEmptyObject);\n * //=> false\n * ```\n */\nexport function objIsEmpty<T>(obj: Record<string, T>): boolean {\n for (const key of Object.keys(obj)) {\n if (key !== undefined) return false\n }\n return true\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an iterable of all the keys in the given object.\n * @remarks This function is a part of the `utils` module.\n * @typeparam V - The type of the values in the object.\n * @returns An iterable of the object's keys.\n * @param obj The object whose keys to iterate over.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * const keys = objKeys(obj);\n * for (const key of keys) {\n * //=> //=> //=> c\n * }\n * ```\n */\nexport function* objKeys<V>(obj: Record<ObjectKey, V>): Iterable<string> {\n yield* Object.keys(obj)\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an array of keys from the provided object.\n * @remarks This function is a part of Object Utilities.\n * @typeparam V - The type of values in the object.\n * @returns The array of keys of the input object.\n * @param obj The object from which to extract the keys.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * objKeysArray(obj);\n * //=> ['a', 'b', 'c']\n * ```\n */\nexport function objKeysArray<V>(obj: Record<ObjectKey, V>): string[] {\n return Array.from(Object.keys(obj))\n}\n","/**\n * Maps over the values of an object and returns a new object with the mapped values.\n * @param object The object to map over.\n * @param callback The mapping function to apply to each value.\n * @template T The type of the values in the input object.\n * @param An optional function to determine the keys to iterate over. Defaults to `Object.keys`.\n * @returns A new object with the same keys as the input object, but with each value transformed by the callback function.\n * @param getKeys The function used to get the keys of the object.\n * @example ```ts\n * const object = { a: 1, b: 2, c: 3 }\n * const callback = (value: number, key: string) => value * 2\n * objMap(object, callback) //=> { a: 2, b: 4, c: 6 }\n * ```\n */\nexport function objMap<T>(\n object: Record<string, T>,\n callback: (value: T, key: string) => T,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): Record<string, T> {\n const result: Record<string, T> = {}\n for (const key of getKeys(object)) {\n result[key] = callback(object[key], key)\n }\n return result\n}\n","/**\n * Maps the keys of an object using a callback function.\n * @param object The object whose keys will be mapped.\n * @param callback The callback function that maps the keys.\n * @template T - The type of the values in the object.\n * @param - The function to get the keys of the object.\n * @returns A new object with the keys mapped.\n * @param getKeys The function that retrieves the keys of the object.\n * @example ```ts\n * const object = { a: 1, b: 2, c: 3 };\n * const callback = (key: string, value: number) => key.toUpperCase();\n * objMapKeys(object, callback);\n * //=> { A: 1, B: 2, C: 3 }\n * ```\n */\nexport function objMapKeys<T>(\n object: Record<string, T>,\n callback: (key: string, value: T) => string,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): Record<string, T> {\n const result: Record<string, T> = {}\n for (const key of getKeys(object)) {\n result[callback(key, object[key])] = object[key]\n }\n return result\n}\n","/**\n * Applies a callback function to each key-value pair in an object and mutates the object.\n * @param object The object to be mapped.\n * @param callback The callback function to apply to each valuekey pair.\n * @template T - The type of the properties in the object.\n * @param - An optional function to determine the keys to be iterated over.\n * @returns The mutated object.\n * @param getKeys The function used to get the keys of the object.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * const callback = (value: number, key: string) => value * 2;\n * objMapMutable(obj, callback);\n * //=> { a: 2, b: 4, c: 6 }\n * ```\n */\nexport function objMapMutable<T>(\n object: Record<string, T>,\n callback: (value: T, key: string) => T,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): typeof object {\n for (const key of getKeys(object)) {\n object[key] = callback(object[key], key)\n }\n return object\n}\n","import { ObjectKey } from '../types/ObjectKey'\r\nimport { objFilter } from './objFilter'\r\n\r\n/**\r\n * Deletes specified keys from an object. This function takes an object and an array of keys to be deleted from the object. It returns a new object with the specified keys removed.\r\n * @param obj The object from which keys are to be deleted.\r\n * @template V - The type of the values in the object.\r\n * @returns A new object with the specified keys deleted.\r\n * @param keys The keys to be deleted from the object.\r\n * @example ```ts\r\n * const obj = { a: 1, b: 2, c: 3 };\r\n * objOmitKeys(obj, 'a', 'c');\r\n * //=> { b: 2 }\r\n * ```\r\n */\r\nexport function objOmitKeys<K extends ObjectKey, V>(obj: Record<K, V>, ...keys: string[]): Record<K, V> {\r\n return objFilter<any>(obj, (_, key: string) => !keys.includes(key)) as Record<K, V>\r\n}\r\n","/**\r\n * Deletes the specified keys from an object in a mutable way.\r\n * @param obj The object from which to delete the keys.\r\n * @returns The modified object with the specified keys deleted.\r\n * @typeparam V - The type of the values in the object.\r\n * @param keys The keys to delete from the object.\r\n * @example ```ts\r\n * const obj = { a: 1, b: 2, c: 3 };\r\n * objOmitKeysMutable(obj, 'a', 'c');\r\n * //=> { b: 2 }\r\n * ```\r\n */\r\nexport function objOmitKeysMutable<V>(obj: Record<string, V>, ...keys: string[]): Record<string, V> {\r\n for (const key of keys) {\r\n Reflect.deleteProperty(obj, key)\r\n }\r\n return obj\r\n}\r\n","import { ObjectKey } from '../types/ObjectKey'\r\n\r\n/**\r\n * Converts the specified properties of an object into getter functions.\r\n * @template K - The type of the keys of the object.\r\n * @template V - The type of the values of the object.\r\n * @template T - The type of the object.\r\n * @param object The object whose properties are to be converted into getter functions.\r\n * @param propertyNames The names of the properties to be converted into getter functions.\r\n * @returns The object with the specified properties converted into getter functions.\r\n * @throws Throws an error if the property descriptor for a specified property name is not found.\r\n * @example ```ts\r\n * const obj = { a: 1, b: 2, c: 3 };\r\n * objPropertyValueToGetter(obj, 'a', 'b');\r\n * obj.a;;\r\n * //=> 1\r\n * obj.b;;\r\n * //=> 2\r\n * obj.c;;\r\n * //=> 3\r\n * ```\r\n */\r\nexport function objPropertyValueToGetter<V, T extends Record<ObjectKey, V>>(\r\n object: T,\r\n ...propertyNames: ObjectKey[]\r\n): T {\r\n for (const propertyName of propertyNames) {\r\n const descriptor = Object.getOwnPropertyDescriptor(object, propertyName)\r\n if (!descriptor) throw new Error(`Property descriptor for '${String(propertyName)}' not found.`)\r\n const { enumerable, configurable, value } = descriptor\r\n Object.defineProperty(object, propertyName, { enumerable, configurable, get: () => value })\r\n }\r\n return object\r\n}\r\n","/**\n * Reduces the values of an object into a single value.\n * @param object The object to reduce.\n * @param callback The function that handles the reduction logic.\n * @param accum The initial value of the accumulator.\n * @template T - The type of the values in the input object.\n * @param - An optional function to get the keys of the object. Defaults to `Object.keys`.\n * @returns The final accumulated value.\n * @param getKeys The function that retrieves the keys of the object.\n * @example ```ts\n * const object = { a: 1, b: 2, c: 3 };\n * const callback = (accum, value, key) => accum + value;\n * const initialAccum = 0;\n * objReduce(object, callback, initialAccum);\n * //=> 6\n * ```\n */\nexport function objReduce<T, A>(\n object: Record<string, T>,\n callback: (accum: A, value: T, key: string) => A,\n accum: A,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): A {\n for (const key of getKeys(object)) {\n accum = callback(accum, object[key], key)\n }\n return accum\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objEntriesArray } from './objEntriesArray'\n\n/**\n * Reverses the order of the properties in the given object.\n * @remarks This function does not mutate the original object. It returns a new object with the properties in reverse order.\n * @param obj The object to reverse. The object's keys are of type `ObjectKey` and its values are of type `V`.\n * @returns A new object with the properties of the input object in reverse order. The returned object's keys are of type `ObjectKey` and its values are of type `V`.\n * @typeparam V - The type of the values in the input object and the returned object.\n * @example ```ts\n * objReverse({ a: 1, b: 2, c: 3 });;\n * //=> { c: 3, b: 2, a: 1 }\n * ```\n */\nexport function objReverse<V>(obj: Record<ObjectKey, V>): Record<ObjectKey, V> {\n return Object.fromEntries(objEntriesArray(obj).reverse())\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Sets a value for a key in an object and returns the value.\n * @template ObjectKey - The type of the keys in the object.\n * @template V - The type of the values in the object.\n * @param obj The object in which to set the value.\n * @param key The key for which to set the value.\n * @param value The value to set.\n * @returns The value that was set.\n * @example ```ts\n * objSet({ a: 1, b: 2 }, 'a', 3);;\n * //=> { a: 3, b: 2 }\n * ```\n */\nexport function objSet<V>(obj: Record<ObjectKey, V>, key: ObjectKey, value: V): V {\n return (obj[key] = value)\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Calculates and returns the size of the given object.\n * @remarks This function uses `Object.keys(obj).length` to determine the size of the object.\n * @param obj The object whose size is to be calculated.\n * @typeparam V - The type of the values in the object.\n * @returns The size of the object.\n * @example ```ts\n * objSize({ a: 1, b: 2, c: 3 });;\n * //=> 3\n * ```\n */\nexport function objSize<V>(obj: Record<ObjectKey, V>): number {\n return Object.keys(obj).length\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Sorts the keys of an object in alphabetical order.\n * @remarks This function does not mutate the original object. It returns a new object with sorted keys.\n * @typeparam V - The type of the values in the object.\n * @returns A new object with the same values as the original, but with keys sorted in ascending order.\n * @param o The object whose keys should be sorted.\n * @example ```ts\n * const obj = { c: 1, a: 2, b: 3 };\n * objSortKeys(obj);\n * //=> { a: 2, b: 3, c: 1 }\n * ```\n */\nexport function objSortKeys<V>(o: Record<ObjectKey, V>): Record<ObjectKey, V> {\n return Object.fromEntries(Object.entries(o).sort((a, b) => a[0].localeCompare(b[0])))\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Converts an object to a Map.\n * @remarks This function is useful when you need to convert an object to a Map data structure.\n * @typeparam V - The type of the values in the object.\n * @returns A new Map object populated with the [key, value] pairs from the original object.\n * @param obj The object to convert to a Map.\n * @example ```ts\n * const obj = { key1: 'value1', key2: 'value2' };\n * const map = objToMap(obj);\n * map.get('key1');\n * //=> 'value1'\n * map.get('key2');\n * //=> 'value2'\n * ```\n */\nexport function objToMap<V>(obj: Record<ObjectKey, V>): Map<string, V> {\n return new Map(Object.entries(obj))\n}\n","import { ObjectKey } from '../types/ObjectKey'\r\n\r\n/**\r\n * Updates the value of a specific key in an object using a callback function.\r\n * @template V - The type of the values in the object.\r\n * @param obj The object to update.\r\n * @param key The key of the value to update.\r\n * @param callback The function to generate the new value. It receives the current value and the key as arguments.\r\n * @returns The new value.\r\n * @example ```ts\r\n * objUpdate({ a: 1, b: 2 }, 'a', (value, key) => value + 1);;\r\n * //=> { a: 2, b: 2 }\r\n * ```\r\n */\r\nexport function objUpdate<V>(\r\n obj: Record<ObjectKey, V>,\r\n key: ObjectKey,\r\n callback: (value: V | undefined, key: ObjectKey) => V,\r\n): V {\r\n return (obj[key] = callback(obj[key], key))\r\n}\r\n","import { ObjectKey } from '../types/ObjectKey'\r\n\r\n/**\r\n * Updates the property descriptors of the specified properties on the given object.\r\n * @param object - The object whose property descriptors are to be updated.\r\n * @param properties - An array of property names for which the descriptors are to be updated.\r\n * @param update - A function that takes a property descriptor and a property name, and returns a new property descriptor.\r\n * @throws Will throw an error if any of the specified properties do not exist on the object.\r\n * @example ```ts\r\n * const obj = { a: 1, b: 2 };\r\n * objUpdatePropertyDescriptors(obj, ['a', 'b'], (descriptor, property) => {\r\n * descriptor.writable = true;\r\n * return obj;\r\n * });\r\n * ```\r\n */\r\nexport function objUpdatePropertyDescriptors<V>(\r\n object: Record<ObjectKey, V>,\r\n properties: string[],\r\n update: <T extends PropertyDescriptor>(descriptor: T, property: string) => T,\r\n): void {\r\n for (const p of properties) {\r\n if (!Object.hasOwn(object, p)) {\r\n throw new Error(`Property, '${p}' does not exist on object.`)\r\n }\r\n const descriptor = update(Object.getOwnPropertyDescriptor(object, p) as PropertyDescriptor, p)\r\n Object.defineProperty(object, p, descriptor)\r\n }\r\n}\r\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an iterable of the values of the given object.\n * @remarks This function uses the `Object.values()` method to get all the values of the object and then yields them one by one.\n * @typeparam V - The type of the values in the object.\n * @returns An iterable that yields all the values of the given object.\n * @param obj The object whose values should be returned.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * const values = objValues(obj);\n * for (const value of values) {\n * //=> {value}\n * }\n * // Output:\n * // 1\n * // 2\n * // 3\n * ```\n */\nexport function* objValues<V>(obj: Record<ObjectKey, V>): Iterable<V> {\n yield* Object.values(obj)\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an array containing the values of the given object.\n * @remarks This function is a part of Object Utilities.\n * @typeparam V - The type of values in the object.\n * @returns An array of the values of the object.\n * @param obj The object whose values will be extracted.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * objValuesArray(obj);\n * //=> [1, 2, 3]\n * ```\n */\nexport function objValuesArray<V>(obj: Record<ObjectKey, V>): Array<V> {\n return Array.from(Object.values(obj))\n}\n","/**\n * Recursively traverses an object and invokes a callback function for every encountered non-object value.\n * The callback function is passed the non-object value and an array representing the path to the value.\n * @param node - The object to be traversed.\n * @param callback - The callback function to be invoked for every non-object value.\n * @example ```ts\n * const obj = { a: 1, b: { c: 2, d: [3, 4] } };\n * objWalk(obj, (value, path) => {\n * console.log(`Path: ${path.join('.')}, Value: ${value}`);\n * });\n * // Output:\n * // Path: a, Value: 1\n * // Path: b.c, Value: 2\n * // Path: b.d[0], Value: 3\n * // Path: b.d[1], Value: 4\n * ```\n */\nexport function objWalk(node: Record<string, any>, callback: (value: any, path: string[]) => void): void {\n function recurse(node: Record<string, any>, path: string[] = []) {\n for (const [key, child] of Object.entries(node)) {\n if (typeof child === 'object' && child !== null) {\n if (Array.isArray(child)) {\n child.forEach((node, index) => {\n recurse(node, path.concat([`${key}[${index}]`]))\n })\n } else {\n recurse(child, path.concat(key))\n }\n } else {\n callback(child, path.concat(key))\n }\n }\n }\n recurse(node)\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objUpdatePropertyDescriptors } from './objUpdatePropertyDescriptors'\n\n/**\n * Sets the enumerable property of the specified properties of an object to true.\n * @template T - The type of the object.\n * @param object The object whose properties' enumerable property will be set to true.\n * @param propertyNames The names of the properties to be set enumerable.\n * @returns void\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * setEnumerable(obj, 'a', 'b');\n * Object.keys(obj);;\n * //=> ['a', 'b']\n * ```\n * @remarks This function uses `Object.defineProperty` to set the enumerable property.\n * @throws Will throw an error if any of the specified properties do not exist on the object.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty | Object.defineProperty}\n */\nexport function setEnumerable(object: Record<ObjectKey, any>, ...properties: string[]): void {\n objUpdatePropertyDescriptors(object, properties, (descriptor) => {\n descriptor.enumerable = true\n return descriptor\n })\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objUpdatePropertyDescriptors } from './objUpdatePropertyDescriptors'\n\n/**\n * Sets the specified properties of an object as non-configurable.\n * @remarks This function modifies the original object by setting the `configurable` attribute of the specified properties to `false`.\n * Once a property is made non-configurable, it can neither be deleted from the object nor changed to configurable.\n * @typeparam T - The type of the object.\n * @param object The object whose properties are to be made non-configurable.\n * @param properties The names of the properties to be made non-configurable.\n * @throws Will throw an error if any of the specified properties do not exist on the object.\n * @example ```ts\n * setNonConfigurable({ a: 1, b: 2, c: 3 }, 'a', 'b');\n * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'a');;\n * //=> {value: 1, writable: true, enumerable: true, configurable: false}\n * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'b');;\n * //=> {value: 2, writable: true, enumerable: true, configurable: false}\n * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'c');;\n * //=> {value: 3, writable: true, enumerable: true, configurable: true}\n * ```\n */\nexport function setNonConfigurable(object: Record<ObjectKey, any>, ...properties: string[]): void {\n objUpdatePropertyDescriptors(object, properties, (descriptor) => {\n descriptor.configurable = false\n return descriptor\n })\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objUpdatePropertyDescriptors } from './objUpdatePropertyDescriptors'\n\n/**\n * Sets the specified properties of an object as non-enumerable.\n * @remarks This function modifies the original object by setting the specified properties as non-enumerable.\n * If the object or any of the property names are not valid, it throws an error.\n * @param object The object whose properties are to be set as non-enumerable.\n * @param properties The names of the properties to be set as non-enumerable.\n * @throws Will throw an error if any of the specified properties do not exist on the object.\n * @example ```ts\n * setNonEnumerable({ a: 1, b: 2, c: 3 }, 'a', 'b');\n * Object.keys({ a: 1, b: 2, c: 3 });;\n * //=> ['c']\n * ```\n */\nexport function setNonEnumerable(object: Record<ObjectKey, any>, ...properties: string[]): void {\n objUpdatePropertyDescriptors(object, properties, (descriptor) => {\n descriptor.enumerable = false\n return descriptor\n })\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objUpdatePropertyDescriptors } from './objUpdatePropertyDescriptors'\n\n/**\n * Sets the specified properties of an object to be non-writable.\n * @template T - The type of the object.\n * @param object The object whose properties are to be made non-writable.\n * @param properties The names of the properties to be made non-writable.\n * @throws Will throw an error if any of the specified properties do not exist on the object.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * setNonWritable(obj, 'a', 'b');\n * obj;;\n * //=> { a: 1, b: 2, c: 3 }\n * obj.a = 10;;\n * //=> Throws an error\n * obj.b = 20;;\n * //=> Throws an error\n * obj.c = 30;;\n * //=> Works fine\n * ```\n */\nexport function setNonWritable(object: Record<ObjectKey, any>, ...properties: string[]): void {\n objUpdatePropertyDescriptors(object, properties, (descriptor) => {\n descriptor.writable = false\n return descriptor\n })\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objUpdatePropertyDescriptors } from './objUpdatePropertyDescriptors'\n\n/**\n * Sets the specified properties of an object to be writable.\n * @template T - The type of the object.\n * @param object The object whose properties are to be made writable.\n * @param propertyNames The names of the properties to be made writable.\n * @throws Will throw an error if any of the specified properties do not exist on the object.\n * @example ```ts\n * setWritable({ a: 1, b: 2 }, 'a', 'b').a = 3;;\n * //=> 3\n * setWritable({ a: 1, b: 2 }, 'a', 'b').b = 4;;\n * //=> 4\n * ```\n * @returns void\n */\nexport function setWritable(object: Record<ObjectKey, any>, ...properties: string[]): void {\n objUpdatePropertyDescriptors(object, properties, (descriptor) => {\n descriptor.writable = true\n return descriptor\n })\n}\n","/**\n * Converts the given data to a JSON string.\n * @template T - The type of the data to be converted to JSON.\n * @param data The data to be converted to JSON.\n * @param pretty Optional parameter that determines whether the resulting JSON string should be pretty-printed. Default is `false`.\n * @returns The JSON string representation of the given data.\n * @example ```ts\n * toJson({ name: 'John', age: 30 }, true);;\n * //=> \"{\\n \"name\": \"John\",\\n \"age\": 30\\n}\"\n * ```\n */\nexport function toJson<T>(data: T, pretty = false): string {\n return pretty ? JSON.stringify(data, null, 2) : JSON.stringify(data)\n}\n"],"names":["createObjectFactory","keys","defaultValues","numKeys","length","Error","values","o","i","value","Object","defineProperty","enumerable","writable","configurable","getConstructor","getPrototypeOf","constructor","inheritStaticMembers","target","source","ignoreKeys","ignore","Set","key","Reflect","ownKeys","has","des","getOwnPropertyDescriptor","iterableFirstElement","iterable","item","iteratePrototypeChain","object","isPrototype","isConstructor","Function","prototype","objectOrNull","objDeepFreeze","freeze","objDelete","obj","objEntries","entries","objEntriesArray","Array","from","objFilter","callback","getKeys","result","objForEach","objGet","objGetOrElse","objHas","hasOwn","objIsEmpty","objKeys","objKeysArray","objMap","objMapKeys","objMapMutable","objOmitKeys","_","includes","objOmitKeysMutable","deleteProperty","objPropertyValueToGetter","propertyNames","propertyName","descriptor","get","objReduce","accum","objReverse","fromEntries","reverse","objSet","objSize","objSortKeys","sort","a","b","localeCompare","objToMap","Map","objUpdate","objUpdatePropertyDescriptors","properties","update","p","objValues","objValuesArray","objWalk","node","recurse","path","child","isArray","forEach","index","concat","setEnumerable","setNonConfigurable","setNonEnumerable","setNonWritable","setWritable","toJson","data","pretty","JSON","stringify"],"mappings":";;;;0DAYgB,QAAA,CAAAA,mBAAmBA,CAAIC,IAAc,CAAEC,aAAmB,CAAA,CACxE,KAAM,CAAAC,OAAO,CAAGF,IAAI,CAACG,MAAM,CAC3B,GAAIF,aAAa,EAAIA,aAAa,CAACE,MAAM,CAAGD,OAAO,CACjD,KAAM,IAAI,CAA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C1DA,UAAU,CAAC3D,QAAQ,GAAO,CACnB2D,UAAU,CAClB,CACH,SCXgB,CAAAqC,MAAMA,CAAIC,IAAO,CAAEC,MAAM,GAAQ,CAAA,CAC/C,MAAO,CAAAA,MAAM,CAAGC,IAAI,CAACC,SAAS,CAACH,IAAI,CAAE,IAAI,CAAE,CAAC,CAAC,CAAGE,IAAI,CAACC,SAAS,CAACH,IAAI,CACrE"}
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/lib/createObjectFactory.ts","../src/lib/getConstructor.ts","../src/lib/inheritStaticMembers.ts","../src/lib/iterableFirstElement.ts","../src/lib/iteratePrototypeChain.ts","../src/lib/objDeepFreeze.ts","../src/lib/objDelete.ts","../src/lib/objEntries.ts","../src/lib/objEntriesArray.ts","../src/lib/objFilter.ts","../src/lib/objForEach.ts","../src/lib/objGet.ts","../src/lib/objGetOrElse.ts","../src/lib/objHas.ts","../src/lib/objIsEmpty.ts","../src/lib/objKeys.ts","../src/lib/objKeysArray.ts","../src/lib/objMap.ts","../src/lib/objMapKeys.ts","../src/lib/objMapMutable.ts","../src/lib/objOmitKeys.ts","../src/lib/objOmitKeysMutable.ts","../src/lib/objPropertyValueToGetter.ts","../src/lib/objReduce.ts","../src/lib/objReverse.ts","../src/lib/objSet.ts","../src/lib/objSize.ts","../src/lib/objSortKeys.ts","../src/lib/objToMap.ts","../src/lib/objUpdate.ts","../src/lib/objUpdatePropertyDescriptors.ts","../src/lib/objValues.ts","../src/lib/objValuesArray.ts","../src/lib/objWalk.ts","../src/lib/setEnumerable.ts","../src/lib/setNonConfigurable.ts","../src/lib/setNonEnumerable.ts","../src/lib/setNonWritable.ts","../src/lib/setWritable.ts","../src/lib/toJson.ts"],"sourcesContent":["/**\n * Creates a factory function for creating objects with specified keys and default values.\n * @template T The type of the values.\n * @param keys An array of strings representing the keys of the objects to be created.\n * @param defaultValues An optional array of default values for the keys. If provided, its length should not be larger than the length of the keys array.\n * @returns An `ObjectFactory` function. When called, this function takes an optional array of values and returns an object with the specified keys and values. If the values array is not provided or if a value is `undefined`, the corresponding default value is used.\n * @throws If the length of the `defaultValues` array is larger than the length of the `keys` array, or if the length of the `values` array passed to the factory function is larger than the length of the `keys` array.\n * @example ```ts\n * createObjectFactory(['key1', 'key2'], ['default1', 'default2'])(['value1']);\n * //=> { key1: 'value1', key2: 'default2' }\n * ```\n */\nexport function createObjectFactory<T>(keys: string[], defaultValues?: T[]): (values?: T[]) => Record<string, T> {\n const numKeys = keys.length\n if (defaultValues && defaultValues.length > numKeys) {\n throw new Error('defaultValues length larger than keys length.')\n }\n return function factory(values?: T[]) {\n if (values && values.length > numKeys) {\n throw new Error('values length larger than keys length.')\n }\n const o = {}\n for (let i = 0; i < numKeys; i++) {\n let value\n if (values) {\n value = values[i]\n if (value === undefined && defaultValues) {\n value = defaultValues[i]\n }\n } else if (defaultValues) {\n value = defaultValues[i]\n }\n Object.defineProperty(o, keys[i], {\n enumerable: true,\n writable: true,\n configurable: true,\n value,\n })\n }\n return o\n }\n}\n","import type { ConstructorOf } from '../types/ConstructorOf'\n\n/**\n * Returns the constructor of the given object.\n * @template T - The type of the object.\n * @param o The object whose constructor is to be returned.\n * @returns The constructor of the object.\n * @example ```ts\n * class MyClass {}\n * getConstructor(new MyClass()) === MyClass;;\n * //=> true\n * ```\n */\nexport function getConstructor<T>(o: T): ConstructorOf<T> {\n return Object.getPrototypeOf(o).constructor\n}\n","import type { Constructor } from '../types/Constructor'\n\n/**\n * Copies static members from a source constructor to a target constructor, excluding specified keys.\n * @param target The target constructor to inherit static members.\n * @param source The source constructor to copy static members from.\n * @param ignoreKeys An optional array of keys to exclude from copying.\n * @returns The target constructor with the inherited static members.\n * @throws If `target` or `source` is not a constructor.\n * @param - The keys that should not be inherited.\n * @example ```ts\n * class Parent {\n * static parentStaticMethod() {\n * return 'Parent static method'\n * }\n * }\n * class Child {\n * static childStaticMethod() {\n * return 'Child static method'\n * }\n * }\n * inheritStaticMembers(Child, Parent)\n * Child.parentStaticMethod() //=> 'Parent static method'\n * ```\n */\nexport function inheritStaticMembers(target: Constructor, source: Constructor, ignoreKeys: string[] = []): Constructor {\n const ignore: Set<string | symbol> = new Set([...ignoreKeys, 'prototype', 'name', 'constructor'])\n for (const key of Reflect.ownKeys(source)) {\n if (ignore.has(key)) continue\n if (Reflect.has(target, key)) continue\n const des = Object.getOwnPropertyDescriptor(source, key)\n Object.defineProperty(target, key, des as PropertyDescriptor)\n }\n return target\n}\n","/**\n * Returns the first element of an iterable object.\n * @template T - The type of elements in the iterable.\n * @param iterable The iterable object.\n * @returns The first element of the iterable object, or `undefined` if the iterable is empty.\n * @example ```ts\n * iterableFirstElement([1, 2, 3, 4, 5]);;\n * //=> 1\n * ```\n */\nexport function iterableFirstElement<T>(iterable: Iterable<T>): T | undefined {\n for (const item of iterable) return item\n}\n","import { isConstructor, isPrototype } from '@bemoje/validation'\n\n/**\n * Iterate the prototype chain of a given object.\n * @remarks This function uses the `Reflect.getPrototypeOf` method to traverse the prototype chain.\n * It also uses the `isPrototype` and `isConstructor` helper functions to determine whether\n * the given object is a prototype or a constructor function.\n * @param object The object whose prototype chain is to be iterated over.\n * @throws If the provided object is not an object or a function, a TypeError will be thrown.\n * @returns A generator that yields each prototype in the chain.\n * @example ```ts\n * class A {}\n * class B extends A {}\n * class C extends B {}\n * const instance = new C()\n * iteratePrototypeChain(C)\n * //=> [ C, B, A, Function.prototype, Object.prototype]\n * iteratePrototypeChain(C.prototype)\n * //=> [C.prototype, B.prototype, A.prototype, Object.prototype]\n * iteratePrototypeChain(instance)\n * //=> [instance, C.prototype, B.prototype, A.prototype, Object.prototype]\n * ```\n */\nexport function* iteratePrototypeChain(object: Record<string, any>): Generator<Record<string, any>> {\n if (\n // if the below false, then object must be an instance\n !isPrototype(object) &&\n !isConstructor(object) &&\n // the two above depend on checking that typeof object is 'object',\n // so this last check is in case of arrow functions and generator functions\n object !== Function.prototype\n ) {\n yield object\n object = object.constructor.prototype\n }\n let objectOrNull: Record<string, any> | null = object\n while (objectOrNull) {\n yield objectOrNull\n objectOrNull = Reflect.getPrototypeOf(objectOrNull)\n }\n}\n","/**\n * Deep freezes an object, making it immutable by recursively freezing all nested objects and functions.\n * @returns The same object, but deeply frozen.\n * @throws If the object is not an object or function.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze | Object.freeze}\n * @param o The object to deep freeze.\n * This function uses `Object.freeze()` to freeze the object and all its nested objects and functions.\n * @example ```ts\n * const obj = {\n * prop1: 'value1',\n * prop2: {\n * nestedProp1: 'nestedValue1',\n * nestedProp2: {\n * deeplyNestedProp: 'deeplyNestedValue'\n * }\n * },\n * prop3: () => {\n * //=> Hello, world!\n * }\n * }\n * const frozenObj = objDeepFreeze(obj)\n * // Attempting to modify the frozen object will throw an error\n * frozenObj.prop1 //=> 'value1'\n * frozenObj.prop2.nestedProp1 //=> 'nestedValue1'\n * frozenObj.prop2.nestedProp2.deeplyNestedProp //=> 'deeplyNestedValue'\n * frozenObj.prop3() //=> undefined\n * ```\n */\nexport function objDeepFreeze(o: Record<string | symbol, any>): Record<string | symbol, any> {\n for (const key of Reflect.ownKeys(o)) {\n const value = o[key]\n if ((value && typeof value === 'object') || typeof value === 'function') {\n objDeepFreeze(value)\n }\n }\n return Object.freeze(o)\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Deletes a property from an object and returns the modified object.\n * @param obj The object from which to delete the property.\n * @template K - The type of the keys in the object.\n * @returns The modified object with the key deleted.\n * @param key The key of the property to delete.\n * @example ```ts\n * const obj = { name: 'John', age: 30 };\n * objDelete(obj, 'age');\n * //=> { name: 'John' }\n * ```\n */\nexport function objDelete<K extends ObjectKey, V>(obj: Record<K, V>, key: K): Omit<Record<K, V>, K> {\n delete obj[key]\n return obj\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an iterable of key-value pairs from the given object.\n * @remarks This function is a part of Object Utilities.\n * @typeparam V - The type of values in the object.\n * @returns An iterable of tuples where each tuple is a key-value pair from the object.\n * @param obj The object to iterate over.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * for (const [key, value] of objEntries(obj)) {\n * //=> a //=> b //=> c 3\n * }\n * ```\n */\nexport function* objEntries<V>(obj: Record<ObjectKey, V>): Iterable<[string, V]> {\n yield* Object.entries(obj)\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an array of key-value pairs from the given object.\n * @remarks This function is a utility for converting an object into an array of its entries.\n * Each entry is a tuple where the first element is the key and the second is the value.\n * @typeparam V - The type of the values in the object.\n * @returns An array of entries, where each entry is a tuple of a string and a value of type `V`.\n * @param obj The object to extract keyvalue pairs from.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * objEntriesArray(obj);\n * //=> [['a', 1], ['b', 2], ['c', 3]]\n * ```\n */\nexport function objEntriesArray<V>(obj: Record<ObjectKey, V>): Array<[string, V]> {\n return Array.from(Object.entries(obj))\n}\n","/**\n * Filters the properties of an object based on a callback function.\n * @param object The object to filter.\n * @param callback The callback function used to filter the object properties.\n * @template T - The type of the values in the object.\n * @param - The function to get the keys of the object. Defaults to `Object.keys`.\n * @returns A new object with the properties that passed the test. If no properties passed the test, an empty object will be returned.\n * @param getKeys The function used to get the keys of the object.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * objFilter(obj, (value, key) => value > 1);\n * //=> { b: 2, c: 3 }\n * ```\n */\nexport function objFilter<T>(\n object: Record<string, T>,\n callback: (value: T, key: string) => boolean,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): Record<string, T> {\n const result: Record<string, T> = {}\n for (const key of getKeys(object)) {\n if (callback(object[key], key)) {\n result[key] = object[key]\n }\n }\n return result\n}\n","/**\n * Applies a callback function to each key-value pair in an object.\n * @param object The object to iterate over.\n * @param callback The function to apply to each keyvalue pair.\n * @template T - The type of the object's properties.\n * @param - An optional function to determine the keys to iterate over. Defaults to `Object.keys`.\n * @returns The original object.\n * @param getKeys The function to retrieve the keys of the object.\n * @example ```ts\n * const myObject = { a: 1, b: 2, c: 3 };\n * objForEach(myObject, (value, key) => {\n * //=> ${key}: ${value}\n * });\n * ```\n */\nexport function objForEach<T>(\n object: Record<string, T>,\n callback: (value: T, key: string) => void,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): typeof object {\n for (const key of getKeys(object)) {\n callback(object[key], key)\n }\n return object\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Retrieves the value associated with the specified key from an object.\n * @param obj The object from which to retrieve the value.\n * @template K - The type of the keys in the object.\n * @returns The value of the specified key in the object, or `undefined` if the key does not exist.\n * @param key The key of the value to retrieve.\n * @example ```ts\n * const myObj = { name: 'John', age: 30 };\n * objGet(myObj, 'name');\n * //=> 'John'\n * objGet(myObj, 'age');\n * //=> 30\n * objGet(myObj, 'address');\n * //=> undefined\n * ```\n */\nexport function objGet<V>(obj: Record<ObjectKey, V>, key: ObjectKey): V | undefined {\n return obj[key]\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * This function attempts to retrieve a value from an object using a provided key.\n * If the key does not exist in the object, it uses a callback function to generate a default value.\n * @param obj The object from which to retrieve the value.\n * @param key The key to use when retrieving the value.\n * @param callback The function to call when the key does not exist in the object. This function should return the default value.\n * @returns The value associated with the key in the object, or the result of the callback function if the key does not exist in the object.\n * @example ```ts\n * objGetOrElse({ a: 1, b: 2 }, 'c', (key) => 3);;\n * //=> 3\n * ```\n * @typeparam V - The type of the values in the object.\n */\nexport function objGetOrElse<V>(obj: Record<ObjectKey, V>, key: ObjectKey, callback: (key: ObjectKey) => V): V {\n const value = obj[key]\n if (value !== undefined) return value\n return (obj[key] = callback(key))\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Checks if an object has a specific key.\n * @param obj The object to check.\n * @template K - The type of the keys in the object.\n * @returns Returns true if the object has the key, false otherwise.\n * @param key The key to check for.\n * @example ```ts\n * const myObj = { name: 'John', age: 30 };\n * objHas(myObj, 'name');\n * //=> true\n * objHas(myObj, 'email');\n * //=> false\n * ```\n */\nexport function objHas<V>(obj: Record<ObjectKey, V>, key: ObjectKey): boolean {\n return Object.hasOwn(obj, key)\n}\n","/**\n * Checks if an object is empty. This function iterates over the keys of the provided object and checks if any key is defined.\n * @remarks This function uses the `Object.keys()` method to check if the object has any keys.\n * If the object has at least one key, the function returns `false`, otherwise it returns `true`.\n * @typeparam T - The type of the values in the object.\n * @returns A boolean indicating whether the object is empty or not.\n * @param obj The object to check.\n * @example ```ts\n * const emptyObject = {};\n * const nonEmptyObject = { key: 'value' };\n * objIsEmpty(emptyObject);\n * //=> true\n * objIsEmpty(nonEmptyObject);\n * //=> false\n * ```\n */\nexport function objIsEmpty<T>(obj: Record<string, T>): boolean {\n for (const key of Object.keys(obj)) {\n if (key !== undefined) return false\n }\n return true\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an iterable of all the keys in the given object.\n * @remarks This function is a part of the `utils` module.\n * @typeparam V - The type of the values in the object.\n * @returns An iterable of the object's keys.\n * @param obj The object whose keys to iterate over.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * const keys = objKeys(obj);\n * for (const key of keys) {\n * //=> //=> //=> c\n * }\n * ```\n */\nexport function* objKeys<V>(obj: Record<ObjectKey, V>): Iterable<string> {\n yield* Object.keys(obj)\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an array of keys from the provided object.\n * @remarks This function is a part of Object Utilities.\n * @typeparam V - The type of values in the object.\n * @returns The array of keys of the input object.\n * @param obj The object from which to extract the keys.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * objKeysArray(obj);\n * //=> ['a', 'b', 'c']\n * ```\n */\nexport function objKeysArray<V>(obj: Record<ObjectKey, V>): string[] {\n return Array.from(Object.keys(obj))\n}\n","/**\n * Maps over the values of an object and returns a new object with the mapped values.\n * @param object The object to map over.\n * @param callback The mapping function to apply to each value.\n * @template T The type of the values in the input object.\n * @param An optional function to determine the keys to iterate over. Defaults to `Object.keys`.\n * @returns A new object with the same keys as the input object, but with each value transformed by the callback function.\n * @param getKeys The function used to get the keys of the object.\n * @example ```ts\n * const object = { a: 1, b: 2, c: 3 }\n * const callback = (value: number, key: string) => value * 2\n * objMap(object, callback) //=> { a: 2, b: 4, c: 6 }\n * ```\n */\nexport function objMap<T>(\n object: Record<string, T>,\n callback: (value: T, key: string) => T,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): Record<string, T> {\n const result: Record<string, T> = {}\n for (const key of getKeys(object)) {\n result[key] = callback(object[key], key)\n }\n return result\n}\n","/**\n * Maps the keys of an object using a callback function.\n * @param object The object whose keys will be mapped.\n * @param callback The callback function that maps the keys.\n * @template T - The type of the values in the object.\n * @param - The function to get the keys of the object.\n * @returns A new object with the keys mapped.\n * @param getKeys The function that retrieves the keys of the object.\n * @example ```ts\n * const object = { a: 1, b: 2, c: 3 };\n * const callback = (key: string, value: number) => key.toUpperCase();\n * objMapKeys(object, callback);\n * //=> { A: 1, B: 2, C: 3 }\n * ```\n */\nexport function objMapKeys<T>(\n object: Record<string, T>,\n callback: (key: string, value: T) => string,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): Record<string, T> {\n const result: Record<string, T> = {}\n for (const key of getKeys(object)) {\n result[callback(key, object[key])] = object[key]\n }\n return result\n}\n","/**\n * Applies a callback function to each key-value pair in an object and mutates the object.\n * @param object The object to be mapped.\n * @param callback The callback function to apply to each valuekey pair.\n * @template T - The type of the properties in the object.\n * @param - An optional function to determine the keys to be iterated over.\n * @returns The mutated object.\n * @param getKeys The function used to get the keys of the object.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * const callback = (value: number, key: string) => value * 2;\n * objMapMutable(obj, callback);\n * //=> { a: 2, b: 4, c: 6 }\n * ```\n */\nexport function objMapMutable<T>(\n object: Record<string, T>,\n callback: (value: T, key: string) => T,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): typeof object {\n for (const key of getKeys(object)) {\n object[key] = callback(object[key], key)\n }\n return object\n}\n","import { ObjectKey } from '../types/ObjectKey'\r\nimport { objFilter } from './objFilter'\r\n\r\n/**\r\n * Deletes specified keys from an object. This function takes an object and an array of keys to be deleted from the object. It returns a new object with the specified keys removed.\r\n * @param obj The object from which keys are to be deleted.\r\n * @template V - The type of the values in the object.\r\n * @returns A new object with the specified keys deleted.\r\n * @param keys The keys to be deleted from the object.\r\n * @example ```ts\r\n * const obj = { a: 1, b: 2, c: 3 };\r\n * objOmitKeys(obj, 'a', 'c');\r\n * //=> { b: 2 }\r\n * ```\r\n */\r\nexport function objOmitKeys<K extends ObjectKey, V>(obj: Record<K, V>, ...keys: string[]): Record<K, V> {\r\n return objFilter<any>(obj, (_, key: string) => !keys.includes(key)) as Record<K, V>\r\n}\r\n","/**\r\n * Deletes the specified keys from an object in a mutable way.\r\n * @param obj The object from which to delete the keys.\r\n * @returns The modified object with the specified keys deleted.\r\n * @typeparam V - The type of the values in the object.\r\n * @param keys The keys to delete from the object.\r\n * @example ```ts\r\n * const obj = { a: 1, b: 2, c: 3 };\r\n * objOmitKeysMutable(obj, 'a', 'c');\r\n * //=> { b: 2 }\r\n * ```\r\n */\r\nexport function objOmitKeysMutable<V>(obj: Record<string, V>, ...keys: string[]): Record<string, V> {\r\n for (const key of keys) {\r\n Reflect.deleteProperty(obj, key)\r\n }\r\n return obj\r\n}\r\n","import { ObjectKey } from '../types/ObjectKey'\r\n\r\n/**\r\n * Converts the specified properties of an object into getter functions.\r\n * @template K - The type of the keys of the object.\r\n * @template V - The type of the values of the object.\r\n * @template T - The type of the object.\r\n * @param object The object whose properties are to be converted into getter functions.\r\n * @param propertyNames The names of the properties to be converted into getter functions.\r\n * @returns The object with the specified properties converted into getter functions.\r\n * @throws Throws an error if the property descriptor for a specified property name is not found.\r\n * @example ```ts\r\n * const obj = { a: 1, b: 2, c: 3 };\r\n * objPropertyValueToGetter(obj, 'a', 'b');\r\n * obj.a;;\r\n * //=> 1\r\n * obj.b;;\r\n * //=> 2\r\n * obj.c;;\r\n * //=> 3\r\n * ```\r\n */\r\nexport function objPropertyValueToGetter<V, T extends Record<ObjectKey, V>>(\r\n object: T,\r\n ...propertyNames: ObjectKey[]\r\n): T {\r\n for (const propertyName of propertyNames) {\r\n const descriptor = Object.getOwnPropertyDescriptor(object, propertyName)\r\n if (!descriptor) throw new Error(`Property descriptor for '${String(propertyName)}' not found.`)\r\n const { enumerable, configurable, value } = descriptor\r\n Object.defineProperty(object, propertyName, { enumerable, configurable, get: () => value })\r\n }\r\n return object\r\n}\r\n","/**\n * Reduces the values of an object into a single value.\n * @param object The object to reduce.\n * @param callback The function that handles the reduction logic.\n * @param accum The initial value of the accumulator.\n * @template T - The type of the values in the input object.\n * @param - An optional function to get the keys of the object. Defaults to `Object.keys`.\n * @returns The final accumulated value.\n * @param getKeys The function that retrieves the keys of the object.\n * @example ```ts\n * const object = { a: 1, b: 2, c: 3 };\n * const callback = (accum, value, key) => accum + value;\n * const initialAccum = 0;\n * objReduce(object, callback, initialAccum);\n * //=> 6\n * ```\n */\nexport function objReduce<T, A>(\n object: Record<string, T>,\n callback: (accum: A, value: T, key: string) => A,\n accum: A,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): A {\n for (const key of getKeys(object)) {\n accum = callback(accum, object[key], key)\n }\n return accum\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objEntriesArray } from './objEntriesArray'\n\n/**\n * Reverses the order of the properties in the given object.\n * @remarks This function does not mutate the original object. It returns a new object with the properties in reverse order.\n * @param obj The object to reverse. The object's keys are of type `ObjectKey` and its values are of type `V`.\n * @returns A new object with the properties of the input object in reverse order. The returned object's keys are of type `ObjectKey` and its values are of type `V`.\n * @typeparam V - The type of the values in the input object and the returned object.\n * @example ```ts\n * objReverse({ a: 1, b: 2, c: 3 });;\n * //=> { c: 3, b: 2, a: 1 }\n * ```\n */\nexport function objReverse<V>(obj: Record<ObjectKey, V>): Record<ObjectKey, V> {\n return Object.fromEntries(objEntriesArray(obj).reverse())\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Sets a value for a key in an object and returns the value.\n * @template ObjectKey - The type of the keys in the object.\n * @template V - The type of the values in the object.\n * @param obj The object in which to set the value.\n * @param key The key for which to set the value.\n * @param value The value to set.\n * @returns The value that was set.\n * @example ```ts\n * objSet({ a: 1, b: 2 }, 'a', 3);;\n * //=> { a: 3, b: 2 }\n * ```\n */\nexport function objSet<V>(obj: Record<ObjectKey, V>, key: ObjectKey, value: V): V {\n return (obj[key] = value)\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Calculates and returns the size of the given object.\n * @remarks This function uses `Object.keys(obj).length` to determine the size of the object.\n * @param obj The object whose size is to be calculated.\n * @typeparam V - The type of the values in the object.\n * @returns The size of the object.\n * @example ```ts\n * objSize({ a: 1, b: 2, c: 3 });;\n * //=> 3\n * ```\n */\nexport function objSize<V>(obj: Record<ObjectKey, V>): number {\n return Object.keys(obj).length\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Sorts the keys of an object in alphabetical order.\n * @remarks This function does not mutate the original object. It returns a new object with sorted keys.\n * @typeparam V - The type of the values in the object.\n * @returns A new object with the same values as the original, but with keys sorted in ascending order.\n * @param o The object whose keys should be sorted.\n * @example ```ts\n * const obj = { c: 1, a: 2, b: 3 };\n * objSortKeys(obj);\n * //=> { a: 2, b: 3, c: 1 }\n * ```\n */\nexport function objSortKeys<V>(o: Record<ObjectKey, V>): Record<ObjectKey, V> {\n return Object.fromEntries(Object.entries(o).sort((a, b) => a[0].localeCompare(b[0])))\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Converts an object to a Map.\n * @remarks This function is useful when you need to convert an object to a Map data structure.\n * @typeparam V - The type of the values in the object.\n * @returns A new Map object populated with the [key, value] pairs from the original object.\n * @param obj The object to convert to a Map.\n * @example ```ts\n * const obj = { key1: 'value1', key2: 'value2' };\n * const map = objToMap(obj);\n * map.get('key1');\n * //=> 'value1'\n * map.get('key2');\n * //=> 'value2'\n * ```\n */\nexport function objToMap<V>(obj: Record<ObjectKey, V>): Map<string, V> {\n return new Map(Object.entries(obj))\n}\n","import { ObjectKey } from '../types/ObjectKey'\r\n\r\n/**\r\n * Updates the value of a specific key in an object using a callback function.\r\n * @template V - The type of the values in the object.\r\n * @param obj The object to update.\r\n * @param key The key of the value to update.\r\n * @param callback The function to generate the new value. It receives the current value and the key as arguments.\r\n * @returns The new value.\r\n * @example ```ts\r\n * objUpdate({ a: 1, b: 2 }, 'a', (value, key) => value + 1);;\r\n * //=> { a: 2, b: 2 }\r\n * ```\r\n */\r\nexport function objUpdate<V>(\r\n obj: Record<ObjectKey, V>,\r\n key: ObjectKey,\r\n callback: (value: V | undefined, key: ObjectKey) => V,\r\n): V {\r\n return (obj[key] = callback(obj[key], key))\r\n}\r\n","import { ObjectKey } from '../types/ObjectKey'\r\n\r\n/**\r\n * Updates the property descriptors of the specified properties on the given object.\r\n * @param object - The object whose property descriptors are to be updated.\r\n * @param properties - An array of property names for which the descriptors are to be updated.\r\n * @param update - A function that takes a property descriptor and a property name, and returns a new property descriptor.\r\n * @throws Will throw an error if any of the specified properties do not exist on the object.\r\n * @example ```ts\r\n * const obj = { a: 1, b: 2 };\r\n * objUpdatePropertyDescriptors(obj, ['a', 'b'], (descriptor, property) => {\r\n * descriptor.writable = true;\r\n * return obj;\r\n * });\r\n * ```\r\n */\r\nexport function objUpdatePropertyDescriptors<V>(\r\n object: Record<ObjectKey, V>,\r\n properties: string[],\r\n update: <T extends PropertyDescriptor>(descriptor: T, property: string) => T,\r\n): void {\r\n for (const p of properties) {\r\n if (!Object.hasOwn(object, p)) {\r\n throw new Error(`Property, '${p}' does not exist on object.`)\r\n }\r\n const descriptor = update(Object.getOwnPropertyDescriptor(object, p) as PropertyDescriptor, p)\r\n Object.defineProperty(object, p, descriptor)\r\n }\r\n}\r\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an iterable of the values of the given object.\n * @remarks This function uses the `Object.values()` method to get all the values of the object and then yields them one by one.\n * @typeparam V - The type of the values in the object.\n * @returns An iterable that yields all the values of the given object.\n * @param obj The object whose values should be returned.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * const values = objValues(obj);\n * for (const value of values) {\n * //=> {value}\n * }\n * // Output:\n * // 1\n * // 2\n * // 3\n * ```\n */\nexport function* objValues<V>(obj: Record<ObjectKey, V>): Iterable<V> {\n yield* Object.values(obj)\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an array containing the values of the given object.\n * @remarks This function is a part of Object Utilities.\n * @typeparam V - The type of values in the object.\n * @returns An array of the values of the object.\n * @param obj The object whose values will be extracted.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * objValuesArray(obj);\n * //=> [1, 2, 3]\n * ```\n */\nexport function objValuesArray<V>(obj: Record<ObjectKey, V>): Array<V> {\n return Array.from(Object.values(obj))\n}\n","/**\n * Recursively traverses an object and invokes a callback function for every encountered non-object value.\n * The callback function is passed the non-object value and an array representing the path to the value.\n * @param node - The object to be traversed.\n * @param callback - The callback function to be invoked for every non-object value.\n * @example ```ts\n * const obj = { a: 1, b: { c: 2, d: [3, 4] } };\n * objWalk(obj, (value, path) => {\n * console.log(`Path: ${path.join('.')}, Value: ${value}`);\n * });\n * // Output:\n * // Path: a, Value: 1\n * // Path: b.c, Value: 2\n * // Path: b.d[0], Value: 3\n * // Path: b.d[1], Value: 4\n * ```\n */\nexport function objWalk(node: Record<string, any>, callback: (value: any, path: string[]) => void): void {\n function recurse(node: Record<string, any>, path: string[] = []) {\n for (const [key, child] of Object.entries(node)) {\n if (typeof child === 'object' && child !== null) {\n if (Array.isArray(child)) {\n child.forEach((node, index) => {\n recurse(node, path.concat([`${key}[${index}]`]))\n })\n } else {\n recurse(child, path.concat(key))\n }\n } else {\n callback(child, path.concat(key))\n }\n }\n }\n recurse(node)\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objUpdatePropertyDescriptors } from './objUpdatePropertyDescriptors'\n\n/**\n * Sets the enumerable property of the specified properties of an object to true.\n * @template T - The type of the object.\n * @param object The object whose properties' enumerable property will be set to true.\n * @param propertyNames The names of the properties to be set enumerable.\n * @returns void\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * setEnumerable(obj, 'a', 'b');\n * Object.keys(obj);;\n * //=> ['a', 'b']\n * ```\n * @remarks This function uses `Object.defineProperty` to set the enumerable property.\n * @throws Will throw an error if any of the specified properties do not exist on the object.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty | Object.defineProperty}\n */\nexport function setEnumerable(object: Record<ObjectKey, any>, ...properties: string[]): void {\n objUpdatePropertyDescriptors(object, properties, (descriptor) => {\n descriptor.enumerable = true\n return descriptor\n })\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objUpdatePropertyDescriptors } from './objUpdatePropertyDescriptors'\n\n/**\n * Sets the specified properties of an object as non-configurable.\n * @remarks This function modifies the original object by setting the `configurable` attribute of the specified properties to `false`.\n * Once a property is made non-configurable, it can neither be deleted from the object nor changed to configurable.\n * @typeparam T - The type of the object.\n * @param object The object whose properties are to be made non-configurable.\n * @param properties The names of the properties to be made non-configurable.\n * @throws Will throw an error if any of the specified properties do not exist on the object.\n * @example ```ts\n * setNonConfigurable({ a: 1, b: 2, c: 3 }, 'a', 'b');\n * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'a');;\n * //=> {value: 1, writable: true, enumerable: true, configurable: false}\n * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'b');;\n * //=> {value: 2, writable: true, enumerable: true, configurable: false}\n * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'c');;\n * //=> {value: 3, writable: true, enumerable: true, configurable: true}\n * ```\n */\nexport function setNonConfigurable(object: Record<ObjectKey, any>, ...properties: string[]): void {\n objUpdatePropertyDescriptors(object, properties, (descriptor) => {\n descriptor.configurable = false\n return descriptor\n })\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objUpdatePropertyDescriptors } from './objUpdatePropertyDescriptors'\n\n/**\n * Sets the specified properties of an object as non-enumerable.\n * @remarks This function modifies the original object by setting the specified properties as non-enumerable.\n * If the object or any of the property names are not valid, it throws an error.\n * @param object The object whose properties are to be set as non-enumerable.\n * @param properties The names of the properties to be set as non-enumerable.\n * @throws Will throw an error if any of the specified properties do not exist on the object.\n * @example ```ts\n * setNonEnumerable({ a: 1, b: 2, c: 3 }, 'a', 'b');\n * Object.keys({ a: 1, b: 2, c: 3 });;\n * //=> ['c']\n * ```\n */\nexport function setNonEnumerable(object: Record<ObjectKey, any>, ...properties: string[]): void {\n objUpdatePropertyDescriptors(object, properties, (descriptor) => {\n descriptor.enumerable = false\n return descriptor\n })\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objUpdatePropertyDescriptors } from './objUpdatePropertyDescriptors'\n\n/**\n * Sets the specified properties of an object to be non-writable.\n * @template T - The type of the object.\n * @param object The object whose properties are to be made non-writable.\n * @param properties The names of the properties to be made non-writable.\n * @throws Will throw an error if any of the specified properties do not exist on the object.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * setNonWritable(obj, 'a', 'b');\n * obj;;\n * //=> { a: 1, b: 2, c: 3 }\n * obj.a = 10;;\n * //=> Throws an error\n * obj.b = 20;;\n * //=> Throws an error\n * obj.c = 30;;\n * //=> Works fine\n * ```\n */\nexport function setNonWritable(object: Record<ObjectKey, any>, ...properties: string[]): void {\n objUpdatePropertyDescriptors(object, properties, (descriptor) => {\n descriptor.writable = false\n return descriptor\n })\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objUpdatePropertyDescriptors } from './objUpdatePropertyDescriptors'\n\n/**\n * Sets the specified properties of an object to be writable.\n * @template T - The type of the object.\n * @param object The object whose properties are to be made writable.\n * @param propertyNames The names of the properties to be made writable.\n * @throws Will throw an error if any of the specified properties do not exist on the object.\n * @example ```ts\n * setWritable({ a: 1, b: 2 }, 'a', 'b').a = 3;;\n * //=> 3\n * setWritable({ a: 1, b: 2 }, 'a', 'b').b = 4;;\n * //=> 4\n * ```\n * @returns void\n */\nexport function setWritable(object: Record<ObjectKey, any>, ...properties: string[]): void {\n objUpdatePropertyDescriptors(object, properties, (descriptor) => {\n descriptor.writable = true\n return descriptor\n })\n}\n","/**\n * Converts the given data to a JSON string.\n * @template T - The type of the data to be converted to JSON.\n * @param data The data to be converted to JSON.\n * @param pretty Optional parameter that determines whether the resulting JSON string should be pretty-printed. Default is `false`.\n * @returns The JSON string representation of the given data.\n * @example ```ts\n * toJson({ name: 'John', age: 30 }, true);;\n * //=> \"{\\n \"name\": \"John\",\\n \"age\": 30\\n}\"\n * ```\n */\nexport function toJson<T>(data: T, pretty = false): string {\n return pretty ? JSON.stringify(data, null, 2) : JSON.stringify(data)\n}\n"],"names":["createObjectFactory","keys","defaultValues","numKeys","length","Error","values","o","i","value","Object","defineProperty","enumerable","writable","configurable","getConstructor","getPrototypeOf","constructor","inheritStaticMembers","target","source","ignoreKeys","ignore","Set","key","Reflect","ownKeys","has","des","getOwnPropertyDescriptor","iterableFirstElement","iterable","item","iteratePrototypeChain","object","isPrototype","isConstructor","Function","prototype","objectOrNull","objDeepFreeze","freeze","objDelete","obj","objEntries","entries","objEntriesArray","Array","from","objFilter","callback","getKeys","result","objForEach","objGet","objGetOrElse","objHas","hasOwn","objIsEmpty","objKeys","objKeysArray","objMap","objMapKeys","objMapMutable","objOmitKeys","_","includes","objOmitKeysMutable","deleteProperty","objPropertyValueToGetter","propertyNames","propertyName","descriptor","get","objReduce","accum","objReverse","fromEntries","reverse","objSet","objSize","objSortKeys","sort","a","b","localeCompare","objToMap","Map","objUpdate","objUpdatePropertyDescriptors","properties","update","p","objValues","objValuesArray","objWalk","node","recurse","path","child","isArray","forEach","index","concat","setEnumerable","setNonConfigurable","setNonEnumerable","setNonWritable","setWritable","toJson","data","pretty","JSON","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wD,UAAU,CAAGlB,UAAU,GAC1DA,UAAU,CAAC3D,QAAQ,GAAQ,CACpB2D,UAAU,CAClB,CACH,SCVgB,CAAAoC,WAAWA,CAAC1E,MAA8B,CAAE,GAAGwD,UAAoB,CAAA,CACjFD,4BAA4B,CAACvD,MAAM,CAAEwD,UAAU,CAAGlB,UAAU,GAC1DA,UAAU,CAAC3D,QAAQ,GAAO,CACnB2D,UAAU,CAClB,CACH,SCXgB,CAAAqC,MAAMA,CAAIC,IAAO,CAAEC,MAAM,GAAQ,CAAA,CAC/C,MAAO,CAAAA,MAAM,CAAGC,IAAI,CAACC,SAAS,CAACH,IAAI,CAAE,IAAI,CAAE,CAAC,CAAC,CAAGE,IAAI,CAACC,SAAS,CAACH,IAAI,CACrE"}
package/dist/index.esm.js CHANGED
@@ -2,5 +2,5 @@
2
2
  * @bemoje/object v0.0.1
3
3
  * (c) Benjamin Møller Jensen
4
4
  * Released under the MIT License.
5
- */import{isPrototype,isConstructor}from"@bemoje/node-util";function createObjectFactory(keys,defaultValues){const numKeys=keys.length;if(defaultValues&&defaultValues.length>numKeys)throw new Error("defaultValues length larger than keys length.");return function(values){if(values&&values.length>numKeys)throw new Error("values length larger than keys length.");const o={};for(let i=0;i<numKeys;i++){let value;values?(value=values[i],value===void 0&&defaultValues&&(value=defaultValues[i])):defaultValues&&(value=defaultValues[i]),Object.defineProperty(o,keys[i],{enumerable:!0,writable:!0,configurable:!0,value})}return o}}function getConstructor(o){return Object.getPrototypeOf(o).constructor}function inheritStaticMembers(target,source,ignoreKeys=[]){const ignore=new Set([...ignoreKeys,"prototype","name","constructor"]);for(const key of Reflect.ownKeys(source)){if(ignore.has(key))continue;if(Reflect.has(target,key))continue;const des=Object.getOwnPropertyDescriptor(source,key);Object.defineProperty(target,key,des)}return target}function iterableFirstElement(iterable){for(const item of iterable)return item}function*iteratePrototypeChain(object){isPrototype(object)||isConstructor(object)||object===Function.prototype||(yield object,object=object.constructor.prototype);for(let objectOrNull=object;objectOrNull;)yield objectOrNull,objectOrNull=Reflect.getPrototypeOf(objectOrNull)}function objDeepFreeze(o){for(const key of Reflect.ownKeys(o)){const value=o[key];(value&&"object"==typeof value||"function"==typeof value)&&objDeepFreeze(value)}return Object.freeze(o)}function objDelete(obj,key){return delete obj[key],obj}function*objEntries(obj){yield*Object.entries(obj)}function objEntriesArray(obj){return Array.from(Object.entries(obj))}function objFilter(object,callback,getKeys=Object.keys){const result={};for(const key of getKeys(object))callback(object[key],key)&&(result[key]=object[key]);return result}function objForEach(object,callback,getKeys=Object.keys){for(const key of getKeys(object))callback(object[key],key);return object}function objGet(obj,key){return obj[key]}function objGetOrElse(obj,key,callback){const value=obj[key];return void 0===value?obj[key]=callback(key):value}function objHas(obj,key){return Object.hasOwn(obj,key)}function objIsEmpty(obj){for(const key of Object.keys(obj))if(key!==void 0)return!1;return!0}function*objKeys(obj){yield*Object.keys(obj)}function objKeysArray(obj){return Array.from(Object.keys(obj))}function objMap(object,callback,getKeys=Object.keys){const result={};for(const key of getKeys(object))result[key]=callback(object[key],key);return result}function objMapKeys(object,callback,getKeys=Object.keys){const result={};for(const key of getKeys(object))result[callback(key,object[key])]=object[key];return result}function objMapMutable(object,callback,getKeys=Object.keys){for(const key of getKeys(object))object[key]=callback(object[key],key);return object}function objOmitKeys(obj,...keys){return objFilter(obj,(_,key)=>!keys.includes(key))}function objOmitKeysMutable(obj,...keys){for(const key of keys)Reflect.deleteProperty(obj,key);return obj}function objPropertyValueToGetter(object,...propertyNames){for(const propertyName of propertyNames){const descriptor=Object.getOwnPropertyDescriptor(object,propertyName);if(!descriptor)throw new Error(`Property descriptor for '${propertyName+""}' not found.`);const{enumerable,configurable,value}=descriptor;Object.defineProperty(object,propertyName,{enumerable,configurable,get:()=>value})}return object}function objReduce(object,callback,accum,getKeys=Object.keys){for(const key of getKeys(object))accum=callback(accum,object[key],key);return accum}function objReverse(obj){return Object.fromEntries(objEntriesArray(obj).reverse())}function objSet(obj,key,value){return obj[key]=value}function objSize(obj){return Object.keys(obj).length}function objSortKeys(o){return Object.fromEntries(Object.entries(o).sort((a,b)=>a[0].localeCompare(b[0])))}function objToMap(obj){return new Map(Object.entries(obj))}function objUpdate(obj,key,callback){return obj[key]=callback(obj[key],key)}function objUpdatePropertyDescriptors(object,properties,update){for(const p of properties){if(!Object.hasOwn(object,p))throw new Error(`Property, '${p}' does not exist on object.`);const descriptor=update(Object.getOwnPropertyDescriptor(object,p),p);Object.defineProperty(object,p,descriptor)}}function*objValues(obj){yield*Object.values(obj)}function objValuesArray(obj){return Array.from(Object.values(obj))}function objWalk(node,callback){function recurse(node,path=[]){for(const[key,child]of Object.entries(node))"object"==typeof child&&null!==child?Array.isArray(child)?child.forEach((node,index)=>{recurse(node,path.concat([`${key}[${index}]`]))}):recurse(child,path.concat(key)):callback(child,path.concat(key))}recurse(node)}function setEnumerable(object,...properties){objUpdatePropertyDescriptors(object,properties,descriptor=>(descriptor.enumerable=!0,descriptor))}function setNonConfigurable(object,...properties){objUpdatePropertyDescriptors(object,properties,descriptor=>(descriptor.configurable=!1,descriptor))}function setNonEnumerable(object,...properties){objUpdatePropertyDescriptors(object,properties,descriptor=>(descriptor.enumerable=!1,descriptor))}function setNonWritable(object,...properties){objUpdatePropertyDescriptors(object,properties,descriptor=>(descriptor.writable=!1,descriptor))}function setWritable(object,...properties){objUpdatePropertyDescriptors(object,properties,descriptor=>(descriptor.writable=!0,descriptor))}function toJson(data,pretty=!1){return pretty?JSON.stringify(data,null,2):JSON.stringify(data)}export{createObjectFactory,getConstructor,inheritStaticMembers,iterableFirstElement,iteratePrototypeChain,objDeepFreeze,objDelete,objEntries,objEntriesArray,objFilter,objForEach,objGet,objGetOrElse,objHas,objIsEmpty,objKeys,objKeysArray,objMap,objMapKeys,objMapMutable,objOmitKeys,objOmitKeysMutable,objPropertyValueToGetter,objReduce,objReverse,objSet,objSize,objSortKeys,objToMap,objUpdate,objUpdatePropertyDescriptors,objValues,objValuesArray,objWalk,setEnumerable,setNonConfigurable,setNonEnumerable,setNonWritable,setWritable,toJson};
5
+ */import{isPrototype,isConstructor}from"@bemoje/validation";function createObjectFactory(keys,defaultValues){const numKeys=keys.length;if(defaultValues&&defaultValues.length>numKeys)throw new Error("defaultValues length larger than keys length.");return function(values){if(values&&values.length>numKeys)throw new Error("values length larger than keys length.");const o={};for(let i=0;i<numKeys;i++){let value;values?(value=values[i],value===void 0&&defaultValues&&(value=defaultValues[i])):defaultValues&&(value=defaultValues[i]),Object.defineProperty(o,keys[i],{enumerable:!0,writable:!0,configurable:!0,value})}return o}}function getConstructor(o){return Object.getPrototypeOf(o).constructor}function inheritStaticMembers(target,source,ignoreKeys=[]){const ignore=new Set([...ignoreKeys,"prototype","name","constructor"]);for(const key of Reflect.ownKeys(source)){if(ignore.has(key))continue;if(Reflect.has(target,key))continue;const des=Object.getOwnPropertyDescriptor(source,key);Object.defineProperty(target,key,des)}return target}function iterableFirstElement(iterable){for(const item of iterable)return item}function*iteratePrototypeChain(object){isPrototype(object)||isConstructor(object)||object===Function.prototype||(yield object,object=object.constructor.prototype);for(let objectOrNull=object;objectOrNull;)yield objectOrNull,objectOrNull=Reflect.getPrototypeOf(objectOrNull)}function objDeepFreeze(o){for(const key of Reflect.ownKeys(o)){const value=o[key];(value&&"object"==typeof value||"function"==typeof value)&&objDeepFreeze(value)}return Object.freeze(o)}function objDelete(obj,key){return delete obj[key],obj}function*objEntries(obj){yield*Object.entries(obj)}function objEntriesArray(obj){return Array.from(Object.entries(obj))}function objFilter(object,callback,getKeys=Object.keys){const result={};for(const key of getKeys(object))callback(object[key],key)&&(result[key]=object[key]);return result}function objForEach(object,callback,getKeys=Object.keys){for(const key of getKeys(object))callback(object[key],key);return object}function objGet(obj,key){return obj[key]}function objGetOrElse(obj,key,callback){const value=obj[key];return void 0===value?obj[key]=callback(key):value}function objHas(obj,key){return Object.hasOwn(obj,key)}function objIsEmpty(obj){for(const key of Object.keys(obj))if(key!==void 0)return!1;return!0}function*objKeys(obj){yield*Object.keys(obj)}function objKeysArray(obj){return Array.from(Object.keys(obj))}function objMap(object,callback,getKeys=Object.keys){const result={};for(const key of getKeys(object))result[key]=callback(object[key],key);return result}function objMapKeys(object,callback,getKeys=Object.keys){const result={};for(const key of getKeys(object))result[callback(key,object[key])]=object[key];return result}function objMapMutable(object,callback,getKeys=Object.keys){for(const key of getKeys(object))object[key]=callback(object[key],key);return object}function objOmitKeys(obj,...keys){return objFilter(obj,(_,key)=>!keys.includes(key))}function objOmitKeysMutable(obj,...keys){for(const key of keys)Reflect.deleteProperty(obj,key);return obj}function objPropertyValueToGetter(object,...propertyNames){for(const propertyName of propertyNames){const descriptor=Object.getOwnPropertyDescriptor(object,propertyName);if(!descriptor)throw new Error(`Property descriptor for '${propertyName+""}' not found.`);const{enumerable,configurable,value}=descriptor;Object.defineProperty(object,propertyName,{enumerable,configurable,get:()=>value})}return object}function objReduce(object,callback,accum,getKeys=Object.keys){for(const key of getKeys(object))accum=callback(accum,object[key],key);return accum}function objReverse(obj){return Object.fromEntries(objEntriesArray(obj).reverse())}function objSet(obj,key,value){return obj[key]=value}function objSize(obj){return Object.keys(obj).length}function objSortKeys(o){return Object.fromEntries(Object.entries(o).sort((a,b)=>a[0].localeCompare(b[0])))}function objToMap(obj){return new Map(Object.entries(obj))}function objUpdate(obj,key,callback){return obj[key]=callback(obj[key],key)}function objUpdatePropertyDescriptors(object,properties,update){for(const p of properties){if(!Object.hasOwn(object,p))throw new Error(`Property, '${p}' does not exist on object.`);const descriptor=update(Object.getOwnPropertyDescriptor(object,p),p);Object.defineProperty(object,p,descriptor)}}function*objValues(obj){yield*Object.values(obj)}function objValuesArray(obj){return Array.from(Object.values(obj))}function objWalk(node,callback){function recurse(node,path=[]){for(const[key,child]of Object.entries(node))"object"==typeof child&&null!==child?Array.isArray(child)?child.forEach((node,index)=>{recurse(node,path.concat([`${key}[${index}]`]))}):recurse(child,path.concat(key)):callback(child,path.concat(key))}recurse(node)}function setEnumerable(object,...properties){objUpdatePropertyDescriptors(object,properties,descriptor=>(descriptor.enumerable=!0,descriptor))}function setNonConfigurable(object,...properties){objUpdatePropertyDescriptors(object,properties,descriptor=>(descriptor.configurable=!1,descriptor))}function setNonEnumerable(object,...properties){objUpdatePropertyDescriptors(object,properties,descriptor=>(descriptor.enumerable=!1,descriptor))}function setNonWritable(object,...properties){objUpdatePropertyDescriptors(object,properties,descriptor=>(descriptor.writable=!1,descriptor))}function setWritable(object,...properties){objUpdatePropertyDescriptors(object,properties,descriptor=>(descriptor.writable=!0,descriptor))}function toJson(data,pretty=!1){return pretty?JSON.stringify(data,null,2):JSON.stringify(data)}export{createObjectFactory,getConstructor,inheritStaticMembers,iterableFirstElement,iteratePrototypeChain,objDeepFreeze,objDelete,objEntries,objEntriesArray,objFilter,objForEach,objGet,objGetOrElse,objHas,objIsEmpty,objKeys,objKeysArray,objMap,objMapKeys,objMapMutable,objOmitKeys,objOmitKeysMutable,objPropertyValueToGetter,objReduce,objReverse,objSet,objSize,objSortKeys,objToMap,objUpdate,objUpdatePropertyDescriptors,objValues,objValuesArray,objWalk,setEnumerable,setNonConfigurable,setNonEnumerable,setNonWritable,setWritable,toJson};
6
6
  //# sourceMappingURL=index.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.esm.js","sources":["../src/lib/createObjectFactory.ts","../src/lib/getConstructor.ts","../src/lib/inheritStaticMembers.ts","../src/lib/iterableFirstElement.ts","../src/lib/iteratePrototypeChain.ts","../src/lib/objDeepFreeze.ts","../src/lib/objDelete.ts","../src/lib/objEntries.ts","../src/lib/objEntriesArray.ts","../src/lib/objFilter.ts","../src/lib/objForEach.ts","../src/lib/objGet.ts","../src/lib/objGetOrElse.ts","../src/lib/objHas.ts","../src/lib/objIsEmpty.ts","../src/lib/objKeys.ts","../src/lib/objKeysArray.ts","../src/lib/objMap.ts","../src/lib/objMapKeys.ts","../src/lib/objMapMutable.ts","../src/lib/objOmitKeys.ts","../src/lib/objOmitKeysMutable.ts","../src/lib/objPropertyValueToGetter.ts","../src/lib/objReduce.ts","../src/lib/objReverse.ts","../src/lib/objSet.ts","../src/lib/objSize.ts","../src/lib/objSortKeys.ts","../src/lib/objToMap.ts","../src/lib/objUpdate.ts","../src/lib/objUpdatePropertyDescriptors.ts","../src/lib/objValues.ts","../src/lib/objValuesArray.ts","../src/lib/objWalk.ts","../src/lib/setEnumerable.ts","../src/lib/setNonConfigurable.ts","../src/lib/setNonEnumerable.ts","../src/lib/setNonWritable.ts","../src/lib/setWritable.ts","../src/lib/toJson.ts"],"sourcesContent":["/**\n * Creates a factory function for creating objects with specified keys and default values.\n * @template T The type of the values.\n * @param keys An array of strings representing the keys of the objects to be created.\n * @param defaultValues An optional array of default values for the keys. If provided, its length should not be larger than the length of the keys array.\n * @returns An `ObjectFactory` function. When called, this function takes an optional array of values and returns an object with the specified keys and values. If the values array is not provided or if a value is `undefined`, the corresponding default value is used.\n * @throws If the length of the `defaultValues` array is larger than the length of the `keys` array, or if the length of the `values` array passed to the factory function is larger than the length of the `keys` array.\n * @example ```ts\n * createObjectFactory(['key1', 'key2'], ['default1', 'default2'])(['value1']);\n * //=> { key1: 'value1', key2: 'default2' }\n * ```\n */\nexport function createObjectFactory<T>(keys: string[], defaultValues?: T[]): (values?: T[]) => Record<string, T> {\n const numKeys = keys.length\n if (defaultValues && defaultValues.length > numKeys) {\n throw new Error('defaultValues length larger than keys length.')\n }\n return function factory(values?: T[]) {\n if (values && values.length > numKeys) {\n throw new Error('values length larger than keys length.')\n }\n const o = {}\n for (let i = 0; i < numKeys; i++) {\n let value\n if (values) {\n value = values[i]\n if (value === undefined && defaultValues) {\n value = defaultValues[i]\n }\n } else if (defaultValues) {\n value = defaultValues[i]\n }\n Object.defineProperty(o, keys[i], {\n enumerable: true,\n writable: true,\n configurable: true,\n value,\n })\n }\n return o\n }\n}\n","import type { ConstructorOf } from '../types/ConstructorOf'\n\n/**\n * Returns the constructor of the given object.\n * @template T - The type of the object.\n * @param o The object whose constructor is to be returned.\n * @returns The constructor of the object.\n * @example ```ts\n * class MyClass {}\n * getConstructor(new MyClass()) === MyClass;;\n * //=> true\n * ```\n */\nexport function getConstructor<T>(o: T): ConstructorOf<T> {\n return Object.getPrototypeOf(o).constructor\n}\n","import type { Constructor } from '../types/Constructor'\n\n/**\n * Copies static members from a source constructor to a target constructor, excluding specified keys.\n * @param target The target constructor to inherit static members.\n * @param source The source constructor to copy static members from.\n * @param ignoreKeys An optional array of keys to exclude from copying.\n * @returns The target constructor with the inherited static members.\n * @throws If `target` or `source` is not a constructor.\n * @param - The keys that should not be inherited.\n * @example ```ts\n * class Parent {\n * static parentStaticMethod() {\n * return 'Parent static method'\n * }\n * }\n * class Child {\n * static childStaticMethod() {\n * return 'Child static method'\n * }\n * }\n * inheritStaticMembers(Child, Parent)\n * Child.parentStaticMethod() //=> 'Parent static method'\n * ```\n */\nexport function inheritStaticMembers(target: Constructor, source: Constructor, ignoreKeys: string[] = []): Constructor {\n const ignore: Set<string | symbol> = new Set([...ignoreKeys, 'prototype', 'name', 'constructor'])\n for (const key of Reflect.ownKeys(source)) {\n if (ignore.has(key)) continue\n if (Reflect.has(target, key)) continue\n const des = Object.getOwnPropertyDescriptor(source, key)\n Object.defineProperty(target, key, des as PropertyDescriptor)\n }\n return target\n}\n","/**\n * Returns the first element of an iterable object.\n * @template T - The type of elements in the iterable.\n * @param iterable The iterable object.\n * @returns The first element of the iterable object, or `undefined` if the iterable is empty.\n * @example ```ts\n * iterableFirstElement([1, 2, 3, 4, 5]);;\n * //=> 1\n * ```\n */\nexport function iterableFirstElement<T>(iterable: Iterable<T>): T | undefined {\n for (const item of iterable) return item\n}\n","import { isConstructor, isPrototype } from '@bemoje/node-util'\n\n/**\n * Iterate the prototype chain of a given object.\n * @remarks This function uses the `Reflect.getPrototypeOf` method to traverse the prototype chain.\n * It also uses the `isPrototype` and `isConstructor` helper functions to determine whether\n * the given object is a prototype or a constructor function.\n * @param object The object whose prototype chain is to be iterated over.\n * @throws If the provided object is not an object or a function, a TypeError will be thrown.\n * @returns A generator that yields each prototype in the chain.\n * @example ```ts\n * class A {}\n * class B extends A {}\n * class C extends B {}\n * const instance = new C()\n * iteratePrototypeChain(C)\n * //=> [ C, B, A, Function.prototype, Object.prototype]\n * iteratePrototypeChain(C.prototype)\n * //=> [C.prototype, B.prototype, A.prototype, Object.prototype]\n * iteratePrototypeChain(instance)\n * //=> [instance, C.prototype, B.prototype, A.prototype, Object.prototype]\n * ```\n */\nexport function* iteratePrototypeChain(object: Record<string, any>): Generator<Record<string, any>> {\n if (\n // if the below false, then object must be an instance\n !isPrototype(object) &&\n !isConstructor(object) &&\n // the two above depend on checking that typeof object is 'object',\n // so this last check is in case of arrow functions and generator functions\n object !== Function.prototype\n ) {\n yield object\n object = object.constructor.prototype\n }\n let objectOrNull: Record<string, any> | null = object\n while (objectOrNull) {\n yield objectOrNull\n objectOrNull = Reflect.getPrototypeOf(objectOrNull)\n }\n}\n","/**\n * Deep freezes an object, making it immutable by recursively freezing all nested objects and functions.\n * @returns The same object, but deeply frozen.\n * @throws If the object is not an object or function.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze | Object.freeze}\n * @param o The object to deep freeze.\n * This function uses `Object.freeze()` to freeze the object and all its nested objects and functions.\n * @example ```ts\n * const obj = {\n * prop1: 'value1',\n * prop2: {\n * nestedProp1: 'nestedValue1',\n * nestedProp2: {\n * deeplyNestedProp: 'deeplyNestedValue'\n * }\n * },\n * prop3: () => {\n * //=> Hello, world!\n * }\n * }\n * const frozenObj = objDeepFreeze(obj)\n * // Attempting to modify the frozen object will throw an error\n * frozenObj.prop1 //=> 'value1'\n * frozenObj.prop2.nestedProp1 //=> 'nestedValue1'\n * frozenObj.prop2.nestedProp2.deeplyNestedProp //=> 'deeplyNestedValue'\n * frozenObj.prop3() //=> undefined\n * ```\n */\nexport function objDeepFreeze(o: Record<string | symbol, any>): Record<string | symbol, any> {\n for (const key of Reflect.ownKeys(o)) {\n const value = o[key]\n if ((value && typeof value === 'object') || typeof value === 'function') {\n objDeepFreeze(value)\n }\n }\n return Object.freeze(o)\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Deletes a property from an object and returns the modified object.\n * @param obj The object from which to delete the property.\n * @template K - The type of the keys in the object.\n * @returns The modified object with the key deleted.\n * @param key The key of the property to delete.\n * @example ```ts\n * const obj = { name: 'John', age: 30 };\n * objDelete(obj, 'age');\n * //=> { name: 'John' }\n * ```\n */\nexport function objDelete<K extends ObjectKey, V>(obj: Record<K, V>, key: K): Omit<Record<K, V>, K> {\n delete obj[key]\n return obj\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an iterable of key-value pairs from the given object.\n * @remarks This function is a part of Object Utilities.\n * @typeparam V - The type of values in the object.\n * @returns An iterable of tuples where each tuple is a key-value pair from the object.\n * @param obj The object to iterate over.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * for (const [key, value] of objEntries(obj)) {\n * //=> a //=> b //=> c 3\n * }\n * ```\n */\nexport function* objEntries<V>(obj: Record<ObjectKey, V>): Iterable<[string, V]> {\n yield* Object.entries(obj)\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an array of key-value pairs from the given object.\n * @remarks This function is a utility for converting an object into an array of its entries.\n * Each entry is a tuple where the first element is the key and the second is the value.\n * @typeparam V - The type of the values in the object.\n * @returns An array of entries, where each entry is a tuple of a string and a value of type `V`.\n * @param obj The object to extract keyvalue pairs from.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * objEntriesArray(obj);\n * //=> [['a', 1], ['b', 2], ['c', 3]]\n * ```\n */\nexport function objEntriesArray<V>(obj: Record<ObjectKey, V>): Array<[string, V]> {\n return Array.from(Object.entries(obj))\n}\n","/**\n * Filters the properties of an object based on a callback function.\n * @param object The object to filter.\n * @param callback The callback function used to filter the object properties.\n * @template T - The type of the values in the object.\n * @param - The function to get the keys of the object. Defaults to `Object.keys`.\n * @returns A new object with the properties that passed the test. If no properties passed the test, an empty object will be returned.\n * @param getKeys The function used to get the keys of the object.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * objFilter(obj, (value, key) => value > 1);\n * //=> { b: 2, c: 3 }\n * ```\n */\nexport function objFilter<T>(\n object: Record<string, T>,\n callback: (value: T, key: string) => boolean,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): Record<string, T> {\n const result: Record<string, T> = {}\n for (const key of getKeys(object)) {\n if (callback(object[key], key)) {\n result[key] = object[key]\n }\n }\n return result\n}\n","/**\n * Applies a callback function to each key-value pair in an object.\n * @param object The object to iterate over.\n * @param callback The function to apply to each keyvalue pair.\n * @template T - The type of the object's properties.\n * @param - An optional function to determine the keys to iterate over. Defaults to `Object.keys`.\n * @returns The original object.\n * @param getKeys The function to retrieve the keys of the object.\n * @example ```ts\n * const myObject = { a: 1, b: 2, c: 3 };\n * objForEach(myObject, (value, key) => {\n * //=> ${key}: ${value}\n * });\n * ```\n */\nexport function objForEach<T>(\n object: Record<string, T>,\n callback: (value: T, key: string) => void,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): typeof object {\n for (const key of getKeys(object)) {\n callback(object[key], key)\n }\n return object\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Retrieves the value associated with the specified key from an object.\n * @param obj The object from which to retrieve the value.\n * @template K - The type of the keys in the object.\n * @returns The value of the specified key in the object, or `undefined` if the key does not exist.\n * @param key The key of the value to retrieve.\n * @example ```ts\n * const myObj = { name: 'John', age: 30 };\n * objGet(myObj, 'name');\n * //=> 'John'\n * objGet(myObj, 'age');\n * //=> 30\n * objGet(myObj, 'address');\n * //=> undefined\n * ```\n */\nexport function objGet<V>(obj: Record<ObjectKey, V>, key: ObjectKey): V | undefined {\n return obj[key]\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * This function attempts to retrieve a value from an object using a provided key.\n * If the key does not exist in the object, it uses a callback function to generate a default value.\n * @param obj The object from which to retrieve the value.\n * @param key The key to use when retrieving the value.\n * @param callback The function to call when the key does not exist in the object. This function should return the default value.\n * @returns The value associated with the key in the object, or the result of the callback function if the key does not exist in the object.\n * @example ```ts\n * objGetOrElse({ a: 1, b: 2 }, 'c', (key) => 3);;\n * //=> 3\n * ```\n * @typeparam V - The type of the values in the object.\n */\nexport function objGetOrElse<V>(obj: Record<ObjectKey, V>, key: ObjectKey, callback: (key: ObjectKey) => V): V {\n const value = obj[key]\n if (value !== undefined) return value\n return (obj[key] = callback(key))\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Checks if an object has a specific key.\n * @param obj The object to check.\n * @template K - The type of the keys in the object.\n * @returns Returns true if the object has the key, false otherwise.\n * @param key The key to check for.\n * @example ```ts\n * const myObj = { name: 'John', age: 30 };\n * objHas(myObj, 'name');\n * //=> true\n * objHas(myObj, 'email');\n * //=> false\n * ```\n */\nexport function objHas<V>(obj: Record<ObjectKey, V>, key: ObjectKey): boolean {\n return Object.hasOwn(obj, key)\n}\n","/**\n * Checks if an object is empty. This function iterates over the keys of the provided object and checks if any key is defined.\n * @remarks This function uses the `Object.keys()` method to check if the object has any keys.\n * If the object has at least one key, the function returns `false`, otherwise it returns `true`.\n * @typeparam T - The type of the values in the object.\n * @returns A boolean indicating whether the object is empty or not.\n * @param obj The object to check.\n * @example ```ts\n * const emptyObject = {};\n * const nonEmptyObject = { key: 'value' };\n * objIsEmpty(emptyObject);\n * //=> true\n * objIsEmpty(nonEmptyObject);\n * //=> false\n * ```\n */\nexport function objIsEmpty<T>(obj: Record<string, T>): boolean {\n for (const key of Object.keys(obj)) {\n if (key !== undefined) return false\n }\n return true\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an iterable of all the keys in the given object.\n * @remarks This function is a part of the `utils` module.\n * @typeparam V - The type of the values in the object.\n * @returns An iterable of the object's keys.\n * @param obj The object whose keys to iterate over.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * const keys = objKeys(obj);\n * for (const key of keys) {\n * //=> //=> //=> c\n * }\n * ```\n */\nexport function* objKeys<V>(obj: Record<ObjectKey, V>): Iterable<string> {\n yield* Object.keys(obj)\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an array of keys from the provided object.\n * @remarks This function is a part of Object Utilities.\n * @typeparam V - The type of values in the object.\n * @returns The array of keys of the input object.\n * @param obj The object from which to extract the keys.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * objKeysArray(obj);\n * //=> ['a', 'b', 'c']\n * ```\n */\nexport function objKeysArray<V>(obj: Record<ObjectKey, V>): string[] {\n return Array.from(Object.keys(obj))\n}\n","/**\n * Maps over the values of an object and returns a new object with the mapped values.\n * @param object The object to map over.\n * @param callback The mapping function to apply to each value.\n * @template T The type of the values in the input object.\n * @param An optional function to determine the keys to iterate over. Defaults to `Object.keys`.\n * @returns A new object with the same keys as the input object, but with each value transformed by the callback function.\n * @param getKeys The function used to get the keys of the object.\n * @example ```ts\n * const object = { a: 1, b: 2, c: 3 }\n * const callback = (value: number, key: string) => value * 2\n * objMap(object, callback) //=> { a: 2, b: 4, c: 6 }\n * ```\n */\nexport function objMap<T>(\n object: Record<string, T>,\n callback: (value: T, key: string) => T,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): Record<string, T> {\n const result: Record<string, T> = {}\n for (const key of getKeys(object)) {\n result[key] = callback(object[key], key)\n }\n return result\n}\n","/**\n * Maps the keys of an object using a callback function.\n * @param object The object whose keys will be mapped.\n * @param callback The callback function that maps the keys.\n * @template T - The type of the values in the object.\n * @param - The function to get the keys of the object.\n * @returns A new object with the keys mapped.\n * @param getKeys The function that retrieves the keys of the object.\n * @example ```ts\n * const object = { a: 1, b: 2, c: 3 };\n * const callback = (key: string, value: number) => key.toUpperCase();\n * objMapKeys(object, callback);\n * //=> { A: 1, B: 2, C: 3 }\n * ```\n */\nexport function objMapKeys<T>(\n object: Record<string, T>,\n callback: (key: string, value: T) => string,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): Record<string, T> {\n const result: Record<string, T> = {}\n for (const key of getKeys(object)) {\n result[callback(key, object[key])] = object[key]\n }\n return result\n}\n","/**\n * Applies a callback function to each key-value pair in an object and mutates the object.\n * @param object The object to be mapped.\n * @param callback The callback function to apply to each valuekey pair.\n * @template T - The type of the properties in the object.\n * @param - An optional function to determine the keys to be iterated over.\n * @returns The mutated object.\n * @param getKeys The function used to get the keys of the object.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * const callback = (value: number, key: string) => value * 2;\n * objMapMutable(obj, callback);\n * //=> { a: 2, b: 4, c: 6 }\n * ```\n */\nexport function objMapMutable<T>(\n object: Record<string, T>,\n callback: (value: T, key: string) => T,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): typeof object {\n for (const key of getKeys(object)) {\n object[key] = callback(object[key], key)\n }\n return object\n}\n","import { ObjectKey } from '../types/ObjectKey'\r\nimport { objFilter } from './objFilter'\r\n\r\n/**\r\n * Deletes specified keys from an object. This function takes an object and an array of keys to be deleted from the object. It returns a new object with the specified keys removed.\r\n * @param obj The object from which keys are to be deleted.\r\n * @template V - The type of the values in the object.\r\n * @returns A new object with the specified keys deleted.\r\n * @param keys The keys to be deleted from the object.\r\n * @example ```ts\r\n * const obj = { a: 1, b: 2, c: 3 };\r\n * objOmitKeys(obj, 'a', 'c');\r\n * //=> { b: 2 }\r\n * ```\r\n */\r\nexport function objOmitKeys<K extends ObjectKey, V>(obj: Record<K, V>, ...keys: string[]): Record<K, V> {\r\n return objFilter<any>(obj, (_, key: string) => !keys.includes(key)) as Record<K, V>\r\n}\r\n","/**\r\n * Deletes the specified keys from an object in a mutable way.\r\n * @param obj The object from which to delete the keys.\r\n * @returns The modified object with the specified keys deleted.\r\n * @typeparam V - The type of the values in the object.\r\n * @param keys The keys to delete from the object.\r\n * @example ```ts\r\n * const obj = { a: 1, b: 2, c: 3 };\r\n * objOmitKeysMutable(obj, 'a', 'c');\r\n * //=> { b: 2 }\r\n * ```\r\n */\r\nexport function objOmitKeysMutable<V>(obj: Record<string, V>, ...keys: string[]): Record<string, V> {\r\n for (const key of keys) {\r\n Reflect.deleteProperty(obj, key)\r\n }\r\n return obj\r\n}\r\n","import { ObjectKey } from '../types/ObjectKey'\r\n\r\n/**\r\n * Converts the specified properties of an object into getter functions.\r\n * @template K - The type of the keys of the object.\r\n * @template V - The type of the values of the object.\r\n * @template T - The type of the object.\r\n * @param object The object whose properties are to be converted into getter functions.\r\n * @param propertyNames The names of the properties to be converted into getter functions.\r\n * @returns The object with the specified properties converted into getter functions.\r\n * @throws Throws an error if the property descriptor for a specified property name is not found.\r\n * @example ```ts\r\n * const obj = { a: 1, b: 2, c: 3 };\r\n * objPropertyValueToGetter(obj, 'a', 'b');\r\n * obj.a;;\r\n * //=> 1\r\n * obj.b;;\r\n * //=> 2\r\n * obj.c;;\r\n * //=> 3\r\n * ```\r\n */\r\nexport function objPropertyValueToGetter<V, T extends Record<ObjectKey, V>>(\r\n object: T,\r\n ...propertyNames: ObjectKey[]\r\n): T {\r\n for (const propertyName of propertyNames) {\r\n const descriptor = Object.getOwnPropertyDescriptor(object, propertyName)\r\n if (!descriptor) throw new Error(`Property descriptor for '${String(propertyName)}' not found.`)\r\n const { enumerable, configurable, value } = descriptor\r\n Object.defineProperty(object, propertyName, { enumerable, configurable, get: () => value })\r\n }\r\n return object\r\n}\r\n","/**\n * Reduces the values of an object into a single value.\n * @param object The object to reduce.\n * @param callback The function that handles the reduction logic.\n * @param accum The initial value of the accumulator.\n * @template T - The type of the values in the input object.\n * @param - An optional function to get the keys of the object. Defaults to `Object.keys`.\n * @returns The final accumulated value.\n * @param getKeys The function that retrieves the keys of the object.\n * @example ```ts\n * const object = { a: 1, b: 2, c: 3 };\n * const callback = (accum, value, key) => accum + value;\n * const initialAccum = 0;\n * objReduce(object, callback, initialAccum);\n * //=> 6\n * ```\n */\nexport function objReduce<T, A>(\n object: Record<string, T>,\n callback: (accum: A, value: T, key: string) => A,\n accum: A,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): A {\n for (const key of getKeys(object)) {\n accum = callback(accum, object[key], key)\n }\n return accum\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objEntriesArray } from './objEntriesArray'\n\n/**\n * Reverses the order of the properties in the given object.\n * @remarks This function does not mutate the original object. It returns a new object with the properties in reverse order.\n * @param obj The object to reverse. The object's keys are of type `ObjectKey` and its values are of type `V`.\n * @returns A new object with the properties of the input object in reverse order. The returned object's keys are of type `ObjectKey` and its values are of type `V`.\n * @typeparam V - The type of the values in the input object and the returned object.\n * @example ```ts\n * objReverse({ a: 1, b: 2, c: 3 });;\n * //=> { c: 3, b: 2, a: 1 }\n * ```\n */\nexport function objReverse<V>(obj: Record<ObjectKey, V>): Record<ObjectKey, V> {\n return Object.fromEntries(objEntriesArray(obj).reverse())\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Sets a value for a key in an object and returns the value.\n * @template ObjectKey - The type of the keys in the object.\n * @template V - The type of the values in the object.\n * @param obj The object in which to set the value.\n * @param key The key for which to set the value.\n * @param value The value to set.\n * @returns The value that was set.\n * @example ```ts\n * objSet({ a: 1, b: 2 }, 'a', 3);;\n * //=> { a: 3, b: 2 }\n * ```\n */\nexport function objSet<V>(obj: Record<ObjectKey, V>, key: ObjectKey, value: V): V {\n return (obj[key] = value)\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Calculates and returns the size of the given object.\n * @remarks This function uses `Object.keys(obj).length` to determine the size of the object.\n * @param obj The object whose size is to be calculated.\n * @typeparam V - The type of the values in the object.\n * @returns The size of the object.\n * @example ```ts\n * objSize({ a: 1, b: 2, c: 3 });;\n * //=> 3\n * ```\n */\nexport function objSize<V>(obj: Record<ObjectKey, V>): number {\n return Object.keys(obj).length\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Sorts the keys of an object in alphabetical order.\n * @remarks This function does not mutate the original object. It returns a new object with sorted keys.\n * @typeparam V - The type of the values in the object.\n * @returns A new object with the same values as the original, but with keys sorted in ascending order.\n * @param o The object whose keys should be sorted.\n * @example ```ts\n * const obj = { c: 1, a: 2, b: 3 };\n * objSortKeys(obj);\n * //=> { a: 2, b: 3, c: 1 }\n * ```\n */\nexport function objSortKeys<V>(o: Record<ObjectKey, V>): Record<ObjectKey, V> {\n return Object.fromEntries(Object.entries(o).sort((a, b) => a[0].localeCompare(b[0])))\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Converts an object to a Map.\n * @remarks This function is useful when you need to convert an object to a Map data structure.\n * @typeparam V - The type of the values in the object.\n * @returns A new Map object populated with the [key, value] pairs from the original object.\n * @param obj The object to convert to a Map.\n * @example ```ts\n * const obj = { key1: 'value1', key2: 'value2' };\n * const map = objToMap(obj);\n * map.get('key1');\n * //=> 'value1'\n * map.get('key2');\n * //=> 'value2'\n * ```\n */\nexport function objToMap<V>(obj: Record<ObjectKey, V>): Map<string, V> {\n return new Map(Object.entries(obj))\n}\n","import { ObjectKey } from '../types/ObjectKey'\r\n\r\n/**\r\n * Updates the value of a specific key in an object using a callback function.\r\n * @template V - The type of the values in the object.\r\n * @param obj The object to update.\r\n * @param key The key of the value to update.\r\n * @param callback The function to generate the new value. It receives the current value and the key as arguments.\r\n * @returns The new value.\r\n * @example ```ts\r\n * objUpdate({ a: 1, b: 2 }, 'a', (value, key) => value + 1);;\r\n * //=> { a: 2, b: 2 }\r\n * ```\r\n */\r\nexport function objUpdate<V>(\r\n obj: Record<ObjectKey, V>,\r\n key: ObjectKey,\r\n callback: (value: V | undefined, key: ObjectKey) => V,\r\n): V {\r\n return (obj[key] = callback(obj[key], key))\r\n}\r\n","import { ObjectKey } from '../types/ObjectKey'\r\n\r\n/**\r\n * Updates the property descriptors of the specified properties on the given object.\r\n * @param object - The object whose property descriptors are to be updated.\r\n * @param properties - An array of property names for which the descriptors are to be updated.\r\n * @param update - A function that takes a property descriptor and a property name, and returns a new property descriptor.\r\n * @throws Will throw an error if any of the specified properties do not exist on the object.\r\n * @example ```ts\r\n * const obj = { a: 1, b: 2 };\r\n * objUpdatePropertyDescriptors(obj, ['a', 'b'], (descriptor, property) => {\r\n * descriptor.writable = true;\r\n * return obj;\r\n * });\r\n * ```\r\n */\r\nexport function objUpdatePropertyDescriptors<V>(\r\n object: Record<ObjectKey, V>,\r\n properties: string[],\r\n update: <T extends PropertyDescriptor>(descriptor: T, property: string) => T,\r\n): void {\r\n for (const p of properties) {\r\n if (!Object.hasOwn(object, p)) {\r\n throw new Error(`Property, '${p}' does not exist on object.`)\r\n }\r\n const descriptor = update(Object.getOwnPropertyDescriptor(object, p) as PropertyDescriptor, p)\r\n Object.defineProperty(object, p, descriptor)\r\n }\r\n}\r\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an iterable of the values of the given object.\n * @remarks This function uses the `Object.values()` method to get all the values of the object and then yields them one by one.\n * @typeparam V - The type of the values in the object.\n * @returns An iterable that yields all the values of the given object.\n * @param obj The object whose values should be returned.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * const values = objValues(obj);\n * for (const value of values) {\n * //=> {value}\n * }\n * // Output:\n * // 1\n * // 2\n * // 3\n * ```\n */\nexport function* objValues<V>(obj: Record<ObjectKey, V>): Iterable<V> {\n yield* Object.values(obj)\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an array containing the values of the given object.\n * @remarks This function is a part of Object Utilities.\n * @typeparam V - The type of values in the object.\n * @returns An array of the values of the object.\n * @param obj The object whose values will be extracted.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * objValuesArray(obj);\n * //=> [1, 2, 3]\n * ```\n */\nexport function objValuesArray<V>(obj: Record<ObjectKey, V>): Array<V> {\n return Array.from(Object.values(obj))\n}\n","/**\n * Recursively traverses an object and invokes a callback function for every encountered non-object value.\n * The callback function is passed the non-object value and an array representing the path to the value.\n * @param node - The object to be traversed.\n * @param callback - The callback function to be invoked for every non-object value.\n * @example ```ts\n * const obj = { a: 1, b: { c: 2, d: [3, 4] } };\n * objWalk(obj, (value, path) => {\n * console.log(`Path: ${path.join('.')}, Value: ${value}`);\n * });\n * // Output:\n * // Path: a, Value: 1\n * // Path: b.c, Value: 2\n * // Path: b.d[0], Value: 3\n * // Path: b.d[1], Value: 4\n * ```\n */\nexport function objWalk(node: Record<string, any>, callback: (value: any, path: string[]) => void): void {\n function recurse(node: Record<string, any>, path: string[] = []) {\n for (const [key, child] of Object.entries(node)) {\n if (typeof child === 'object' && child !== null) {\n if (Array.isArray(child)) {\n child.forEach((node, index) => {\n recurse(node, path.concat([`${key}[${index}]`]))\n })\n } else {\n recurse(child, path.concat(key))\n }\n } else {\n callback(child, path.concat(key))\n }\n }\n }\n recurse(node)\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objUpdatePropertyDescriptors } from './objUpdatePropertyDescriptors'\n\n/**\n * Sets the enumerable property of the specified properties of an object to true.\n * @template T - The type of the object.\n * @param object The object whose properties' enumerable property will be set to true.\n * @param propertyNames The names of the properties to be set enumerable.\n * @returns void\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * setEnumerable(obj, 'a', 'b');\n * Object.keys(obj);;\n * //=> ['a', 'b']\n * ```\n * @remarks This function uses `Object.defineProperty` to set the enumerable property.\n * @throws Will throw an error if any of the specified properties do not exist on the object.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty | Object.defineProperty}\n */\nexport function setEnumerable(object: Record<ObjectKey, any>, ...properties: string[]): void {\n objUpdatePropertyDescriptors(object, properties, (descriptor) => {\n descriptor.enumerable = true\n return descriptor\n })\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objUpdatePropertyDescriptors } from './objUpdatePropertyDescriptors'\n\n/**\n * Sets the specified properties of an object as non-configurable.\n * @remarks This function modifies the original object by setting the `configurable` attribute of the specified properties to `false`.\n * Once a property is made non-configurable, it can neither be deleted from the object nor changed to configurable.\n * @typeparam T - The type of the object.\n * @param object The object whose properties are to be made non-configurable.\n * @param properties The names of the properties to be made non-configurable.\n * @throws Will throw an error if any of the specified properties do not exist on the object.\n * @example ```ts\n * setNonConfigurable({ a: 1, b: 2, c: 3 }, 'a', 'b');\n * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'a');;\n * //=> {value: 1, writable: true, enumerable: true, configurable: false}\n * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'b');;\n * //=> {value: 2, writable: true, enumerable: true, configurable: false}\n * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'c');;\n * //=> {value: 3, writable: true, enumerable: true, configurable: true}\n * ```\n */\nexport function setNonConfigurable(object: Record<ObjectKey, any>, ...properties: string[]): void {\n objUpdatePropertyDescriptors(object, properties, (descriptor) => {\n descriptor.configurable = false\n return descriptor\n })\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objUpdatePropertyDescriptors } from './objUpdatePropertyDescriptors'\n\n/**\n * Sets the specified properties of an object as non-enumerable.\n * @remarks This function modifies the original object by setting the specified properties as non-enumerable.\n * If the object or any of the property names are not valid, it throws an error.\n * @param object The object whose properties are to be set as non-enumerable.\n * @param properties The names of the properties to be set as non-enumerable.\n * @throws Will throw an error if any of the specified properties do not exist on the object.\n * @example ```ts\n * setNonEnumerable({ a: 1, b: 2, c: 3 }, 'a', 'b');\n * Object.keys({ a: 1, b: 2, c: 3 });;\n * //=> ['c']\n * ```\n */\nexport function setNonEnumerable(object: Record<ObjectKey, any>, ...properties: string[]): void {\n objUpdatePropertyDescriptors(object, properties, (descriptor) => {\n descriptor.enumerable = false\n return descriptor\n })\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objUpdatePropertyDescriptors } from './objUpdatePropertyDescriptors'\n\n/**\n * Sets the specified properties of an object to be non-writable.\n * @template T - The type of the object.\n * @param object The object whose properties are to be made non-writable.\n * @param properties The names of the properties to be made non-writable.\n * @throws Will throw an error if any of the specified properties do not exist on the object.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * setNonWritable(obj, 'a', 'b');\n * obj;;\n * //=> { a: 1, b: 2, c: 3 }\n * obj.a = 10;;\n * //=> Throws an error\n * obj.b = 20;;\n * //=> Throws an error\n * obj.c = 30;;\n * //=> Works fine\n * ```\n */\nexport function setNonWritable(object: Record<ObjectKey, any>, ...properties: string[]): void {\n objUpdatePropertyDescriptors(object, properties, (descriptor) => {\n descriptor.writable = false\n return descriptor\n })\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objUpdatePropertyDescriptors } from './objUpdatePropertyDescriptors'\n\n/**\n * Sets the specified properties of an object to be writable.\n * @template T - The type of the object.\n * @param object The object whose properties are to be made writable.\n * @param propertyNames The names of the properties to be made writable.\n * @throws Will throw an error if any of the specified properties do not exist on the object.\n * @example ```ts\n * setWritable({ a: 1, b: 2 }, 'a', 'b').a = 3;;\n * //=> 3\n * setWritable({ a: 1, b: 2 }, 'a', 'b').b = 4;;\n * //=> 4\n * ```\n * @returns void\n */\nexport function setWritable(object: Record<ObjectKey, any>, ...properties: string[]): void {\n objUpdatePropertyDescriptors(object, properties, (descriptor) => {\n descriptor.writable = true\n return descriptor\n })\n}\n","/**\n * Converts the given data to a JSON string.\n * @template T - The type of the data to be converted to JSON.\n * @param data The data to be converted to JSON.\n * @param pretty Optional parameter that determines whether the resulting JSON string should be pretty-printed. Default is `false`.\n * @returns The JSON string representation of the given data.\n * @example ```ts\n * toJson({ name: 'John', age: 30 }, true);;\n * //=> \"{\\n \"name\": \"John\",\\n \"age\": 30\\n}\"\n * ```\n */\nexport function toJson<T>(data: T, pretty = false): string {\n return pretty ? JSON.stringify(data, null, 2) : JSON.stringify(data)\n}\n"],"names":["createObjectFactory","keys","defaultValues","numKeys","length","Error","values","o","i","value","Object","defineProperty","enumerable","writable","configurable","getConstructor","getPrototypeOf","constructor","inheritStaticMembers","target","source","ignoreKeys","ignore","Set","key","Reflect","ownKeys","has","des","getOwnPropertyDescriptor","iterableFirstElement","iterable","item","iteratePrototypeChain","object","isPrototype","isConstructor","Function","prototype","objectOrNull","objDeepFreeze","freeze","objDelete","obj","objEntries","entries","objEntriesArray","Array","from","objFilter","callback","getKeys","result","objForEach","objGet","objGetOrElse","objHas","hasOwn","objIsEmpty","objKeys","objKeysArray","objMap","objMapKeys","objMapMutable","objOmitKeys","_","includes","objOmitKeysMutable","deleteProperty","objPropertyValueToGetter","propertyNames","propertyName","descriptor","get","objReduce","accum","objReverse","fromEntries","reverse","objSet","objSize","objSortKeys","sort","a","b","localeCompare","objToMap","Map","objUpdate","objUpdatePropertyDescriptors","properties","update","p","objValues","objValuesArray","objWalk","node","recurse","path","child","isArray","forEach","index","concat","setEnumerable","setNonConfigurable","setNonEnumerable","setNonWritable","setWritable","toJson","data","pretty","JSON","stringify"],"mappings":";;;;4DAYgB,QAAA,CAAAA,mBAAmBA,CAAIC,IAAc,CAAEC,aAAmB,CAAA,CACxE,KAAM,CAAAC,OAAO,CAAGF,IAAI,CAACG,MAAM,CAC3B,GAAIF,aAAa,EAAIA,aAAa,CAACE,MAAM,CAAGD,OAAO,CACjD,KAAM,IAAI,CAAAE,KAAK,CAAC,+CAA+C,CAAC,CAElE,MAAO,UAAiBC,MAAY,CAAA,CAClC,GAAIA,MAAM,EAAIA,MAAM,CAACF,MAAM,CAAGD,OAAO,CACnC,KAAM,IAAI,CAAAE,KAAK,CAAC,wCAAwC,CAAC,CAE3D,KAAM,CAAAE,CAAC,CAAG,CAAA,CAAE,CACZ,IAAK,GAAI,CAAAC,CAAC,CAAG,CAAC,CAAEA,CAAC,CAAGL,OAAO,CAAEK,CAAC,EAAE,CAAE,CAChC,GAAI,CAAAC,KAAK,CACLH,MAAM,EACRG,KAAK,CAAGH,MAAM,CAACE,CAAC,CAAC,CACbC,KAAK,SAAc,EAAIP,aAAa,GACtCO,KAAK,CAAGP,aAAa,CAACM,CAAC,CAAC,GAEjBN,aAAa,GACtBO,KAAK,CAAGP,aAAa,CAACM,CAAC,CAAC,EAE1BE,MA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AkBA,CAACvE,MAA8B,CAAE,GAAGwD,UAAoB,CAAA,CACxFD,4BAA4B,CAACvD,MAAM,CAAEwD,UAAU,CAAGlB,UAAU,GAC1DA,UAAU,CAAC1D,YAAY,GAAQ,CACxB0D,UAAU,CAClB,CACH,SCVgB,CAAAkC,gBAAgBA,CAACxE,MAA8B,CAAE,GAAGwD,UAAoB,CAAA,CACtFD,4BAA4B,CAACvD,MAAM,CAAEwD,UAAU,CAAGlB,UAAU,GAC1DA,UAAU,CAAC5D,UAAU,GAAQ,CACtB4D,UAAU,CAClB,CACH,SCCgB,CAAAmC,cAAcA,CAACzE,MAA8B,CAAE,GAAGwD,UAAoB,CAAA,CACpFD,4BAA4B,CAACvD,MAAM,CAAEwD,UAAU,CAAGlB,UAAU,GAC1DA,UAAU,CAAC3D,QAAQ,GAAQ,CACpB2D,UAAU,CAClB,CACH,SCVgB,CAAAoC,WAAWA,CAAC1E,MAA8B,CAAE,GAAGwD,UAAoB,CAAA,CACjFD,4BAA4B,CAACvD,MAAM,CAAEwD,UAAU,CAAGlB,UAAU,GAC1DA,UAAU,CAAC3D,QAAQ,GAAO,CACnB2D,UAAU,CAClB,CACH,SCXgB,CAAAqC,MAAMA,CAAIC,IAAO,CAAEC,MAAM,GAAQ,CAAA,CAC/C,MAAO,CAAAA,MAAM,CAAGC,IAAI,CAACC,SAAS,CAACH,IAAI,CAAE,IAAI,CAAE,CAAC,CAAC,CAAGE,IAAI,CAACC,SAAS,CAACH,IAAI,CACrE"}
1
+ {"version":3,"file":"index.esm.js","sources":["../src/lib/createObjectFactory.ts","../src/lib/getConstructor.ts","../src/lib/inheritStaticMembers.ts","../src/lib/iterableFirstElement.ts","../src/lib/iteratePrototypeChain.ts","../src/lib/objDeepFreeze.ts","../src/lib/objDelete.ts","../src/lib/objEntries.ts","../src/lib/objEntriesArray.ts","../src/lib/objFilter.ts","../src/lib/objForEach.ts","../src/lib/objGet.ts","../src/lib/objGetOrElse.ts","../src/lib/objHas.ts","../src/lib/objIsEmpty.ts","../src/lib/objKeys.ts","../src/lib/objKeysArray.ts","../src/lib/objMap.ts","../src/lib/objMapKeys.ts","../src/lib/objMapMutable.ts","../src/lib/objOmitKeys.ts","../src/lib/objOmitKeysMutable.ts","../src/lib/objPropertyValueToGetter.ts","../src/lib/objReduce.ts","../src/lib/objReverse.ts","../src/lib/objSet.ts","../src/lib/objSize.ts","../src/lib/objSortKeys.ts","../src/lib/objToMap.ts","../src/lib/objUpdate.ts","../src/lib/objUpdatePropertyDescriptors.ts","../src/lib/objValues.ts","../src/lib/objValuesArray.ts","../src/lib/objWalk.ts","../src/lib/setEnumerable.ts","../src/lib/setNonConfigurable.ts","../src/lib/setNonEnumerable.ts","../src/lib/setNonWritable.ts","../src/lib/setWritable.ts","../src/lib/toJson.ts"],"sourcesContent":["/**\n * Creates a factory function for creating objects with specified keys and default values.\n * @template T The type of the values.\n * @param keys An array of strings representing the keys of the objects to be created.\n * @param defaultValues An optional array of default values for the keys. If provided, its length should not be larger than the length of the keys array.\n * @returns An `ObjectFactory` function. When called, this function takes an optional array of values and returns an object with the specified keys and values. If the values array is not provided or if a value is `undefined`, the corresponding default value is used.\n * @throws If the length of the `defaultValues` array is larger than the length of the `keys` array, or if the length of the `values` array passed to the factory function is larger than the length of the `keys` array.\n * @example ```ts\n * createObjectFactory(['key1', 'key2'], ['default1', 'default2'])(['value1']);\n * //=> { key1: 'value1', key2: 'default2' }\n * ```\n */\nexport function createObjectFactory<T>(keys: string[], defaultValues?: T[]): (values?: T[]) => Record<string, T> {\n const numKeys = keys.length\n if (defaultValues && defaultValues.length > numKeys) {\n throw new Error('defaultValues length larger than keys length.')\n }\n return function factory(values?: T[]) {\n if (values && values.length > numKeys) {\n throw new Error('values length larger than keys length.')\n }\n const o = {}\n for (let i = 0; i < numKeys; i++) {\n let value\n if (values) {\n value = values[i]\n if (value === undefined && defaultValues) {\n value = defaultValues[i]\n }\n } else if (defaultValues) {\n value = defaultValues[i]\n }\n Object.defineProperty(o, keys[i], {\n enumerable: true,\n writable: true,\n configurable: true,\n value,\n })\n }\n return o\n }\n}\n","import type { ConstructorOf } from '../types/ConstructorOf'\n\n/**\n * Returns the constructor of the given object.\n * @template T - The type of the object.\n * @param o The object whose constructor is to be returned.\n * @returns The constructor of the object.\n * @example ```ts\n * class MyClass {}\n * getConstructor(new MyClass()) === MyClass;;\n * //=> true\n * ```\n */\nexport function getConstructor<T>(o: T): ConstructorOf<T> {\n return Object.getPrototypeOf(o).constructor\n}\n","import type { Constructor } from '../types/Constructor'\n\n/**\n * Copies static members from a source constructor to a target constructor, excluding specified keys.\n * @param target The target constructor to inherit static members.\n * @param source The source constructor to copy static members from.\n * @param ignoreKeys An optional array of keys to exclude from copying.\n * @returns The target constructor with the inherited static members.\n * @throws If `target` or `source` is not a constructor.\n * @param - The keys that should not be inherited.\n * @example ```ts\n * class Parent {\n * static parentStaticMethod() {\n * return 'Parent static method'\n * }\n * }\n * class Child {\n * static childStaticMethod() {\n * return 'Child static method'\n * }\n * }\n * inheritStaticMembers(Child, Parent)\n * Child.parentStaticMethod() //=> 'Parent static method'\n * ```\n */\nexport function inheritStaticMembers(target: Constructor, source: Constructor, ignoreKeys: string[] = []): Constructor {\n const ignore: Set<string | symbol> = new Set([...ignoreKeys, 'prototype', 'name', 'constructor'])\n for (const key of Reflect.ownKeys(source)) {\n if (ignore.has(key)) continue\n if (Reflect.has(target, key)) continue\n const des = Object.getOwnPropertyDescriptor(source, key)\n Object.defineProperty(target, key, des as PropertyDescriptor)\n }\n return target\n}\n","/**\n * Returns the first element of an iterable object.\n * @template T - The type of elements in the iterable.\n * @param iterable The iterable object.\n * @returns The first element of the iterable object, or `undefined` if the iterable is empty.\n * @example ```ts\n * iterableFirstElement([1, 2, 3, 4, 5]);;\n * //=> 1\n * ```\n */\nexport function iterableFirstElement<T>(iterable: Iterable<T>): T | undefined {\n for (const item of iterable) return item\n}\n","import { isConstructor, isPrototype } from '@bemoje/validation'\n\n/**\n * Iterate the prototype chain of a given object.\n * @remarks This function uses the `Reflect.getPrototypeOf` method to traverse the prototype chain.\n * It also uses the `isPrototype` and `isConstructor` helper functions to determine whether\n * the given object is a prototype or a constructor function.\n * @param object The object whose prototype chain is to be iterated over.\n * @throws If the provided object is not an object or a function, a TypeError will be thrown.\n * @returns A generator that yields each prototype in the chain.\n * @example ```ts\n * class A {}\n * class B extends A {}\n * class C extends B {}\n * const instance = new C()\n * iteratePrototypeChain(C)\n * //=> [ C, B, A, Function.prototype, Object.prototype]\n * iteratePrototypeChain(C.prototype)\n * //=> [C.prototype, B.prototype, A.prototype, Object.prototype]\n * iteratePrototypeChain(instance)\n * //=> [instance, C.prototype, B.prototype, A.prototype, Object.prototype]\n * ```\n */\nexport function* iteratePrototypeChain(object: Record<string, any>): Generator<Record<string, any>> {\n if (\n // if the below false, then object must be an instance\n !isPrototype(object) &&\n !isConstructor(object) &&\n // the two above depend on checking that typeof object is 'object',\n // so this last check is in case of arrow functions and generator functions\n object !== Function.prototype\n ) {\n yield object\n object = object.constructor.prototype\n }\n let objectOrNull: Record<string, any> | null = object\n while (objectOrNull) {\n yield objectOrNull\n objectOrNull = Reflect.getPrototypeOf(objectOrNull)\n }\n}\n","/**\n * Deep freezes an object, making it immutable by recursively freezing all nested objects and functions.\n * @returns The same object, but deeply frozen.\n * @throws If the object is not an object or function.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze | Object.freeze}\n * @param o The object to deep freeze.\n * This function uses `Object.freeze()` to freeze the object and all its nested objects and functions.\n * @example ```ts\n * const obj = {\n * prop1: 'value1',\n * prop2: {\n * nestedProp1: 'nestedValue1',\n * nestedProp2: {\n * deeplyNestedProp: 'deeplyNestedValue'\n * }\n * },\n * prop3: () => {\n * //=> Hello, world!\n * }\n * }\n * const frozenObj = objDeepFreeze(obj)\n * // Attempting to modify the frozen object will throw an error\n * frozenObj.prop1 //=> 'value1'\n * frozenObj.prop2.nestedProp1 //=> 'nestedValue1'\n * frozenObj.prop2.nestedProp2.deeplyNestedProp //=> 'deeplyNestedValue'\n * frozenObj.prop3() //=> undefined\n * ```\n */\nexport function objDeepFreeze(o: Record<string | symbol, any>): Record<string | symbol, any> {\n for (const key of Reflect.ownKeys(o)) {\n const value = o[key]\n if ((value && typeof value === 'object') || typeof value === 'function') {\n objDeepFreeze(value)\n }\n }\n return Object.freeze(o)\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Deletes a property from an object and returns the modified object.\n * @param obj The object from which to delete the property.\n * @template K - The type of the keys in the object.\n * @returns The modified object with the key deleted.\n * @param key The key of the property to delete.\n * @example ```ts\n * const obj = { name: 'John', age: 30 };\n * objDelete(obj, 'age');\n * //=> { name: 'John' }\n * ```\n */\nexport function objDelete<K extends ObjectKey, V>(obj: Record<K, V>, key: K): Omit<Record<K, V>, K> {\n delete obj[key]\n return obj\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an iterable of key-value pairs from the given object.\n * @remarks This function is a part of Object Utilities.\n * @typeparam V - The type of values in the object.\n * @returns An iterable of tuples where each tuple is a key-value pair from the object.\n * @param obj The object to iterate over.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * for (const [key, value] of objEntries(obj)) {\n * //=> a //=> b //=> c 3\n * }\n * ```\n */\nexport function* objEntries<V>(obj: Record<ObjectKey, V>): Iterable<[string, V]> {\n yield* Object.entries(obj)\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an array of key-value pairs from the given object.\n * @remarks This function is a utility for converting an object into an array of its entries.\n * Each entry is a tuple where the first element is the key and the second is the value.\n * @typeparam V - The type of the values in the object.\n * @returns An array of entries, where each entry is a tuple of a string and a value of type `V`.\n * @param obj The object to extract keyvalue pairs from.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * objEntriesArray(obj);\n * //=> [['a', 1], ['b', 2], ['c', 3]]\n * ```\n */\nexport function objEntriesArray<V>(obj: Record<ObjectKey, V>): Array<[string, V]> {\n return Array.from(Object.entries(obj))\n}\n","/**\n * Filters the properties of an object based on a callback function.\n * @param object The object to filter.\n * @param callback The callback function used to filter the object properties.\n * @template T - The type of the values in the object.\n * @param - The function to get the keys of the object. Defaults to `Object.keys`.\n * @returns A new object with the properties that passed the test. If no properties passed the test, an empty object will be returned.\n * @param getKeys The function used to get the keys of the object.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * objFilter(obj, (value, key) => value > 1);\n * //=> { b: 2, c: 3 }\n * ```\n */\nexport function objFilter<T>(\n object: Record<string, T>,\n callback: (value: T, key: string) => boolean,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): Record<string, T> {\n const result: Record<string, T> = {}\n for (const key of getKeys(object)) {\n if (callback(object[key], key)) {\n result[key] = object[key]\n }\n }\n return result\n}\n","/**\n * Applies a callback function to each key-value pair in an object.\n * @param object The object to iterate over.\n * @param callback The function to apply to each keyvalue pair.\n * @template T - The type of the object's properties.\n * @param - An optional function to determine the keys to iterate over. Defaults to `Object.keys`.\n * @returns The original object.\n * @param getKeys The function to retrieve the keys of the object.\n * @example ```ts\n * const myObject = { a: 1, b: 2, c: 3 };\n * objForEach(myObject, (value, key) => {\n * //=> ${key}: ${value}\n * });\n * ```\n */\nexport function objForEach<T>(\n object: Record<string, T>,\n callback: (value: T, key: string) => void,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): typeof object {\n for (const key of getKeys(object)) {\n callback(object[key], key)\n }\n return object\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Retrieves the value associated with the specified key from an object.\n * @param obj The object from which to retrieve the value.\n * @template K - The type of the keys in the object.\n * @returns The value of the specified key in the object, or `undefined` if the key does not exist.\n * @param key The key of the value to retrieve.\n * @example ```ts\n * const myObj = { name: 'John', age: 30 };\n * objGet(myObj, 'name');\n * //=> 'John'\n * objGet(myObj, 'age');\n * //=> 30\n * objGet(myObj, 'address');\n * //=> undefined\n * ```\n */\nexport function objGet<V>(obj: Record<ObjectKey, V>, key: ObjectKey): V | undefined {\n return obj[key]\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * This function attempts to retrieve a value from an object using a provided key.\n * If the key does not exist in the object, it uses a callback function to generate a default value.\n * @param obj The object from which to retrieve the value.\n * @param key The key to use when retrieving the value.\n * @param callback The function to call when the key does not exist in the object. This function should return the default value.\n * @returns The value associated with the key in the object, or the result of the callback function if the key does not exist in the object.\n * @example ```ts\n * objGetOrElse({ a: 1, b: 2 }, 'c', (key) => 3);;\n * //=> 3\n * ```\n * @typeparam V - The type of the values in the object.\n */\nexport function objGetOrElse<V>(obj: Record<ObjectKey, V>, key: ObjectKey, callback: (key: ObjectKey) => V): V {\n const value = obj[key]\n if (value !== undefined) return value\n return (obj[key] = callback(key))\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Checks if an object has a specific key.\n * @param obj The object to check.\n * @template K - The type of the keys in the object.\n * @returns Returns true if the object has the key, false otherwise.\n * @param key The key to check for.\n * @example ```ts\n * const myObj = { name: 'John', age: 30 };\n * objHas(myObj, 'name');\n * //=> true\n * objHas(myObj, 'email');\n * //=> false\n * ```\n */\nexport function objHas<V>(obj: Record<ObjectKey, V>, key: ObjectKey): boolean {\n return Object.hasOwn(obj, key)\n}\n","/**\n * Checks if an object is empty. This function iterates over the keys of the provided object and checks if any key is defined.\n * @remarks This function uses the `Object.keys()` method to check if the object has any keys.\n * If the object has at least one key, the function returns `false`, otherwise it returns `true`.\n * @typeparam T - The type of the values in the object.\n * @returns A boolean indicating whether the object is empty or not.\n * @param obj The object to check.\n * @example ```ts\n * const emptyObject = {};\n * const nonEmptyObject = { key: 'value' };\n * objIsEmpty(emptyObject);\n * //=> true\n * objIsEmpty(nonEmptyObject);\n * //=> false\n * ```\n */\nexport function objIsEmpty<T>(obj: Record<string, T>): boolean {\n for (const key of Object.keys(obj)) {\n if (key !== undefined) return false\n }\n return true\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an iterable of all the keys in the given object.\n * @remarks This function is a part of the `utils` module.\n * @typeparam V - The type of the values in the object.\n * @returns An iterable of the object's keys.\n * @param obj The object whose keys to iterate over.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * const keys = objKeys(obj);\n * for (const key of keys) {\n * //=> //=> //=> c\n * }\n * ```\n */\nexport function* objKeys<V>(obj: Record<ObjectKey, V>): Iterable<string> {\n yield* Object.keys(obj)\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an array of keys from the provided object.\n * @remarks This function is a part of Object Utilities.\n * @typeparam V - The type of values in the object.\n * @returns The array of keys of the input object.\n * @param obj The object from which to extract the keys.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * objKeysArray(obj);\n * //=> ['a', 'b', 'c']\n * ```\n */\nexport function objKeysArray<V>(obj: Record<ObjectKey, V>): string[] {\n return Array.from(Object.keys(obj))\n}\n","/**\n * Maps over the values of an object and returns a new object with the mapped values.\n * @param object The object to map over.\n * @param callback The mapping function to apply to each value.\n * @template T The type of the values in the input object.\n * @param An optional function to determine the keys to iterate over. Defaults to `Object.keys`.\n * @returns A new object with the same keys as the input object, but with each value transformed by the callback function.\n * @param getKeys The function used to get the keys of the object.\n * @example ```ts\n * const object = { a: 1, b: 2, c: 3 }\n * const callback = (value: number, key: string) => value * 2\n * objMap(object, callback) //=> { a: 2, b: 4, c: 6 }\n * ```\n */\nexport function objMap<T>(\n object: Record<string, T>,\n callback: (value: T, key: string) => T,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): Record<string, T> {\n const result: Record<string, T> = {}\n for (const key of getKeys(object)) {\n result[key] = callback(object[key], key)\n }\n return result\n}\n","/**\n * Maps the keys of an object using a callback function.\n * @param object The object whose keys will be mapped.\n * @param callback The callback function that maps the keys.\n * @template T - The type of the values in the object.\n * @param - The function to get the keys of the object.\n * @returns A new object with the keys mapped.\n * @param getKeys The function that retrieves the keys of the object.\n * @example ```ts\n * const object = { a: 1, b: 2, c: 3 };\n * const callback = (key: string, value: number) => key.toUpperCase();\n * objMapKeys(object, callback);\n * //=> { A: 1, B: 2, C: 3 }\n * ```\n */\nexport function objMapKeys<T>(\n object: Record<string, T>,\n callback: (key: string, value: T) => string,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): Record<string, T> {\n const result: Record<string, T> = {}\n for (const key of getKeys(object)) {\n result[callback(key, object[key])] = object[key]\n }\n return result\n}\n","/**\n * Applies a callback function to each key-value pair in an object and mutates the object.\n * @param object The object to be mapped.\n * @param callback The callback function to apply to each valuekey pair.\n * @template T - The type of the properties in the object.\n * @param - An optional function to determine the keys to be iterated over.\n * @returns The mutated object.\n * @param getKeys The function used to get the keys of the object.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * const callback = (value: number, key: string) => value * 2;\n * objMapMutable(obj, callback);\n * //=> { a: 2, b: 4, c: 6 }\n * ```\n */\nexport function objMapMutable<T>(\n object: Record<string, T>,\n callback: (value: T, key: string) => T,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): typeof object {\n for (const key of getKeys(object)) {\n object[key] = callback(object[key], key)\n }\n return object\n}\n","import { ObjectKey } from '../types/ObjectKey'\r\nimport { objFilter } from './objFilter'\r\n\r\n/**\r\n * Deletes specified keys from an object. This function takes an object and an array of keys to be deleted from the object. It returns a new object with the specified keys removed.\r\n * @param obj The object from which keys are to be deleted.\r\n * @template V - The type of the values in the object.\r\n * @returns A new object with the specified keys deleted.\r\n * @param keys The keys to be deleted from the object.\r\n * @example ```ts\r\n * const obj = { a: 1, b: 2, c: 3 };\r\n * objOmitKeys(obj, 'a', 'c');\r\n * //=> { b: 2 }\r\n * ```\r\n */\r\nexport function objOmitKeys<K extends ObjectKey, V>(obj: Record<K, V>, ...keys: string[]): Record<K, V> {\r\n return objFilter<any>(obj, (_, key: string) => !keys.includes(key)) as Record<K, V>\r\n}\r\n","/**\r\n * Deletes the specified keys from an object in a mutable way.\r\n * @param obj The object from which to delete the keys.\r\n * @returns The modified object with the specified keys deleted.\r\n * @typeparam V - The type of the values in the object.\r\n * @param keys The keys to delete from the object.\r\n * @example ```ts\r\n * const obj = { a: 1, b: 2, c: 3 };\r\n * objOmitKeysMutable(obj, 'a', 'c');\r\n * //=> { b: 2 }\r\n * ```\r\n */\r\nexport function objOmitKeysMutable<V>(obj: Record<string, V>, ...keys: string[]): Record<string, V> {\r\n for (const key of keys) {\r\n Reflect.deleteProperty(obj, key)\r\n }\r\n return obj\r\n}\r\n","import { ObjectKey } from '../types/ObjectKey'\r\n\r\n/**\r\n * Converts the specified properties of an object into getter functions.\r\n * @template K - The type of the keys of the object.\r\n * @template V - The type of the values of the object.\r\n * @template T - The type of the object.\r\n * @param object The object whose properties are to be converted into getter functions.\r\n * @param propertyNames The names of the properties to be converted into getter functions.\r\n * @returns The object with the specified properties converted into getter functions.\r\n * @throws Throws an error if the property descriptor for a specified property name is not found.\r\n * @example ```ts\r\n * const obj = { a: 1, b: 2, c: 3 };\r\n * objPropertyValueToGetter(obj, 'a', 'b');\r\n * obj.a;;\r\n * //=> 1\r\n * obj.b;;\r\n * //=> 2\r\n * obj.c;;\r\n * //=> 3\r\n * ```\r\n */\r\nexport function objPropertyValueToGetter<V, T extends Record<ObjectKey, V>>(\r\n object: T,\r\n ...propertyNames: ObjectKey[]\r\n): T {\r\n for (const propertyName of propertyNames) {\r\n const descriptor = Object.getOwnPropertyDescriptor(object, propertyName)\r\n if (!descriptor) throw new Error(`Property descriptor for '${String(propertyName)}' not found.`)\r\n const { enumerable, configurable, value } = descriptor\r\n Object.defineProperty(object, propertyName, { enumerable, configurable, get: () => value })\r\n }\r\n return object\r\n}\r\n","/**\n * Reduces the values of an object into a single value.\n * @param object The object to reduce.\n * @param callback The function that handles the reduction logic.\n * @param accum The initial value of the accumulator.\n * @template T - The type of the values in the input object.\n * @param - An optional function to get the keys of the object. Defaults to `Object.keys`.\n * @returns The final accumulated value.\n * @param getKeys The function that retrieves the keys of the object.\n * @example ```ts\n * const object = { a: 1, b: 2, c: 3 };\n * const callback = (accum, value, key) => accum + value;\n * const initialAccum = 0;\n * objReduce(object, callback, initialAccum);\n * //=> 6\n * ```\n */\nexport function objReduce<T, A>(\n object: Record<string, T>,\n callback: (accum: A, value: T, key: string) => A,\n accum: A,\n getKeys: (obj: typeof object) => Iterable<string> = Object.keys,\n): A {\n for (const key of getKeys(object)) {\n accum = callback(accum, object[key], key)\n }\n return accum\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objEntriesArray } from './objEntriesArray'\n\n/**\n * Reverses the order of the properties in the given object.\n * @remarks This function does not mutate the original object. It returns a new object with the properties in reverse order.\n * @param obj The object to reverse. The object's keys are of type `ObjectKey` and its values are of type `V`.\n * @returns A new object with the properties of the input object in reverse order. The returned object's keys are of type `ObjectKey` and its values are of type `V`.\n * @typeparam V - The type of the values in the input object and the returned object.\n * @example ```ts\n * objReverse({ a: 1, b: 2, c: 3 });;\n * //=> { c: 3, b: 2, a: 1 }\n * ```\n */\nexport function objReverse<V>(obj: Record<ObjectKey, V>): Record<ObjectKey, V> {\n return Object.fromEntries(objEntriesArray(obj).reverse())\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Sets a value for a key in an object and returns the value.\n * @template ObjectKey - The type of the keys in the object.\n * @template V - The type of the values in the object.\n * @param obj The object in which to set the value.\n * @param key The key for which to set the value.\n * @param value The value to set.\n * @returns The value that was set.\n * @example ```ts\n * objSet({ a: 1, b: 2 }, 'a', 3);;\n * //=> { a: 3, b: 2 }\n * ```\n */\nexport function objSet<V>(obj: Record<ObjectKey, V>, key: ObjectKey, value: V): V {\n return (obj[key] = value)\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Calculates and returns the size of the given object.\n * @remarks This function uses `Object.keys(obj).length` to determine the size of the object.\n * @param obj The object whose size is to be calculated.\n * @typeparam V - The type of the values in the object.\n * @returns The size of the object.\n * @example ```ts\n * objSize({ a: 1, b: 2, c: 3 });;\n * //=> 3\n * ```\n */\nexport function objSize<V>(obj: Record<ObjectKey, V>): number {\n return Object.keys(obj).length\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Sorts the keys of an object in alphabetical order.\n * @remarks This function does not mutate the original object. It returns a new object with sorted keys.\n * @typeparam V - The type of the values in the object.\n * @returns A new object with the same values as the original, but with keys sorted in ascending order.\n * @param o The object whose keys should be sorted.\n * @example ```ts\n * const obj = { c: 1, a: 2, b: 3 };\n * objSortKeys(obj);\n * //=> { a: 2, b: 3, c: 1 }\n * ```\n */\nexport function objSortKeys<V>(o: Record<ObjectKey, V>): Record<ObjectKey, V> {\n return Object.fromEntries(Object.entries(o).sort((a, b) => a[0].localeCompare(b[0])))\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Converts an object to a Map.\n * @remarks This function is useful when you need to convert an object to a Map data structure.\n * @typeparam V - The type of the values in the object.\n * @returns A new Map object populated with the [key, value] pairs from the original object.\n * @param obj The object to convert to a Map.\n * @example ```ts\n * const obj = { key1: 'value1', key2: 'value2' };\n * const map = objToMap(obj);\n * map.get('key1');\n * //=> 'value1'\n * map.get('key2');\n * //=> 'value2'\n * ```\n */\nexport function objToMap<V>(obj: Record<ObjectKey, V>): Map<string, V> {\n return new Map(Object.entries(obj))\n}\n","import { ObjectKey } from '../types/ObjectKey'\r\n\r\n/**\r\n * Updates the value of a specific key in an object using a callback function.\r\n * @template V - The type of the values in the object.\r\n * @param obj The object to update.\r\n * @param key The key of the value to update.\r\n * @param callback The function to generate the new value. It receives the current value and the key as arguments.\r\n * @returns The new value.\r\n * @example ```ts\r\n * objUpdate({ a: 1, b: 2 }, 'a', (value, key) => value + 1);;\r\n * //=> { a: 2, b: 2 }\r\n * ```\r\n */\r\nexport function objUpdate<V>(\r\n obj: Record<ObjectKey, V>,\r\n key: ObjectKey,\r\n callback: (value: V | undefined, key: ObjectKey) => V,\r\n): V {\r\n return (obj[key] = callback(obj[key], key))\r\n}\r\n","import { ObjectKey } from '../types/ObjectKey'\r\n\r\n/**\r\n * Updates the property descriptors of the specified properties on the given object.\r\n * @param object - The object whose property descriptors are to be updated.\r\n * @param properties - An array of property names for which the descriptors are to be updated.\r\n * @param update - A function that takes a property descriptor and a property name, and returns a new property descriptor.\r\n * @throws Will throw an error if any of the specified properties do not exist on the object.\r\n * @example ```ts\r\n * const obj = { a: 1, b: 2 };\r\n * objUpdatePropertyDescriptors(obj, ['a', 'b'], (descriptor, property) => {\r\n * descriptor.writable = true;\r\n * return obj;\r\n * });\r\n * ```\r\n */\r\nexport function objUpdatePropertyDescriptors<V>(\r\n object: Record<ObjectKey, V>,\r\n properties: string[],\r\n update: <T extends PropertyDescriptor>(descriptor: T, property: string) => T,\r\n): void {\r\n for (const p of properties) {\r\n if (!Object.hasOwn(object, p)) {\r\n throw new Error(`Property, '${p}' does not exist on object.`)\r\n }\r\n const descriptor = update(Object.getOwnPropertyDescriptor(object, p) as PropertyDescriptor, p)\r\n Object.defineProperty(object, p, descriptor)\r\n }\r\n}\r\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an iterable of the values of the given object.\n * @remarks This function uses the `Object.values()` method to get all the values of the object and then yields them one by one.\n * @typeparam V - The type of the values in the object.\n * @returns An iterable that yields all the values of the given object.\n * @param obj The object whose values should be returned.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * const values = objValues(obj);\n * for (const value of values) {\n * //=> {value}\n * }\n * // Output:\n * // 1\n * // 2\n * // 3\n * ```\n */\nexport function* objValues<V>(obj: Record<ObjectKey, V>): Iterable<V> {\n yield* Object.values(obj)\n}\n","import { ObjectKey } from '../types/ObjectKey'\n\n/**\n * Returns an array containing the values of the given object.\n * @remarks This function is a part of Object Utilities.\n * @typeparam V - The type of values in the object.\n * @returns An array of the values of the object.\n * @param obj The object whose values will be extracted.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * objValuesArray(obj);\n * //=> [1, 2, 3]\n * ```\n */\nexport function objValuesArray<V>(obj: Record<ObjectKey, V>): Array<V> {\n return Array.from(Object.values(obj))\n}\n","/**\n * Recursively traverses an object and invokes a callback function for every encountered non-object value.\n * The callback function is passed the non-object value and an array representing the path to the value.\n * @param node - The object to be traversed.\n * @param callback - The callback function to be invoked for every non-object value.\n * @example ```ts\n * const obj = { a: 1, b: { c: 2, d: [3, 4] } };\n * objWalk(obj, (value, path) => {\n * console.log(`Path: ${path.join('.')}, Value: ${value}`);\n * });\n * // Output:\n * // Path: a, Value: 1\n * // Path: b.c, Value: 2\n * // Path: b.d[0], Value: 3\n * // Path: b.d[1], Value: 4\n * ```\n */\nexport function objWalk(node: Record<string, any>, callback: (value: any, path: string[]) => void): void {\n function recurse(node: Record<string, any>, path: string[] = []) {\n for (const [key, child] of Object.entries(node)) {\n if (typeof child === 'object' && child !== null) {\n if (Array.isArray(child)) {\n child.forEach((node, index) => {\n recurse(node, path.concat([`${key}[${index}]`]))\n })\n } else {\n recurse(child, path.concat(key))\n }\n } else {\n callback(child, path.concat(key))\n }\n }\n }\n recurse(node)\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objUpdatePropertyDescriptors } from './objUpdatePropertyDescriptors'\n\n/**\n * Sets the enumerable property of the specified properties of an object to true.\n * @template T - The type of the object.\n * @param object The object whose properties' enumerable property will be set to true.\n * @param propertyNames The names of the properties to be set enumerable.\n * @returns void\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * setEnumerable(obj, 'a', 'b');\n * Object.keys(obj);;\n * //=> ['a', 'b']\n * ```\n * @remarks This function uses `Object.defineProperty` to set the enumerable property.\n * @throws Will throw an error if any of the specified properties do not exist on the object.\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty | Object.defineProperty}\n */\nexport function setEnumerable(object: Record<ObjectKey, any>, ...properties: string[]): void {\n objUpdatePropertyDescriptors(object, properties, (descriptor) => {\n descriptor.enumerable = true\n return descriptor\n })\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objUpdatePropertyDescriptors } from './objUpdatePropertyDescriptors'\n\n/**\n * Sets the specified properties of an object as non-configurable.\n * @remarks This function modifies the original object by setting the `configurable` attribute of the specified properties to `false`.\n * Once a property is made non-configurable, it can neither be deleted from the object nor changed to configurable.\n * @typeparam T - The type of the object.\n * @param object The object whose properties are to be made non-configurable.\n * @param properties The names of the properties to be made non-configurable.\n * @throws Will throw an error if any of the specified properties do not exist on the object.\n * @example ```ts\n * setNonConfigurable({ a: 1, b: 2, c: 3 }, 'a', 'b');\n * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'a');;\n * //=> {value: 1, writable: true, enumerable: true, configurable: false}\n * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'b');;\n * //=> {value: 2, writable: true, enumerable: true, configurable: false}\n * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'c');;\n * //=> {value: 3, writable: true, enumerable: true, configurable: true}\n * ```\n */\nexport function setNonConfigurable(object: Record<ObjectKey, any>, ...properties: string[]): void {\n objUpdatePropertyDescriptors(object, properties, (descriptor) => {\n descriptor.configurable = false\n return descriptor\n })\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objUpdatePropertyDescriptors } from './objUpdatePropertyDescriptors'\n\n/**\n * Sets the specified properties of an object as non-enumerable.\n * @remarks This function modifies the original object by setting the specified properties as non-enumerable.\n * If the object or any of the property names are not valid, it throws an error.\n * @param object The object whose properties are to be set as non-enumerable.\n * @param properties The names of the properties to be set as non-enumerable.\n * @throws Will throw an error if any of the specified properties do not exist on the object.\n * @example ```ts\n * setNonEnumerable({ a: 1, b: 2, c: 3 }, 'a', 'b');\n * Object.keys({ a: 1, b: 2, c: 3 });;\n * //=> ['c']\n * ```\n */\nexport function setNonEnumerable(object: Record<ObjectKey, any>, ...properties: string[]): void {\n objUpdatePropertyDescriptors(object, properties, (descriptor) => {\n descriptor.enumerable = false\n return descriptor\n })\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objUpdatePropertyDescriptors } from './objUpdatePropertyDescriptors'\n\n/**\n * Sets the specified properties of an object to be non-writable.\n * @template T - The type of the object.\n * @param object The object whose properties are to be made non-writable.\n * @param properties The names of the properties to be made non-writable.\n * @throws Will throw an error if any of the specified properties do not exist on the object.\n * @example ```ts\n * const obj = { a: 1, b: 2, c: 3 };\n * setNonWritable(obj, 'a', 'b');\n * obj;;\n * //=> { a: 1, b: 2, c: 3 }\n * obj.a = 10;;\n * //=> Throws an error\n * obj.b = 20;;\n * //=> Throws an error\n * obj.c = 30;;\n * //=> Works fine\n * ```\n */\nexport function setNonWritable(object: Record<ObjectKey, any>, ...properties: string[]): void {\n objUpdatePropertyDescriptors(object, properties, (descriptor) => {\n descriptor.writable = false\n return descriptor\n })\n}\n","import { ObjectKey } from '../types/ObjectKey'\nimport { objUpdatePropertyDescriptors } from './objUpdatePropertyDescriptors'\n\n/**\n * Sets the specified properties of an object to be writable.\n * @template T - The type of the object.\n * @param object The object whose properties are to be made writable.\n * @param propertyNames The names of the properties to be made writable.\n * @throws Will throw an error if any of the specified properties do not exist on the object.\n * @example ```ts\n * setWritable({ a: 1, b: 2 }, 'a', 'b').a = 3;;\n * //=> 3\n * setWritable({ a: 1, b: 2 }, 'a', 'b').b = 4;;\n * //=> 4\n * ```\n * @returns void\n */\nexport function setWritable(object: Record<ObjectKey, any>, ...properties: string[]): void {\n objUpdatePropertyDescriptors(object, properties, (descriptor) => {\n descriptor.writable = true\n return descriptor\n })\n}\n","/**\n * Converts the given data to a JSON string.\n * @template T - The type of the data to be converted to JSON.\n * @param data The data to be converted to JSON.\n * @param pretty Optional parameter that determines whether the resulting JSON string should be pretty-printed. Default is `false`.\n * @returns The JSON string representation of the given data.\n * @example ```ts\n * toJson({ name: 'John', age: 30 }, true);;\n * //=> \"{\\n \"name\": \"John\",\\n \"age\": 30\\n}\"\n * ```\n */\nexport function toJson<T>(data: T, pretty = false): string {\n return pretty ? JSON.stringify(data, null, 2) : JSON.stringify(data)\n}\n"],"names":["createObjectFactory","keys","defaultValues","numKeys","length","Error","values","o","i","value","Object","defineProperty","enumerable","writable","configurable","getConstructor","getPrototypeOf","constructor","inheritStaticMembers","target","source","ignoreKeys","ignore","Set","key","Reflect","ownKeys","has","des","getOwnPropertyDescriptor","iterableFirstElement","iterable","item","iteratePrototypeChain","object","isPrototype","isConstructor","Function","prototype","objectOrNull","objDeepFreeze","freeze","objDelete","obj","objEntries","entries","objEntriesArray","Array","from","objFilter","callback","getKeys","result","objForEach","objGet","objGetOrElse","objHas","hasOwn","objIsEmpty","objKeys","objKeysArray","objMap","objMapKeys","objMapMutable","objOmitKeys","_","includes","objOmitKeysMutable","deleteProperty","objPropertyValueToGetter","propertyNames","propertyName","descriptor","get","objReduce","accum","objReverse","fromEntries","reverse","objSet","objSize","objSortKeys","sort","a","b","localeCompare","objToMap","Map","objUpdate","objUpdatePropertyDescriptors","properties","update","p","objValues","objValuesArray","objWalk","node","recurse","path","child","isArray","forEach","index","concat","setEnumerable","setNonConfigurable","setNonEnumerable","setNonWritable","setWritable","toJson","data","pretty","JSON","stringify"],"mappings":";;;;6DAYgB,QAAA,CAAAA,mBAAmBA,CAAIC,IAAc,CAAEC,aAAmB,CAAA,CACxE,KAAM,CAAAC,OAAO,CAAGF,IAAI,CAACG,MAAM,CAC3B,GAAIF,aAAa,EAAIA,aAAa,CAACE,MAAM,CAAGD,OAAO,CACjD,KAAM,IAAI,CAAAE,KAAK,CAAC,+CAA+C,CAAC,CAElE,MAAO,UAAiBC,MAAY,CAAA,CAClC,GAAIA,MAAM,EAAIA,MAAM,CAACF,MAAM,CAAGD,OAAO,CACnC,KAAM,IAAI,CAAAE,KAAK,CAAC,wCAAwC,CAAC,CAE3D,KAAM,CAAAE,CAAC,CAAG,CAAA,CAAE,CACZ,IAAK,GAAI,CAAAC,CAAC,CAAG,CAAC,CAAEA,CAAC,CAAGL,OAAO,CAAEK,CAAC,EAAE,CAAE,CAChC,GAAI,CAAAC,KAAK,CACLH,MAAM,EACRG,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aA,CAACtE,MAA8B,CAAE,GAAGwD,UAAoB,CAAA,CACnFD,4BAA4B,CAACvD,MAAM,CAAEwD,UAAU,CAAGlB,UAAU,GAC1DA,UAAU,CAAC5D,UAAU,GAAO,CACrB4D,UAAU,CAClB,CACH,SCHgB,CAAAiC,kBAAkBA,CAACvE,MAA8B,CAAE,GAAGwD,UAAoB,CAAA,CACxFD,4BAA4B,CAACvD,MAAM,CAAEwD,UAAU,CAAGlB,UAAU,GAC1DA,UAAU,CAAC1D,YAAY,GAAQ,CACxB0D,UAAU,CAClB,CACH,SCVgB,CAAAkC,gBAAgBA,CAACxE,MAA8B,CAAE,GAAGwD,UAAoB,CAAA,CACtFD,4BAA4B,CAACvD,MAAM,CAAEwD,UAAU,CAAGlB,UAAU,GAC1DA,UAAU,CAAC5D,UAAU,GAAQ,CACtB4D,UAAU,CAClB,CACH,SCCgB,CAAAmC,cAAcA,CAACzE,MAA8B,CAAE,GAAGwD,UAAoB,CAAA,CACpFD,4BAA4B,CAACvD,MAAM,CAAEwD,UAAU,CAAGlB,UAAU,GAC1DA,UAAU,CAAC3D,QAAQ,GAAQ,CACpB2D,UAAU,CAClB,CACH,SCVgB,CAAAoC,WAAWA,CAAC1E,MAA8B,CAAE,GAAGwD,UAAoB,CAAA,CACjFD,4BAA4B,CAACvD,MAAM,CAAEwD,UAAU,CAAGlB,UAAU,GAC1DA,UAAU,CAAC3D,QAAQ,GAAO,CACnB2D,UAAU,CAClB,CACH,SCXgB,CAAAqC,MAAMA,CAAIC,IAAO,CAAEC,MAAM,GAAQ,CAAA,CAC/C,MAAO,CAAAA,MAAM,CAAGC,IAAI,CAACC,SAAS,CAACH,IAAI,CAAE,IAAI,CAAE,CAAC,CAAC,CAAGE,IAAI,CAACC,SAAS,CAACH,IAAI,CACrE"}
@@ -38,4 +38,7 @@ export * from './lib/setNonEnumerable';
38
38
  export * from './lib/setNonWritable';
39
39
  export * from './lib/setWritable';
40
40
  export * from './lib/toJson';
41
+ export * from './types/Constructor';
42
+ export * from './types/ConstructorOf';
43
+ export * from './types/ObjectKey';
41
44
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,sBAAsB,CAAA;AACpC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,qBAAqB,CAAA;AACnC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,uBAAuB,CAAA;AACrC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,qBAAqB,CAAA;AACnC,cAAc,mBAAmB,CAAA;AACjC,cAAc,0BAA0B,CAAA;AACxC,cAAc,gCAAgC,CAAA;AAC9C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oCAAoC,CAAA;AAClD,cAAc,iBAAiB,CAAA;AAC/B,cAAc,sBAAsB,CAAA;AACpC,cAAc,eAAe,CAAA;AAC7B,cAAc,qBAAqB,CAAA;AACnC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,cAAc,CAAA"}
1
+ {"version":3,"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
  {
2
2
  "name": "@bemoje/object",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Object related tools/util.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -19,7 +19,9 @@
19
19
  },
20
20
  "license": "MIT",
21
21
  "keywords": [],
22
- "dependencies": {},
22
+ "dependencies": {
23
+ "@bemoje/validation": "latest"
24
+ },
23
25
  "repository": {
24
26
  "type": "git",
25
27
  "url": "git+https://github.com/bemoje/tsmono.git"