@bemoje/object 2.2.0 → 2.2.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.
Files changed (261) hide show
  1. package/lib/index.cjs +853 -449
  2. package/lib/index.d.cts +548 -69
  3. package/lib/index.d.ts +548 -69
  4. package/lib/index.js +792 -64
  5. package/package.json +274 -530
  6. package/lib/arrAssign.cjs +0 -9
  7. package/lib/arrAssign.d.cts +0 -6
  8. package/lib/arrAssign.d.ts +0 -6
  9. package/lib/arrAssign.js +0 -8
  10. package/lib/className.cjs +0 -10
  11. package/lib/className.d.cts +0 -6
  12. package/lib/className.d.ts +0 -6
  13. package/lib/className.js +0 -8
  14. package/lib/constructorOf.cjs +0 -10
  15. package/lib/constructorOf.d.cts +0 -6
  16. package/lib/constructorOf.d.ts +0 -6
  17. package/lib/constructorOf.js +0 -8
  18. package/lib/createArrayMerger.cjs +0 -19
  19. package/lib/createArrayMerger.d.cts +0 -6
  20. package/lib/createArrayMerger.d.ts +0 -6
  21. package/lib/createArrayMerger.js +0 -17
  22. package/lib/createObjectMerger.cjs +0 -19
  23. package/lib/createObjectMerger.d.cts +0 -8
  24. package/lib/createObjectMerger.d.ts +0 -8
  25. package/lib/createObjectMerger.js +0 -17
  26. package/lib/defineAccessors.cjs +0 -14
  27. package/lib/defineAccessors.d.cts +0 -9
  28. package/lib/defineAccessors.d.ts +0 -9
  29. package/lib/defineAccessors.js +0 -12
  30. package/lib/defineGetter.cjs +0 -15
  31. package/lib/defineGetter.d.cts +0 -8
  32. package/lib/defineGetter.d.ts +0 -8
  33. package/lib/defineGetter.js +0 -13
  34. package/lib/defineLazyProperty.cjs +0 -19
  35. package/lib/defineLazyProperty.d.cts +0 -8
  36. package/lib/defineLazyProperty.d.ts +0 -8
  37. package/lib/defineLazyProperty.js +0 -16
  38. package/lib/defineMethod.cjs +0 -16
  39. package/lib/defineMethod.d.cts +0 -9
  40. package/lib/defineMethod.d.ts +0 -9
  41. package/lib/defineMethod.js +0 -14
  42. package/lib/defineProperty.cjs +0 -13
  43. package/lib/defineProperty.d.cts +0 -10
  44. package/lib/defineProperty.d.ts +0 -10
  45. package/lib/defineProperty.js +0 -11
  46. package/lib/defineSetter.cjs +0 -15
  47. package/lib/defineSetter.d.cts +0 -8
  48. package/lib/defineSetter.d.ts +0 -8
  49. package/lib/defineSetter.js +0 -13
  50. package/lib/defineValue.cjs +0 -15
  51. package/lib/defineValue.d.cts +0 -9
  52. package/lib/defineValue.d.ts +0 -9
  53. package/lib/defineValue.js +0 -13
  54. package/lib/deleteNullishPropsMutable.cjs +0 -15
  55. package/lib/deleteNullishPropsMutable.d.cts +0 -6
  56. package/lib/deleteNullishPropsMutable.d.ts +0 -6
  57. package/lib/deleteNullishPropsMutable.js +0 -13
  58. package/lib/entriesOf.cjs +0 -10
  59. package/lib/entriesOf.d.cts +0 -8
  60. package/lib/entriesOf.d.ts +0 -8
  61. package/lib/entriesOf.js +0 -8
  62. package/lib/filterObject.cjs +0 -18
  63. package/lib/filterObject.d.cts +0 -9
  64. package/lib/filterObject.d.ts +0 -9
  65. package/lib/filterObject.js +0 -15
  66. package/lib/filterObjectMutable.cjs +0 -16
  67. package/lib/filterObjectMutable.d.cts +0 -8
  68. package/lib/filterObjectMutable.d.ts +0 -8
  69. package/lib/filterObjectMutable.js +0 -14
  70. package/lib/getClassChain.cjs +0 -23
  71. package/lib/getClassChain.d.cts +0 -14
  72. package/lib/getClassChain.d.ts +0 -14
  73. package/lib/getClassChain.js +0 -21
  74. package/lib/getConfigurableMethodOrGetterKeys.cjs +0 -22
  75. package/lib/getConfigurableMethodOrGetterKeys.d.cts +0 -10
  76. package/lib/getConfigurableMethodOrGetterKeys.d.ts +0 -10
  77. package/lib/getConfigurableMethodOrGetterKeys.js +0 -20
  78. package/lib/getKeys.cjs +0 -13
  79. package/lib/getKeys.d.cts +0 -19
  80. package/lib/getKeys.d.ts +0 -19
  81. package/lib/getKeys.js +0 -10
  82. package/lib/getKeysPreset.cjs +0 -89
  83. package/lib/getKeysPreset.d.cts +0 -46
  84. package/lib/getKeysPreset.d.ts +0 -46
  85. package/lib/getKeysPreset.js +0 -86
  86. package/lib/getOwnProperty.cjs +0 -10
  87. package/lib/getOwnProperty.d.cts +0 -6
  88. package/lib/getOwnProperty.d.ts +0 -6
  89. package/lib/getOwnProperty.js +0 -8
  90. package/lib/getPrototypeChain.cjs +0 -18
  91. package/lib/getPrototypeChain.d.cts +0 -9
  92. package/lib/getPrototypeChain.d.ts +0 -9
  93. package/lib/getPrototypeChain.js +0 -16
  94. package/lib/getSuperClass.cjs +0 -15
  95. package/lib/getSuperClass.d.cts +0 -11
  96. package/lib/getSuperClass.d.ts +0 -11
  97. package/lib/getSuperClass.js +0 -12
  98. package/lib/getSuperClasses.cjs +0 -14
  99. package/lib/getSuperClasses.d.cts +0 -13
  100. package/lib/getSuperClasses.d.ts +0 -13
  101. package/lib/getSuperClasses.js +0 -11
  102. package/lib/hasOwnProperty.cjs +0 -10
  103. package/lib/hasOwnProperty.d.cts +0 -6
  104. package/lib/hasOwnProperty.d.ts +0 -6
  105. package/lib/hasOwnProperty.js +0 -8
  106. package/lib/hasProperty.cjs +0 -13
  107. package/lib/hasProperty.d.cts +0 -6
  108. package/lib/hasProperty.d.ts +0 -6
  109. package/lib/hasProperty.js +0 -10
  110. package/lib/hasPrototypeChainProperty.cjs +0 -15
  111. package/lib/hasPrototypeChainProperty.d.cts +0 -7
  112. package/lib/hasPrototypeChainProperty.d.ts +0 -7
  113. package/lib/hasPrototypeChainProperty.js +0 -12
  114. package/lib/inheritPrototypeMembers.cjs +0 -22
  115. package/lib/inheritPrototypeMembers.d.cts +0 -8
  116. package/lib/inheritPrototypeMembers.d.ts +0 -8
  117. package/lib/inheritPrototypeMembers.js +0 -20
  118. package/lib/inheritStaticMembers.cjs +0 -23
  119. package/lib/inheritStaticMembers.d.cts +0 -8
  120. package/lib/inheritStaticMembers.d.ts +0 -8
  121. package/lib/inheritStaticMembers.js +0 -21
  122. package/lib/isAccessorDescriptor.cjs +0 -19
  123. package/lib/isAccessorDescriptor.d.cts +0 -19
  124. package/lib/isAccessorDescriptor.d.ts +0 -19
  125. package/lib/isAccessorDescriptor.js +0 -17
  126. package/lib/isEnumerable.cjs +0 -10
  127. package/lib/isEnumerable.d.cts +0 -6
  128. package/lib/isEnumerable.d.ts +0 -6
  129. package/lib/isEnumerable.js +0 -8
  130. package/lib/isMethodValueDescriptor.cjs +0 -10
  131. package/lib/isMethodValueDescriptor.d.cts +0 -10
  132. package/lib/isMethodValueDescriptor.d.ts +0 -10
  133. package/lib/isMethodValueDescriptor.js +0 -8
  134. package/lib/isValueDescriptor.cjs +0 -19
  135. package/lib/isValueDescriptor.d.cts +0 -15
  136. package/lib/isValueDescriptor.d.ts +0 -15
  137. package/lib/isValueDescriptor.js +0 -17
  138. package/lib/iterableFirstElement.cjs +0 -10
  139. package/lib/iterableFirstElement.d.cts +0 -13
  140. package/lib/iterableFirstElement.d.ts +0 -13
  141. package/lib/iterableFirstElement.js +0 -8
  142. package/lib/iterateObject.cjs +0 -72
  143. package/lib/iterateObject.d.cts +0 -36
  144. package/lib/iterateObject.d.ts +0 -36
  145. package/lib/iterateObject.js +0 -70
  146. package/lib/keysOf.cjs +0 -10
  147. package/lib/keysOf.d.cts +0 -8
  148. package/lib/keysOf.d.ts +0 -8
  149. package/lib/keysOf.js +0 -8
  150. package/lib/mapObjectEntries.cjs +0 -17
  151. package/lib/mapObjectEntries.d.cts +0 -8
  152. package/lib/mapObjectEntries.d.ts +0 -8
  153. package/lib/mapObjectEntries.js +0 -14
  154. package/lib/mapObjectKeys.cjs +0 -16
  155. package/lib/mapObjectKeys.d.cts +0 -8
  156. package/lib/mapObjectKeys.d.ts +0 -8
  157. package/lib/mapObjectKeys.js +0 -13
  158. package/lib/objAssign.cjs +0 -9
  159. package/lib/objAssign.d.cts +0 -8
  160. package/lib/objAssign.d.ts +0 -8
  161. package/lib/objAssign.js +0 -8
  162. package/lib/objDeepFreeze.cjs +0 -16
  163. package/lib/objDeepFreeze.d.cts +0 -10
  164. package/lib/objDeepFreeze.d.ts +0 -10
  165. package/lib/objDeepFreeze.js +0 -14
  166. package/lib/objDefineLazyProperty.cjs +0 -29
  167. package/lib/objDefineLazyProperty.d.cts +0 -13
  168. package/lib/objDefineLazyProperty.d.ts +0 -13
  169. package/lib/objDefineLazyProperty.js +0 -27
  170. package/lib/objDelete.cjs +0 -11
  171. package/lib/objDelete.d.cts +0 -15
  172. package/lib/objDelete.d.ts +0 -15
  173. package/lib/objDelete.js +0 -9
  174. package/lib/objGet.cjs +0 -10
  175. package/lib/objGet.d.cts +0 -6
  176. package/lib/objGet.d.ts +0 -6
  177. package/lib/objGet.js +0 -8
  178. package/lib/objGetOrDefault.cjs +0 -16
  179. package/lib/objGetOrDefault.d.cts +0 -6
  180. package/lib/objGetOrDefault.d.ts +0 -6
  181. package/lib/objGetOrDefault.js +0 -13
  182. package/lib/objGetOrDefaultValue.cjs +0 -10
  183. package/lib/objGetOrDefaultValue.d.cts +0 -7
  184. package/lib/objGetOrDefaultValue.d.ts +0 -7
  185. package/lib/objGetOrDefaultValue.js +0 -8
  186. package/lib/objHas.cjs +0 -10
  187. package/lib/objHas.d.cts +0 -17
  188. package/lib/objHas.d.ts +0 -17
  189. package/lib/objHas.js +0 -8
  190. package/lib/objOmitKeysMutable.cjs +0 -16
  191. package/lib/objOmitKeysMutable.d.cts +0 -17
  192. package/lib/objOmitKeysMutable.d.ts +0 -17
  193. package/lib/objOmitKeysMutable.js +0 -14
  194. package/lib/objPropertyValueToGetter.cjs +0 -24
  195. package/lib/objPropertyValueToGetter.d.cts +0 -23
  196. package/lib/objPropertyValueToGetter.d.ts +0 -23
  197. package/lib/objPropertyValueToGetter.js +0 -22
  198. package/lib/objSet.cjs +0 -10
  199. package/lib/objSet.d.cts +0 -6
  200. package/lib/objSet.d.ts +0 -6
  201. package/lib/objSet.js +0 -8
  202. package/lib/objSize.cjs +0 -10
  203. package/lib/objSize.d.cts +0 -6
  204. package/lib/objSize.d.ts +0 -6
  205. package/lib/objSize.js +0 -8
  206. package/lib/objSortKeys.cjs +0 -18
  207. package/lib/objSortKeys.d.cts +0 -8
  208. package/lib/objSortKeys.d.ts +0 -8
  209. package/lib/objSortKeys.js +0 -16
  210. package/lib/objToMap.cjs +0 -10
  211. package/lib/objToMap.d.cts +0 -8
  212. package/lib/objToMap.d.ts +0 -8
  213. package/lib/objToMap.js +0 -8
  214. package/lib/objUpdate.cjs +0 -10
  215. package/lib/objUpdate.d.cts +0 -8
  216. package/lib/objUpdate.d.ts +0 -8
  217. package/lib/objUpdate.js +0 -8
  218. package/lib/objUpdatePropertyDescriptors.cjs +0 -16
  219. package/lib/objUpdatePropertyDescriptors.d.cts +0 -17
  220. package/lib/objUpdatePropertyDescriptors.d.ts +0 -17
  221. package/lib/objUpdatePropertyDescriptors.js +0 -14
  222. package/lib/propertyIsEnumerable.cjs +0 -10
  223. package/lib/propertyIsEnumerable.d.cts +0 -6
  224. package/lib/propertyIsEnumerable.d.ts +0 -6
  225. package/lib/propertyIsEnumerable.js +0 -8
  226. package/lib/setEnumerable.cjs +0 -15
  227. package/lib/setEnumerable.d.cts +0 -6
  228. package/lib/setEnumerable.d.ts +0 -6
  229. package/lib/setEnumerable.js +0 -13
  230. package/lib/setNonConfigurable.cjs +0 -15
  231. package/lib/setNonConfigurable.d.cts +0 -6
  232. package/lib/setNonConfigurable.d.ts +0 -6
  233. package/lib/setNonConfigurable.js +0 -13
  234. package/lib/setNonEnumerable.cjs +0 -15
  235. package/lib/setNonEnumerable.d.cts +0 -6
  236. package/lib/setNonEnumerable.d.ts +0 -6
  237. package/lib/setNonEnumerable.js +0 -13
  238. package/lib/setNonWritable.cjs +0 -15
  239. package/lib/setNonWritable.d.cts +0 -6
  240. package/lib/setNonWritable.d.ts +0 -6
  241. package/lib/setNonWritable.js +0 -13
  242. package/lib/setWritable.cjs +0 -15
  243. package/lib/setWritable.d.cts +0 -6
  244. package/lib/setWritable.d.ts +0 -6
  245. package/lib/setWritable.js +0 -13
  246. package/lib/sortKeys.cjs +0 -14
  247. package/lib/sortKeys.d.cts +0 -6
  248. package/lib/sortKeys.d.ts +0 -6
  249. package/lib/sortKeys.js +0 -12
  250. package/lib/sortKeysLike.cjs +0 -14
  251. package/lib/sortKeysLike.d.cts +0 -6
  252. package/lib/sortKeysLike.d.ts +0 -6
  253. package/lib/sortKeysLike.js +0 -12
  254. package/lib/staticClassKeysOf.cjs +0 -18
  255. package/lib/staticClassKeysOf.d.cts +0 -15
  256. package/lib/staticClassKeysOf.d.ts +0 -15
  257. package/lib/staticClassKeysOf.js +0 -16
  258. package/lib/valuesOf.cjs +0 -10
  259. package/lib/valuesOf.d.cts +0 -8
  260. package/lib/valuesOf.d.ts +0 -8
  261. package/lib/valuesOf.js +0 -8
package/lib/index.d.ts CHANGED
@@ -1,69 +1,548 @@
1
- export { arrAssign } from './arrAssign.js';
2
- export { className } from './className.js';
3
- export { constructorOf } from './constructorOf.js';
4
- export { createArrayMerger } from './createArrayMerger.js';
5
- export { createObjectMerger } from './createObjectMerger.js';
6
- export { defineAccessors } from './defineAccessors.js';
7
- export { defineGetter } from './defineGetter.js';
8
- export { defineLazyProperty } from './defineLazyProperty.js';
9
- export { defineMethod } from './defineMethod.js';
10
- export { defineProperty } from './defineProperty.js';
11
- export { defineSetter } from './defineSetter.js';
12
- export { defineValue } from './defineValue.js';
13
- export { deleteNullishPropsMutable } from './deleteNullishPropsMutable.js';
14
- export { entriesOf } from './entriesOf.js';
15
- export { filterObject } from './filterObject.js';
16
- export { filterObjectMutable } from './filterObjectMutable.js';
17
- export { getClassChain } from './getClassChain.js';
18
- export { getConfigurableMethodOrGetterKeys } from './getConfigurableMethodOrGetterKeys.js';
19
- export { getKeys } from './getKeys.js';
20
- export { GetKeysOptions, KeysPrimitiveTypeFrom, OptsKeyTypeVariants, OptsKeysVariants, getKeysPreset } from './getKeysPreset.js';
21
- export { getOwnProperty } from './getOwnProperty.js';
22
- export { getPrototypeChain } from './getPrototypeChain.js';
23
- export { getSuperClass } from './getSuperClass.js';
24
- export { getSuperClasses } from './getSuperClasses.js';
25
- export { hasOwnProperty } from './hasOwnProperty.js';
26
- export { hasProperty } from './hasProperty.js';
27
- export { hasPrototypeChainProperty } from './hasPrototypeChainProperty.js';
28
- export { inheritPrototypeMembers } from './inheritPrototypeMembers.js';
29
- export { inheritStaticMembers } from './inheritStaticMembers.js';
30
- export { AccessorDescriptor, AccessorsDescriptorAttributes, DescriptorAccessors, DescriptorBothAccessors, DescriptorGetter, DescriptorSetter, isAccessorDescriptor } from './isAccessorDescriptor.js';
31
- export { isEnumerable } from './isEnumerable.js';
32
- export { TypedValuePropertyDescriptor, isMethodValueDescriptor } from './isMethodValueDescriptor.js';
33
- export { DescriptorValue, ValueDescriptor, ValueDescriptorAttributes, isValueDescriptor } from './isValueDescriptor.js';
34
- export { iterableFirstElement } from './iterableFirstElement.js';
35
- export { IterateObjectYield, iterateObject } from './iterateObject.js';
36
- export { keysOf } from './keysOf.js';
37
- export { mapObjectEntries } from './mapObjectEntries.js';
38
- export { mapObjectKeys } from './mapObjectKeys.js';
39
- export { objAssign } from './objAssign.js';
40
- export { objDeepFreeze } from './objDeepFreeze.js';
41
- export { objDefineLazyProperty } from './objDefineLazyProperty.js';
42
- export { objDelete } from './objDelete.js';
43
- export { objGet } from './objGet.js';
44
- export { objGetOrDefault } from './objGetOrDefault.js';
45
- export { objGetOrDefaultValue } from './objGetOrDefaultValue.js';
46
- export { objHas } from './objHas.js';
47
- export { objOmitKeysMutable } from './objOmitKeysMutable.js';
48
- export { objPropertyValueToGetter } from './objPropertyValueToGetter.js';
49
- export { objSet } from './objSet.js';
50
- export { objSize } from './objSize.js';
51
- export { objSortKeys } from './objSortKeys.js';
52
- export { objToMap } from './objToMap.js';
53
- export { objUpdate } from './objUpdate.js';
54
- export { objUpdatePropertyDescriptors } from './objUpdatePropertyDescriptors.js';
55
- export { propertyIsEnumerable } from './propertyIsEnumerable.js';
56
- export { setEnumerable } from './setEnumerable.js';
57
- export { setNonConfigurable } from './setNonConfigurable.js';
58
- export { setNonEnumerable } from './setNonEnumerable.js';
59
- export { setNonWritable } from './setNonWritable.js';
60
- export { setWritable } from './setWritable.js';
61
- export { sortKeys } from './sortKeys.js';
62
- export { sortKeysLike } from './sortKeysLike.js';
63
- export { StaticClassKeyof, staticClassKeysOf } from './staticClassKeysOf.js';
64
- export { valuesOf } from './valuesOf.js';
65
- import './Any-ChepAe8v.js';
66
- import './StringKeyOf-9CGLwjJv.js';
67
- import './ValueOf-BavVw9sa.js';
68
- import './AnyConstructor-qEIOpSTw.js';
69
- import './basic.d-DKLJnFDs.js';
1
+ /**
2
+ * Array assignment function that merges arrays excluding null and undefined values.
3
+ */
4
+ declare const arrAssign: <E extends unknown>(target: E[], ...sources: E[][]) => E[];
5
+
6
+ /**
7
+ * Get the class name of an object from its constructor.
8
+ */
9
+ declare function className(target: object): string;
10
+
11
+ /**
12
+ * Returns the constructor of the given object.
13
+ */
14
+ declare function constructorOf<T = object>(o: T): any;
15
+
16
+ /**
17
+ * Creates a function that merges arrays based on a predicate function.
18
+ */
19
+ declare function createArrayMerger<T>(predicate: (value: T, index: number, arr: T[]) => boolean): <E extends T>(target: E[], ...sources: E[][]) => E[];
20
+
21
+ /**
22
+ Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
23
+
24
+ @category Class
25
+ */
26
+ type Constructor<T, Arguments extends unknown[] = any[]> = new(...arguments_: Arguments) => T;
27
+
28
+ type Any = any;
29
+
30
+ type TFunction<R = Any, A extends Any[] = Any[]> = (...args: A) => R;
31
+
32
+ type AnyFunction<Ret = Any, Args extends Any[] = Any[]> = Constructor<Ret, Args> | TFunction<Ret, Args>;
33
+
34
+ type AnyConstructor = (new (...args: any[]) => Any) | AnyFunction;
35
+
36
+ type StringKeyOf<T> = Extract<keyof T, string>;
37
+
38
+ /**
39
+ * Gets the union type of all values in the given object type.
40
+ */
41
+ type ValueOf<O> = O[keyof O];
42
+
43
+ /**
44
+ * Creates a function that merges objects based on a predicate function.
45
+ */
46
+ declare function createObjectMerger(predicate: (value: Any, key: string, obj: Record<string, Any>) => boolean): (target: Record<string, Any>, ...sources: Record<string, Any>[]) => Record<string, any>;
47
+
48
+ /**
49
+ * Check if the given descriptor is an accessor descriptor.
50
+ */
51
+ declare function isAccessorDescriptor<T>(des?: TypedPropertyDescriptor<T>): des is AccessorDescriptor<T>;
52
+ type DescriptorGetter<V> = {
53
+ get: () => V;
54
+ };
55
+ type DescriptorSetter<V> = {
56
+ set: (value: V) => void;
57
+ };
58
+ type DescriptorBothAccessors<V> = DescriptorGetter<V> & DescriptorSetter<V>;
59
+ type DescriptorAccessors<V> = DescriptorGetter<V> | DescriptorSetter<V> | DescriptorBothAccessors<V>;
60
+ type AccessorsDescriptorAttributes = {
61
+ configurable?: boolean;
62
+ enumerable?: boolean;
63
+ };
64
+ type AccessorDescriptor<T> = AccessorsDescriptorAttributes & DescriptorAccessors<T>;
65
+
66
+ /**
67
+ * Define accessor properties (getter and setter) on an object with enhanced descriptor handling.
68
+ */
69
+ declare function defineAccessors<T extends object, V = object>(obj: T, //
70
+ key: PropertyKey, des: AccessorDescriptor<V>): T;
71
+
72
+ /**
73
+ * Define a getter property on an object with enhanced descriptor handling.
74
+ */
75
+ declare function defineGetter<T extends object, V = object>(obj: T, key: PropertyKey, get: () => V, des?: Omit<AccessorDescriptor<V>, 'get'>): T;
76
+
77
+ /**
78
+ * Define a lazy property that evaluates its getter on first access and then caches the value.
79
+ */
80
+ declare function defineLazyProperty<T extends object, V = object>(obj: T, key: PropertyKey, get: () => V, des?: Omit<AccessorDescriptor<V>, 'get'>): T;
81
+
82
+ /**
83
+ * Check if the given descriptor is a value descriptor.
84
+ */
85
+ declare function isValueDescriptor<T>(des?: TypedPropertyDescriptor<T>): des is ValueDescriptor<T>;
86
+ type DescriptorValue<V> = {
87
+ value?: V;
88
+ };
89
+ type ValueDescriptorAttributes = {
90
+ configurable?: boolean;
91
+ enumerable?: boolean;
92
+ writable?: boolean;
93
+ };
94
+ type ValueDescriptor<T> = ValueDescriptorAttributes & DescriptorValue<T>;
95
+
96
+ /**
97
+ * Define a method property on an object with enhanced descriptor handling.
98
+ */
99
+ declare function defineMethod<T extends object, V = object>(obj: T, key: PropertyKey, value: V, des?: ValueDescriptor<T> | AccessorDescriptor<T>): T;
100
+
101
+ /**
102
+ * Utility function for defining properties on objects with enhanced descriptor handling.
103
+ */
104
+ declare function defineProperty<T extends object>(obj: T, //
105
+ key: PropertyKey, des: ValueDescriptor<T> | AccessorDescriptor<T>): T;
106
+
107
+ /**
108
+ * Define a setter property on an object with enhanced descriptor handling.
109
+ */
110
+ declare function defineSetter<T extends object, V = object>(obj: T, key: PropertyKey, set: (value: V) => void, des?: Omit<AccessorDescriptor<V>, 'set'>): T;
111
+
112
+ /**
113
+ * Define a value property on an object with enhanced descriptor handling.
114
+ */
115
+ declare function defineValue<T extends object, V = object>(obj: T, key: PropertyKey, value: V, des?: ValueDescriptor<T> | AccessorDescriptor<T>): T;
116
+
117
+ /**
118
+ * Mutably delete enumerable properties with null or undefined values.
119
+ */
120
+ declare function deleteNullishPropsMutable<T extends object>(obj: T): T;
121
+
122
+ /**
123
+ * Same as Object.entries except the keys are typed as keyof T.
124
+ */
125
+ declare function entriesOf<T extends object>(obj: T): [StringKeyOf<T>, T[StringKeyOf<T>]][];
126
+
127
+ /**
128
+ * Filter an object's own enumerable properties by predicate.
129
+ */
130
+ declare function filterObject<T extends object>(obj: T, predicate: (value: ValueOf<T>, key: StringKeyOf<T>, obj: T) => boolean): T;
131
+
132
+ /**
133
+ * Mutably filter an object's own properties based on a given predicate.
134
+ */
135
+ declare function filterObjectMutable<T extends object>(obj: T, predicate: (value: ValueOf<T>, key: keyof T, obj: T) => boolean): Partial<T>;
136
+
137
+ /**
138
+ * Get the class constructor chain for any target (constructor, prototype, or instance).
139
+ * Always returns constructors/classes, never prototype objects.
140
+ * By default excludes the target's own constructor (returns superclasses only).
141
+ */
142
+ declare function getClassChain(target: object | AnyConstructor, options?: {
143
+ includeSelf?: boolean;
144
+ }): AnyConstructor[];
145
+
146
+ /**
147
+ * Returns an array of keys representing configurable methods or getters of an object.
148
+ *
149
+ * @template T - The type of the object.
150
+ * @param obj - The object to retrieve the keys from.
151
+ * @returns An array of keys representing configurable methods or getters.
152
+ */
153
+ declare function getConfigurableMethodOrGetterKeys<T extends object>(obj: T): string[];
154
+
155
+ /**
156
+ * Creates a preset function for getting object keys with specific filtering options.
157
+ */
158
+ declare function getKeysPreset<K extends OptsKeysVariants, KT extends OptsKeyTypeVariants>(options?: GetKeysOptions<K, KT>): (o: object) => KeysPrimitiveTypeFrom<KT>[];
159
+ interface IOptsKeys {
160
+ ignoreEnumerable?: boolean;
161
+ ignoreNonEnumerable?: boolean;
162
+ }
163
+ interface IOptsEnumerableKeys extends IOptsKeys {
164
+ ignoreEnumerable?: false;
165
+ ignoreNonEnumerable: true;
166
+ }
167
+ interface IOptsNonEnumerableKeys extends IOptsKeys {
168
+ ignoreEnumerable: true;
169
+ ignoreNonEnumerable?: false;
170
+ }
171
+ interface IOptsEnumerableAndNonEnumerableKeys extends IOptsKeys {
172
+ ignoreEnumerable?: false;
173
+ ignoreNonEnumerable?: false;
174
+ }
175
+ interface IOptsKeyType {
176
+ ignore?: (string | symbol)[];
177
+ ignoreSymbols?: boolean;
178
+ ignoreStrings?: boolean;
179
+ }
180
+ interface IOptsStringKeys extends IOptsKeyType {
181
+ ignore?: string[];
182
+ ignoreSymbols: true;
183
+ ignoreStrings?: false;
184
+ }
185
+ interface IOptsSymbolKeys extends IOptsKeyType {
186
+ ignore?: symbol[];
187
+ ignoreSymbols?: false;
188
+ ignoreStrings: true;
189
+ }
190
+ interface IOptsStringAndSymbolKeys extends IOptsKeyType {
191
+ ignore?: (string | symbol)[];
192
+ ignoreSymbols?: false;
193
+ ignoreStrings?: false;
194
+ }
195
+ type OptsKeysVariants = IOptsEnumerableKeys | IOptsNonEnumerableKeys | IOptsEnumerableAndNonEnumerableKeys;
196
+ type OptsKeyTypeVariants = IOptsStringKeys | IOptsSymbolKeys | IOptsStringAndSymbolKeys;
197
+ type GetKeysOptions<K extends OptsKeysVariants, KT extends OptsKeyTypeVariants> = K & KT;
198
+ type KeysPrimitiveTypeFrom<P extends OptsKeyTypeVariants> = P extends IOptsStringKeys ? string : P extends IOptsSymbolKeys ? symbol : string | symbol;
199
+
200
+ /**
201
+ * Returns an array of the own property keys of an object.
202
+ *
203
+ * Every combination of ways to toggle enumerable/non-enumerable/strings/symbols
204
+ * are available. Ignoring specific keys is also possible.
205
+ *
206
+ * @remarks
207
+ * The options are typed so that non-sensical or impossible combinations are disallowed.
208
+ *
209
+ * @remarks
210
+ * The prototype chain is not traversed, but used in tandom with
211
+ * @see prototypeChain you can easily specify exactly what keys you need.
212
+ * @see superClassChain for traversing only class constructors of the prototype chain.
213
+ */
214
+ declare function getKeys<K extends OptsKeysVariants, KT extends OptsKeyTypeVariants>(o: object, options?: GetKeysOptions<K, KT>): KeysPrimitiveTypeFrom<KT>[];
215
+
216
+ /**
217
+ * Returns a given own property value of a given object.
218
+ */
219
+ declare function getOwnProperty(obj: object, key: PropertyKey): undefined;
220
+
221
+ /**
222
+ * Get the prototype chain of any object.
223
+ * Returns prototype objects, not constructors.
224
+ */
225
+ declare function getPrototypeChain(target: object, options?: {
226
+ includeSelf?: boolean;
227
+ }): object[];
228
+
229
+ /**
230
+ * Get the immediate superclass of a target.
231
+ * Returns Object if no meaningful superclass exists.
232
+ */
233
+ declare function getSuperClass(target: object | AnyConstructor): AnyConstructor;
234
+
235
+ /**
236
+ * Get all superclasses of a target (excluding the target itself by default).
237
+ * Simpler version without overloads - just returns the class chain.
238
+ */
239
+ declare function getSuperClasses(target: object | AnyConstructor, options?: {
240
+ includeSelf?: boolean;
241
+ }): AnyConstructor[];
242
+
243
+ /**
244
+ * Object.prototype.hasOwnProperty.call
245
+ */
246
+ declare function hasOwnProperty<T extends object>(object: T, key: PropertyKey): boolean;
247
+
248
+ /**
249
+ * Determines if a property is defined on an object, including 'own' and prototype chain.
250
+ */
251
+ declare function hasProperty<T extends object>(object: T, key: PropertyKey): key is keyof T;
252
+
253
+ /**
254
+ * Determines if a property is defined on an object's prototype prototype chain, not
255
+ * including the object itself.
256
+ */
257
+ declare function hasPrototypeChainProperty<T extends object>(object: T, key: PropertyKey): boolean;
258
+
259
+ /**
260
+ * Copies prototype members from a source constructor to a target constructor, excluding specified keys.
261
+ */
262
+ declare function inheritPrototypeMembers<T extends Constructor<object>>(target: T, source: Constructor<object>, ignoreKeys?: PropertyKey[]): T;
263
+
264
+ /**
265
+ * Copies static members from a source constructor to a target constructor, excluding specified keys.
266
+ */
267
+ declare function inheritStaticMembers<T extends Constructor<object>>(target: T, source: Constructor<object>, ignoreKeys?: PropertyKey[]): T;
268
+
269
+ /**
270
+ * Check if the property is enumerable.
271
+ */
272
+ declare function isEnumerable<T extends object>(target: T, key: PropertyKey): boolean;
273
+
274
+ /**
275
+ * Checks if a property descriptor represents a method (function value descriptor).
276
+ */
277
+ declare function isMethodValueDescriptor(descriptor: PropertyDescriptor): descriptor is TypedValuePropertyDescriptor<typeof Function.prototype>;
278
+ type TypedValuePropertyDescriptor<V = unknown> = ValueDescriptorAttributes & DescriptorValue<V> & ThisType<Any>;
279
+
280
+ /**
281
+ * Returns the first element of an iterable object.
282
+ * @template T - The type of elements in the iterable.
283
+ * @param iterable The iterable object.
284
+ * @returns The first element of the iterable object, or `undefined` if the iterable is empty.
285
+ * @example ```ts
286
+ * iterableFirstElement([1, 2, 3, 4, 5]);
287
+ * //=> 1
288
+ * ```
289
+ */
290
+ declare function iterableFirstElement<T>(iterable: Iterable<T>): T | undefined;
291
+
292
+ /**
293
+ * Interface describing the data yielded by iterateObject for each node in the traversal
294
+ */
295
+ interface IterateObjectYield<T extends object = object, V = unknown> {
296
+ /** The parent object containing the current value */
297
+ object: object;
298
+ /** The key or index of the current value in its parent object */
299
+ key: string | number;
300
+ /** The value at the current node */
301
+ value: V;
302
+ /** Array representation of the path to the current node */
303
+ propertyPathArray: (string | number)[];
304
+ /** Lodash-style property path string (e.g., 'a.b[0].c') */
305
+ propertyPath: string | number | symbol | readonly (string | number | symbol)[];
306
+ /** Whether this node is a primitive value */
307
+ isLeaf: boolean;
308
+ /** The type of container at this node */
309
+ nodeType: 'object' | 'array';
310
+ /** Reference to the root object being traversed */
311
+ root: T;
312
+ }
313
+ /**
314
+ * Generator that performs a depth-first traversal of an object's structure.
315
+ * Yields information about each node including its path, value, and container type.
316
+ * Handles circular references and maintains parent-child relationships.
317
+ *
318
+ * Key features:
319
+ * - Supports both objects and arrays
320
+ * - Generates Lodash-style property paths
321
+ * - Detects leaf nodes (primitives)
322
+ * - Prevents circular reference loops
323
+ * - Preserves traversal order
324
+ */
325
+ declare function iterateObject<T extends object = object, V = unknown>(root: T): Generator<IterateObjectYield<T, V>>;
326
+
327
+ /**
328
+ * Same as Object.keys except the keys are typed as string keys of T.
329
+ */
330
+ declare function keysOf<T extends object>(obj: T): StringKeyOf<T>[];
331
+
332
+ /**
333
+ * Maps over an object's entries, transforming both keys and values using the provided function.
334
+ */
335
+ declare function mapObjectEntries<T extends object, K extends PropertyKey, V>(obj: T, fn: (key: StringKeyOf<T>, value: T[StringKeyOf<T>]) => [K, V]): Record<K, V>;
336
+
337
+ /**
338
+ * Maps over an object's keys, transforming each key using the provided function while preserving values.
339
+ */
340
+ declare function mapObjectKeys<T extends object, K extends PropertyKey>(obj: T, fn: (key: StringKeyOf<T>, value: T[StringKeyOf<T>]) => K): Record<K, T[StringKeyOf<T>]>;
341
+
342
+ /**
343
+ * Like Object.assign, but only copies source object property values != null.
344
+ */
345
+ declare const objAssign: (target: Record<string, Any>, ...sources: Record<string, Any>[]) => Record<string, any>;
346
+
347
+ /**
348
+ * Deep freezes an object.
349
+ *
350
+ * Note: Deep recursion may cause stack overflow for very deeply nested objects.
351
+ */
352
+ declare function objDeepFreeze(o: Record<PropertyKey, Any>): Record<PropertyKey, Any>;
353
+
354
+ /**
355
+ * Defines a lazy property on an object. The property will be lazily evaluated on the first access and then cached for subsequent accesses.
356
+ * The property is both enumerable and configurable.
357
+ *
358
+ * @typeParam T - The type of the object on which the property will be defined. Must be a record with string keys.
359
+ * @param object - The object on which to define the property.
360
+ * @param key - The key of the property to define.
361
+ * @param getValue - A function that returns the value of the property. This function will be called the first time the property is accessed.
362
+ * @returns The original object with the newly defined property.
363
+ */
364
+ declare function objDefineLazyProperty<T extends Record<string, unknown>>(object: T, key: string, getValue: (...args: unknown[]) => unknown): T;
365
+
366
+ /**
367
+ * Deletes a property from an object and returns the modified object.
368
+ * @param obj The object from which to delete the property.
369
+ * @template K - The type of the keys in the object.
370
+ * @returns The modified object with the key deleted.
371
+ * @param key The key of the property to delete.
372
+ * @example ```ts
373
+ * const obj = { name: 'John', age: 30 };
374
+ * objDelete(obj, 'age');
375
+ * //=> { name: 'John' }
376
+ * ```
377
+ */
378
+ declare function objDelete<K extends PropertyKey, V>(obj: Record<K, V>, key: K): Omit<Record<K, V>, K>;
379
+
380
+ /**
381
+ * Retrieves the value associated with the specified key from an object.
382
+ */
383
+ declare function objGet<T, K extends keyof T>(obj: T, key: K): T[K];
384
+
385
+ /**
386
+ * Gets a property value from an object or creates it using a factory function if it doesn't exist.
387
+ */
388
+ declare function objGetOrDefault<K extends PropertyKey, V>(object: Record<K, V>, key: K, factory: (key: K) => V): V;
389
+
390
+ /**
391
+ * This function attempts to retrieve a value from an object using a provided key.
392
+ * If the key does not exist in the object, it sets the provided default value in the object and returns it.
393
+ */
394
+ declare function objGetOrDefaultValue<T, K extends keyof T>(obj: T, key: K, defaultValue: T[K]): T[K];
395
+
396
+ /**
397
+ * Checks if an object has a specific key.
398
+ * @param obj The object to check.
399
+ * @template K - The type of the keys in the object.
400
+ * @returns Returns true if the object has the key, false otherwise.
401
+ * @param key The key to check for.
402
+ * @example ```ts
403
+ * const myObj = { name: 'John', age: 30 };
404
+ * objHas(myObj, 'name');
405
+ * //=> true
406
+ * objHas(myObj, 'email');
407
+ * //=> false
408
+ * ```
409
+ */
410
+ declare function objHas<V>(obj: Record<PropertyKey, V>, key: PropertyKey): boolean;
411
+
412
+ /**
413
+ * Deletes the specified keys from an object in a mutable way.
414
+ * @param obj The object from which to delete the keys.
415
+ * @returns The modified object with the specified keys deleted.
416
+ * @typeparam V - The type of the values in the object.
417
+ * @param keys The keys to delete from the object.
418
+ * @example ```ts
419
+ * const obj = { a: 1, b: 2, c: 3 };
420
+ * objOmitKeysMutable(obj, 'a', 'c');
421
+ * //=> { b: 2 }
422
+ * ```
423
+ */
424
+ declare function objOmitKeysMutable<O extends Record<PropertyKey, Any>>(obj: O, ...keys: PropertyKey[]): O;
425
+
426
+ /**
427
+ * Converts the specified properties of an object into getter functions.
428
+ * @template K - The type of the keys of the object.
429
+ * @template V - The type of the values of the object.
430
+ * @template T - The type of the object.
431
+ * @param object The object whose properties are to be converted into getter functions.
432
+ * @param propertyNames The names of the properties to be converted into getter functions.
433
+ * @returns The object with the specified properties converted into getter functions.
434
+ * @throws Throws an error if the property descriptor for a specified property name is not found.
435
+ * @example ```ts
436
+ * const obj = { a: 1, b: 2, c: 3 };
437
+ * objPropertyValueToGetter(obj, 'a', 'b');
438
+ * obj.a;
439
+ * //=> 1
440
+ * obj.b;
441
+ * //=> 2
442
+ * obj.c;
443
+ * //=> 3
444
+ * ```
445
+ */
446
+ declare function objPropertyValueToGetter<V, T extends Record<PropertyKey, V>>(object: T, ...propertyNames: PropertyKey[]): T;
447
+
448
+ /**
449
+ * Sets a value for a key in an object and returns the value.
450
+ */
451
+ declare function objSet<T, K extends keyof T>(obj: T, key: K, value: T[K]): T[K];
452
+
453
+ /**
454
+ * Returns the number of enumerable keys in an object.
455
+ */
456
+ declare function objSize(obj: object): number;
457
+
458
+ /**
459
+ * Sorts the keys of an object in alphabetical order unless a custom compare function is provided.
460
+ */
461
+ declare function objSortKeys<T extends object>(o: T, compare?: (a: [string, ValueOf<T>], b: [string, ValueOf<T>]) => number): T;
462
+
463
+ /**
464
+ * Converts an object to a Map.
465
+ */
466
+ declare function objToMap<T extends object>(obj: T): Map<string, ValueOf<T>>;
467
+
468
+ /**
469
+ * Updates the value of a specific key in an object using a callback function.
470
+ */
471
+ declare function objUpdate<T, V extends ValueOf<T>>(obj: T, key: keyof T, callback: (value: ValueOf<T> | undefined, key: PropertyKey, obj: T) => V): V;
472
+
473
+ /**
474
+ * Updates the property descriptors of the specified properties on the given object.
475
+ * @param object - The object whose property descriptors are to be updated.
476
+ * @param properties - An array of property names for which the descriptors are to be updated.
477
+ * @param update - A function that takes a property descriptor and a property name, and returns a new property descriptor.
478
+ * @throws Will throw an error if any of the specified properties do not exist on the object.
479
+ * @example ```ts
480
+ * const obj = { a: 1, b: 2 };
481
+ * objUpdatePropertyDescriptors(obj, ['a', 'b'], (descriptor, property) => {
482
+ * descriptor.writable = true;
483
+ * return obj;
484
+ * });
485
+ * ```
486
+ */
487
+ declare function objUpdatePropertyDescriptors<V>(object: Record<PropertyKey, V>, properties: PropertyKey[], update: (descriptor: PropertyDescriptor, property: PropertyKey) => PropertyDescriptor): void;
488
+
489
+ /**
490
+ * Calls Object.prototype.propertyIsEnumerable on the given object.
491
+ */
492
+ declare function propertyIsEnumerable(o: object, key: PropertyKey): boolean;
493
+
494
+ /**
495
+ * Sets the enumerable property of the specified properties of an object to true.
496
+ */
497
+ declare function setEnumerable<T extends object>(object: T, ...keys: string[]): T;
498
+
499
+ /**
500
+ * Sets the specified properties of an object as non-configurable.
501
+ */
502
+ declare function setNonConfigurable<T extends object>(object: T, ...properties: string[]): T;
503
+
504
+ /**
505
+ * Sets the specified properties of an object as non-enumerable.
506
+ */
507
+ declare function setNonEnumerable<T extends object>(object: T, ...properties: string[]): T;
508
+
509
+ /**
510
+ * Sets the specified properties of an object to be non-writable.
511
+ */
512
+ declare function setNonWritable<T extends object>(object: T, ...properties: string[]): T;
513
+
514
+ /**
515
+ * Sets the specified properties of an object to be non-writable.
516
+ */
517
+ declare function setWritable<T extends object>(object: T, ...properties: string[]): T;
518
+
519
+ /**
520
+ * Sort an object's keys.
521
+ */
522
+ declare function sortKeys<T extends object>(obj: T, compareFn?: (a: string, b: string) => number): T;
523
+
524
+ /**
525
+ * Sorts the keys of an object in the given order.
526
+ */
527
+ declare function sortKeysLike<T>(o: T, orderedKeys: (keyof T)[]): T;
528
+
529
+ /**
530
+ * Returns the static string-property keys of a class but without the natively built-in keys 'length', 'name', and 'prototype'.
531
+ */
532
+ declare function staticClassKeysOf<T extends new (...args: any[]) => unknown>(cls: T): StaticClassKeyof<T>[];
533
+ /**
534
+ * Returns the static string-property keys of a class but without the natively built-in keys 'length', 'name', and 'prototype'.
535
+ */
536
+ type StaticClassKeyof<T extends new (...args: any[]) => unknown> = Exclude<keyof T, IgnoreKey>;
537
+ /**
538
+ * Keys always present in any class object.
539
+ */
540
+ declare const ignoreKeys: readonly ["length", "name", "prototype"];
541
+ type IgnoreKey = (typeof ignoreKeys)[number];
542
+
543
+ /**
544
+ * Get the values of an object with type-safe return value.
545
+ */
546
+ declare function valuesOf<T extends object>(obj: T): T[StringKeyOf<T>][];
547
+
548
+ export { type AccessorDescriptor, type AccessorsDescriptorAttributes, type DescriptorAccessors, type DescriptorBothAccessors, type DescriptorGetter, type DescriptorSetter, type DescriptorValue, type GetKeysOptions, type IterateObjectYield, type KeysPrimitiveTypeFrom, type OptsKeyTypeVariants, type OptsKeysVariants, type StaticClassKeyof, type TypedValuePropertyDescriptor, type ValueDescriptor, type ValueDescriptorAttributes, arrAssign, className, constructorOf, createArrayMerger, createObjectMerger, defineAccessors, defineGetter, defineLazyProperty, defineMethod, defineProperty, defineSetter, defineValue, deleteNullishPropsMutable, entriesOf, filterObject, filterObjectMutable, getClassChain, getConfigurableMethodOrGetterKeys, getKeys, getKeysPreset, getOwnProperty, getPrototypeChain, getSuperClass, getSuperClasses, hasOwnProperty, hasProperty, hasPrototypeChainProperty, inheritPrototypeMembers, inheritStaticMembers, isAccessorDescriptor, isEnumerable, isMethodValueDescriptor, isValueDescriptor, iterableFirstElement, iterateObject, keysOf, mapObjectEntries, mapObjectKeys, objAssign, objDeepFreeze, objDefineLazyProperty, objDelete, objGet, objGetOrDefault, objGetOrDefaultValue, objHas, objOmitKeysMutable, objPropertyValueToGetter, objSet, objSize, objSortKeys, objToMap, objUpdate, objUpdatePropertyDescriptors, propertyIsEnumerable, setEnumerable, setNonConfigurable, setNonEnumerable, setNonWritable, setWritable, sortKeys, sortKeysLike, staticClassKeysOf, valuesOf };