@bemoje/object 0.2.12 → 0.2.14

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 (182) hide show
  1. package/cjs/index.d.ts +9 -13
  2. package/cjs/index.d.ts.map +1 -1
  3. package/cjs/index.js +9 -13
  4. package/cjs/index.js.map +1 -1
  5. package/cjs/lib/constructorOf.d.ts +6 -0
  6. package/cjs/lib/constructorOf.d.ts.map +1 -0
  7. package/cjs/lib/constructorOf.js +11 -0
  8. package/cjs/lib/constructorOf.js.map +1 -0
  9. package/cjs/lib/define.d.ts +10 -8
  10. package/cjs/lib/define.d.ts.map +1 -1
  11. package/cjs/lib/define.js +144 -8
  12. package/cjs/lib/define.js.map +1 -1
  13. package/cjs/lib/hasOwnProp.d.ts +6 -0
  14. package/cjs/lib/hasOwnProp.d.ts.map +1 -0
  15. package/cjs/lib/hasOwnProp.js +11 -0
  16. package/cjs/lib/hasOwnProp.js.map +1 -0
  17. package/cjs/lib/inheritStaticMembers.d.ts +2 -2
  18. package/cjs/lib/inheritStaticMembers.d.ts.map +1 -1
  19. package/cjs/lib/inheritStaticMembers.js.map +1 -1
  20. package/cjs/lib/isPropEnum.d.ts +6 -0
  21. package/cjs/lib/isPropEnum.d.ts.map +1 -0
  22. package/cjs/lib/isPropEnum.js +11 -0
  23. package/cjs/lib/isPropEnum.js.map +1 -0
  24. package/cjs/lib/iterableFirstElement.d.ts +1 -1
  25. package/cjs/lib/iterableFirstElement.d.ts.map +1 -1
  26. package/cjs/lib/iterableFirstElement.js +2 -4
  27. package/cjs/lib/iterableFirstElement.js.map +1 -1
  28. package/cjs/lib/iteratePrototypeChainOf.d.ts +7 -0
  29. package/cjs/lib/iteratePrototypeChainOf.d.ts.map +1 -0
  30. package/cjs/lib/iteratePrototypeChainOf.js +19 -0
  31. package/cjs/lib/iteratePrototypeChainOf.js.map +1 -0
  32. package/cjs/lib/oDeleteUndefined.d.ts +1 -2
  33. package/cjs/lib/oDeleteUndefined.d.ts.map +1 -1
  34. package/cjs/lib/oDeleteUndefined.js.map +1 -1
  35. package/cjs/lib/objDeepFreeze.d.ts +2 -1
  36. package/cjs/lib/objDeepFreeze.d.ts.map +1 -1
  37. package/cjs/lib/objDeepFreeze.js.map +1 -1
  38. package/cjs/lib/objFilter.d.ts +1 -2
  39. package/cjs/lib/objFilter.d.ts.map +1 -1
  40. package/cjs/lib/objFilter.js +2 -2
  41. package/cjs/lib/objFilter.js.map +1 -1
  42. package/cjs/lib/objFilterMutable.d.ts +1 -2
  43. package/cjs/lib/objFilterMutable.d.ts.map +1 -1
  44. package/cjs/lib/objFilterMutable.js +2 -2
  45. package/cjs/lib/objFilterMutable.js.map +1 -1
  46. package/cjs/lib/objGet.d.ts +1 -15
  47. package/cjs/lib/objGet.d.ts.map +1 -1
  48. package/cjs/lib/objGet.js +0 -13
  49. package/cjs/lib/objGet.js.map +1 -1
  50. package/cjs/lib/objGetOrDefault.d.ts +8 -0
  51. package/cjs/lib/objGetOrDefault.d.ts.map +1 -0
  52. package/cjs/lib/objGetOrDefault.js +13 -0
  53. package/cjs/lib/objGetOrDefault.js.map +1 -0
  54. package/cjs/lib/objGetOrDefaultValue.d.ts +6 -0
  55. package/cjs/lib/objGetOrDefaultValue.d.ts.map +1 -0
  56. package/cjs/lib/objGetOrDefaultValue.js +12 -0
  57. package/cjs/lib/objGetOrDefaultValue.js.map +1 -0
  58. package/cjs/lib/objMap.d.ts +2 -1
  59. package/cjs/lib/objMap.d.ts.map +1 -1
  60. package/cjs/lib/objMap.js.map +1 -1
  61. package/cjs/lib/objPropertyValueToGetter.d.ts +3 -3
  62. package/cjs/lib/objPropertyValueToGetter.d.ts.map +1 -1
  63. package/cjs/lib/objPropertyValueToGetter.js +3 -3
  64. package/cjs/lib/objReduce.d.ts +2 -12
  65. package/cjs/lib/objReduce.d.ts.map +1 -1
  66. package/cjs/lib/objReduce.js +3 -13
  67. package/cjs/lib/objReduce.js.map +1 -1
  68. package/cjs/lib/objSet.d.ts +1 -12
  69. package/cjs/lib/objSet.d.ts.map +1 -1
  70. package/cjs/lib/objSet.js +0 -10
  71. package/cjs/lib/objSet.js.map +1 -1
  72. package/cjs/lib/objSize.d.ts +2 -11
  73. package/cjs/lib/objSize.d.ts.map +1 -1
  74. package/cjs/lib/objSize.js +1 -9
  75. package/cjs/lib/objSize.js.map +1 -1
  76. package/cjs/lib/objSortKeys.d.ts +3 -3
  77. package/cjs/lib/objSortKeys.d.ts.map +1 -1
  78. package/cjs/lib/objSortKeys.js +8 -3
  79. package/cjs/lib/objSortKeys.js.map +1 -1
  80. package/cjs/lib/objToMap.d.ts +2 -14
  81. package/cjs/lib/objToMap.d.ts.map +1 -1
  82. package/cjs/lib/objToMap.js +0 -12
  83. package/cjs/lib/objToMap.js.map +1 -1
  84. package/cjs/lib/objUpdate.d.ts +6 -3
  85. package/cjs/lib/objUpdate.d.ts.map +1 -1
  86. package/cjs/lib/objUpdate.js +5 -2
  87. package/cjs/lib/objUpdate.js.map +1 -1
  88. package/cjs/lib/objUpdatePropertyDescriptors.d.ts +1 -1
  89. package/cjs/lib/objUpdatePropertyDescriptors.d.ts.map +1 -1
  90. package/cjs/lib/objUpdatePropertyDescriptors.js +1 -1
  91. package/cjs/lib/objUpdatePropertyDescriptors.js.map +1 -1
  92. package/cjs/lib/objWalk.d.ts +6 -12
  93. package/cjs/lib/objWalk.d.ts.map +1 -1
  94. package/cjs/lib/objWalk.js +9 -14
  95. package/cjs/lib/objWalk.js.map +1 -1
  96. package/cjs/lib/ownKeys.d.ts +18 -0
  97. package/cjs/lib/ownKeys.d.ts.map +1 -0
  98. package/cjs/lib/ownKeys.js +58 -0
  99. package/cjs/lib/ownKeys.js.map +1 -0
  100. package/cjs/lib/prototypeChainOf.d.ts +7 -0
  101. package/cjs/lib/prototypeChainOf.d.ts.map +1 -0
  102. package/cjs/lib/prototypeChainOf.js +12 -0
  103. package/cjs/lib/prototypeChainOf.js.map +1 -0
  104. package/cjs/lib/setEnumerable.d.ts +1 -1
  105. package/cjs/lib/setEnumerable.d.ts.map +1 -1
  106. package/cjs/lib/setEnumerable.js +1 -1
  107. package/cjs/lib/setEnumerable.js.map +1 -1
  108. package/cjs/lib/setNonConfigurable.d.ts +3 -3
  109. package/cjs/lib/setNonConfigurable.d.ts.map +1 -1
  110. package/cjs/lib/setNonConfigurable.js +3 -3
  111. package/cjs/lib/setNonConfigurable.js.map +1 -1
  112. package/cjs/lib/setNonEnumerable.d.ts +1 -1
  113. package/cjs/lib/setNonEnumerable.d.ts.map +1 -1
  114. package/cjs/lib/setNonEnumerable.js +1 -1
  115. package/cjs/lib/setNonEnumerable.js.map +1 -1
  116. package/cjs/lib/setNonWritable.d.ts +4 -4
  117. package/cjs/lib/setNonWritable.d.ts.map +1 -1
  118. package/cjs/lib/setNonWritable.js +4 -4
  119. package/cjs/lib/setNonWritable.js.map +1 -1
  120. package/cjs/lib/setWritable.d.ts +2 -2
  121. package/cjs/lib/setWritable.d.ts.map +1 -1
  122. package/cjs/lib/setWritable.js +2 -2
  123. package/cjs/lib/setWritable.js.map +1 -1
  124. package/cjs/lib/superChain.d.ts +5 -0
  125. package/cjs/lib/superChain.d.ts.map +1 -0
  126. package/cjs/lib/superChain.js +15 -0
  127. package/cjs/lib/superChain.js.map +1 -0
  128. package/cjs/lib/toJson.d.ts +1 -1
  129. package/cjs/lib/toJson.js +1 -1
  130. package/package.json +1 -1
  131. package/cjs/lib/createObjectFactory.d.ts +0 -14
  132. package/cjs/lib/createObjectFactory.d.ts.map +0 -1
  133. package/cjs/lib/createObjectFactory.js +0 -48
  134. package/cjs/lib/createObjectFactory.js.map +0 -1
  135. package/cjs/lib/getConstructor.d.ts +0 -14
  136. package/cjs/lib/getConstructor.d.ts.map +0 -1
  137. package/cjs/lib/getConstructor.js +0 -19
  138. package/cjs/lib/getConstructor.js.map +0 -1
  139. package/cjs/lib/iteratePrototypeChain.d.ts +0 -25
  140. package/cjs/lib/iteratePrototypeChain.d.ts.map +0 -1
  141. package/cjs/lib/iteratePrototypeChain.js +0 -56
  142. package/cjs/lib/iteratePrototypeChain.js.map +0 -1
  143. package/cjs/lib/objClonePrimitiveProperties.d.ts +0 -8
  144. package/cjs/lib/objClonePrimitiveProperties.d.ts.map +0 -1
  145. package/cjs/lib/objClonePrimitiveProperties.js +0 -19
  146. package/cjs/lib/objClonePrimitiveProperties.js.map +0 -1
  147. package/cjs/lib/objEntries.d.ts +0 -16
  148. package/cjs/lib/objEntries.d.ts.map +0 -1
  149. package/cjs/lib/objEntries.js +0 -21
  150. package/cjs/lib/objEntries.js.map +0 -1
  151. package/cjs/lib/objEntriesArray.d.ts +0 -16
  152. package/cjs/lib/objEntriesArray.d.ts.map +0 -1
  153. package/cjs/lib/objEntriesArray.js +0 -21
  154. package/cjs/lib/objEntriesArray.js.map +0 -1
  155. package/cjs/lib/objGetOrElse.d.ts +0 -16
  156. package/cjs/lib/objGetOrElse.d.ts.map +0 -1
  157. package/cjs/lib/objGetOrElse.js +0 -24
  158. package/cjs/lib/objGetOrElse.js.map +0 -1
  159. package/cjs/lib/objKeys.d.ts +0 -17
  160. package/cjs/lib/objKeys.d.ts.map +0 -1
  161. package/cjs/lib/objKeys.js +0 -22
  162. package/cjs/lib/objKeys.js.map +0 -1
  163. package/cjs/lib/objKeysArray.d.ts +0 -15
  164. package/cjs/lib/objKeysArray.d.ts.map +0 -1
  165. package/cjs/lib/objKeysArray.js +0 -20
  166. package/cjs/lib/objKeysArray.js.map +0 -1
  167. package/cjs/lib/objOmitKeys.d.ts +0 -16
  168. package/cjs/lib/objOmitKeys.d.ts.map +0 -1
  169. package/cjs/lib/objOmitKeys.js +0 -23
  170. package/cjs/lib/objOmitKeys.js.map +0 -1
  171. package/cjs/lib/objReverse.d.ts +0 -14
  172. package/cjs/lib/objReverse.d.ts.map +0 -1
  173. package/cjs/lib/objReverse.js +0 -20
  174. package/cjs/lib/objReverse.js.map +0 -1
  175. package/cjs/lib/objValues.d.ts +0 -21
  176. package/cjs/lib/objValues.d.ts.map +0 -1
  177. package/cjs/lib/objValues.js +0 -26
  178. package/cjs/lib/objValues.js.map +0 -1
  179. package/cjs/lib/objValuesArray.d.ts +0 -15
  180. package/cjs/lib/objValuesArray.d.ts.map +0 -1
  181. package/cjs/lib/objValuesArray.js +0 -20
  182. package/cjs/lib/objValuesArray.js.map +0 -1
@@ -1,19 +1,13 @@
1
+ import { Any } from '@bemoje/types';
1
2
  /**
2
3
  * Recursively traverses an object and invokes a callback function for every encountered non-object value.
3
4
  * The callback function is passed the non-object value and an array representing the path to the value.
4
5
  * @param node - The object to be traversed.
5
- * @param callback - The callback function to be invoked for every non-object value.
6
- * @example ```ts
7
- * const obj = { a: 1, b: { c: 2, d: [3, 4] } };
8
- * objWalk(obj, (value, path) => {
9
- * console.log(`Path: ${path.join('.')}, Value: ${value}`);
10
- * });
11
- * // Output:
12
- * // Path: a, Value: 1
13
- * // Path: b.c, Value: 2
14
- * // Path: b.d[0], Value: 3
15
- * // Path: b.d[1], Value: 4
16
6
  * ```
17
7
  */
18
- export declare function objWalk(node: Record<string, any>, callback: (value: any, path: string[]) => void): void;
8
+ export declare function objWalk(node: Record<string, Any>, callback: (type: 'primitive' | 'object' | 'array', value: Any, node: Any, path: string[]) => false | void, options?: {
9
+ noPrimitives?: boolean;
10
+ noArrays?: boolean;
11
+ noObjects?: boolean;
12
+ }): void;
19
13
  //# sourceMappingURL=objWalk.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"objWalk.d.ts","sourceRoot":"","sources":["../../../../../packages/object/src/lib/objWalk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,GAAG,IAAI,CAiBvG"}
1
+ {"version":3,"file":"objWalk.d.ts","sourceRoot":"","sources":["../../../../../packages/object/src/lib/objWalk.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AAEnC;;;;;GAKG;AACH,wBAAgB,OAAO,CACrB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACzB,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,QAAQ,GAAG,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,KAAK,GAAG,IAAI,EACzG,OAAO,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAO,GAChF,IAAI,CAoBN"}
@@ -5,34 +5,29 @@ exports.objWalk = void 0;
5
5
  * Recursively traverses an object and invokes a callback function for every encountered non-object value.
6
6
  * The callback function is passed the non-object value and an array representing the path to the value.
7
7
  * @param node - The object to be traversed.
8
- * @param callback - The callback function to be invoked for every non-object value.
9
- * @example ```ts
10
- * const obj = { a: 1, b: { c: 2, d: [3, 4] } };
11
- * objWalk(obj, (value, path) => {
12
- * console.log(`Path: ${path.join('.')}, Value: ${value}`);
13
- * });
14
- * // Output:
15
- * // Path: a, Value: 1
16
- * // Path: b.c, Value: 2
17
- * // Path: b.d[0], Value: 3
18
- * // Path: b.d[1], Value: 4
19
8
  * ```
20
9
  */
21
- function objWalk(node, callback) {
10
+ function objWalk(node, callback, options = {}) {
11
+ const { noPrimitives, noArrays, noObjects } = options;
22
12
  function recurse(node, path = []) {
23
13
  for (const [key, child] of Object.entries(node)) {
24
- if (typeof child === 'object' && child !== null) {
14
+ if (typeof child === 'object' && child != null) {
25
15
  if (Array.isArray(child)) {
16
+ if (!noArrays && callback('array', child, node, path.concat(key)) === false)
17
+ continue;
26
18
  child.forEach((node, index) => {
27
19
  recurse(node, path.concat([`${key}[${index}]`]));
28
20
  });
29
21
  }
30
22
  else {
23
+ if (!noObjects && callback('object', child, node, path.concat(key)) === false)
24
+ continue;
31
25
  recurse(child, path.concat(key));
32
26
  }
33
27
  }
34
28
  else {
35
- callback(child, path.concat(key));
29
+ if (!noPrimitives && callback('array', child, node, path.concat(key)) === false)
30
+ continue;
36
31
  }
37
32
  }
38
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"objWalk.js","sourceRoot":"","sources":["../../../../../packages/object/src/lib/objWalk.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,OAAO,CAAC,IAAyB,EAAE,QAA8C;IAC/F,SAAS,OAAO,CAAC,IAAyB,EAAE,OAAiB,EAAE;QAC7D,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAC/C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE;gBAC/C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;oBACxB,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;wBAC5B,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,GAAG,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAA;oBAClD,CAAC,CAAC,CAAA;iBACH;qBAAM;oBACL,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;iBACjC;aACF;iBAAM;gBACL,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;aAClC;SACF;IACH,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAA;AACf,CAAC;AAjBD,0BAiBC"}
1
+ {"version":3,"file":"objWalk.js","sourceRoot":"","sources":["../../../../../packages/object/src/lib/objWalk.ts"],"names":[],"mappings":";;;AAEA;;;;;GAKG;AACH,SAAgB,OAAO,CACrB,IAAyB,EACzB,QAAyG,EACzG,UAA+E,EAAE;IAEjF,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,OAAO,CAAA;IACrD,SAAS,OAAO,CAAC,IAAyB,EAAE,OAAiB,EAAE;QAC7D,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAC/C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,IAAI,IAAI,EAAE;gBAC9C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;oBACxB,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK;wBAAE,SAAQ;oBACrF,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;wBAC5B,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,GAAG,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAA;oBAClD,CAAC,CAAC,CAAA;iBACH;qBAAM;oBACL,IAAI,CAAC,SAAS,IAAI,QAAQ,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK;wBAAE,SAAQ;oBACvF,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;iBACjC;aACF;iBAAM;gBACL,IAAI,CAAC,YAAY,IAAI,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK;oBAAE,SAAQ;aAC1F;SACF;IACH,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAA;AACf,CAAC;AAxBD,0BAwBC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Returns ALL own property keys of an object.
3
+ * Ie. own enumerable, non-enumerable and symbol keys,
4
+ * but not keys inherited from the object's prototype are returned.
5
+ * Identical to Reflect.ownKeys.
6
+ */
7
+ export declare function ownKeys(o: object): (string | symbol)[];
8
+ export declare namespace ownKeys {
9
+ var _a: (o: object) => string[];
10
+ export var nonEnum: (o: object) => string[];
11
+ export var symbol: (o: object) => symbol[];
12
+ export var enumAndNonEnum: (o: object) => string[];
13
+ export var enumAndSymbol: (o: object) => (string | symbol)[];
14
+ export var nonEnumAndSymbol: (o: object) => (string | symbol)[];
15
+ export var enumAndNonEnumAndSymbol: typeof ownKeys;
16
+ export { _a as enum };
17
+ }
18
+ //# sourceMappingURL=ownKeys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ownKeys.d.ts","sourceRoot":"","sources":["../../../../../packages/object/src/lib/ownKeys.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,uBAEhC;yBAFe,OAAO"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ownKeys = void 0;
4
+ const isPropEnum_1 = require("./isPropEnum");
5
+ /**
6
+ * Returns ALL own property keys of an object.
7
+ * Ie. own enumerable, non-enumerable and symbol keys,
8
+ * but not keys inherited from the object's prototype are returned.
9
+ * Identical to Reflect.ownKeys.
10
+ */
11
+ function ownKeys(o) {
12
+ return Reflect.ownKeys(o);
13
+ }
14
+ exports.ownKeys = ownKeys;
15
+ /**
16
+ * Returns all own enumerable property keys of an object.
17
+ * Identical to Object.keys.
18
+ */
19
+ ownKeys.enum = function (o) {
20
+ return Object.keys(o);
21
+ };
22
+ /**
23
+ * Returns all own non-enumerable property keys of an object.
24
+ */
25
+ ownKeys.nonEnum = function (o) {
26
+ return Object.getOwnPropertyNames(o).filter((k) => !(0, isPropEnum_1.isPropEnum)(o, k));
27
+ };
28
+ /**
29
+ * Returns all own symbol property keys of an object.
30
+ * Identical to Object.getOwnPropertySymbols.
31
+ */
32
+ ownKeys.symbol = function (o) {
33
+ return Object.getOwnPropertySymbols(o);
34
+ };
35
+ /**
36
+ * Returns all own symbol property keys of an object.
37
+ * Identical to Object.getOwnPropertySymbols.
38
+ */
39
+ ownKeys.enumAndNonEnum = function (o) {
40
+ return Object.getOwnPropertyNames(o);
41
+ };
42
+ /**
43
+ * Returns all own enumerable and symbol property keys of an object.
44
+ */
45
+ ownKeys.enumAndSymbol = function (o) {
46
+ return [...Object.keys(o), ...Object.getOwnPropertySymbols(o)];
47
+ };
48
+ /**
49
+ * Returns all own non-enumerable and symbol property keys of an object.
50
+ */
51
+ ownKeys.nonEnumAndSymbol = function (o) {
52
+ return Reflect.ownKeys(o).filter((k) => !(0, isPropEnum_1.isPropEnum)(o, k));
53
+ };
54
+ /**
55
+ * Alias for @see ownKeys()
56
+ */
57
+ ownKeys.enumAndNonEnumAndSymbol = ownKeys;
58
+ //# sourceMappingURL=ownKeys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ownKeys.js","sourceRoot":"","sources":["../../../../../packages/object/src/lib/ownKeys.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AAEzC;;;;;GAKG;AACH,SAAgB,OAAO,CAAC,CAAS;IAC/B,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;AAC3B,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,OAAO,CAAC,IAAI,GAAG,UAAU,CAAS;IAChC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACvB,CAAC,CAAA;AAED;;GAEG;AACH,OAAO,CAAC,OAAO,GAAG,UAAU,CAAS;IACnC,OAAO,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAA,uBAAU,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AACvE,CAAC,CAAA;AAED;;;GAGG;AACH,OAAO,CAAC,MAAM,GAAG,UAAU,CAAS;IAClC,OAAO,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAA;AACxC,CAAC,CAAA;AAED;;;GAGG;AACH,OAAO,CAAC,cAAc,GAAG,UAAU,CAAS;IAC1C,OAAO,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAA;AACtC,CAAC,CAAA;AAED;;GAEG;AACH,OAAO,CAAC,aAAa,GAAG,UAAU,CAAS;IACzC,OAAO,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAA;AAChE,CAAC,CAAA;AAED;;GAEG;AACH,OAAO,CAAC,gBAAgB,GAAG,UAAU,CAAS;IAC5C,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAA,uBAAU,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAC5D,CAAC,CAAA;AAED;;GAEG;AACH,OAAO,CAAC,uBAAuB,GAAG,OAAO,CAAA"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Get the prototype chain of a given object.
3
+ */
4
+ export declare function prototypeChainOf<T extends object>(object: T, opts?: {
5
+ excludeSelf?: boolean;
6
+ }): (typeof Object.prototype)[];
7
+ //# sourceMappingURL=prototypeChainOf.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prototypeChainOf.d.ts","sourceRoot":"","sources":["../../../../../packages/object/src/lib/prototypeChainOf.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAC/C,MAAM,EAAE,CAAC,EACT,IAAI,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,GAC/B,CAAC,OAAO,MAAM,CAAC,SAAS,CAAC,EAAE,CAE7B"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.prototypeChainOf = void 0;
4
+ const iteratePrototypeChainOf_1 = require("./iteratePrototypeChainOf");
5
+ /**
6
+ * Get the prototype chain of a given object.
7
+ */
8
+ function prototypeChainOf(object, opts) {
9
+ return [...(0, iteratePrototypeChainOf_1.iteratePrototypeChainOfOf)(object, opts)];
10
+ }
11
+ exports.prototypeChainOf = prototypeChainOf;
12
+ //# sourceMappingURL=prototypeChainOf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prototypeChainOf.js","sourceRoot":"","sources":["../../../../../packages/object/src/lib/prototypeChainOf.ts"],"names":[],"mappings":";;;AAAA,uEAAqE;AAErE;;GAEG;AACH,SAAgB,gBAAgB,CAC9B,MAAS,EACT,IAAgC;IAEhC,OAAO,CAAC,GAAG,IAAA,mDAAyB,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;AACrD,CAAC;AALD,4CAKC"}
@@ -8,7 +8,7 @@ import { ObjectKey } from '@bemoje/types';
8
8
  * @example ```ts
9
9
  * const obj = { a: 1, b: 2, c: 3 };
10
10
  * setEnumerable(obj, 'a', 'b');
11
- * Object.keys(obj);;
11
+ * Object.keys(obj);
12
12
  * //=> ['a', 'b']
13
13
  * ```
14
14
  * @remarks This function uses `Object.defineProperty` to set the enumerable property.
@@ -1 +1 @@
1
- {"version":3,"file":"setEnumerable.d.ts","sourceRoot":"","sources":["../../../../../packages/object/src/lib/setEnumerable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAGzC;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,GAAG,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAK3F"}
1
+ {"version":3,"file":"setEnumerable.d.ts","sourceRoot":"","sources":["../../../../../packages/object/src/lib/setEnumerable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,GAAG,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAK3F"}
@@ -11,7 +11,7 @@ const objUpdatePropertyDescriptors_1 = require("./objUpdatePropertyDescriptors")
11
11
  * @example ```ts
12
12
  * const obj = { a: 1, b: 2, c: 3 };
13
13
  * setEnumerable(obj, 'a', 'b');
14
- * Object.keys(obj);;
14
+ * Object.keys(obj);
15
15
  * //=> ['a', 'b']
16
16
  * ```
17
17
  * @remarks This function uses `Object.defineProperty` to set the enumerable property.
@@ -1 +1 @@
1
- {"version":3,"file":"setEnumerable.js","sourceRoot":"","sources":["../../../../../packages/object/src/lib/setEnumerable.ts"],"names":[],"mappings":";;;AACA,iFAA6E;AAE7E;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,aAAa,CAAC,MAA8B,EAAE,GAAG,UAAoB;IACnF,IAAA,2DAA4B,EAAC,MAAM,EAAE,UAAU,EAAE,CAAC,UAAU,EAAE,EAAE;QAC9D,UAAU,CAAC,UAAU,GAAG,IAAI,CAAA;QAC5B,OAAO,UAAU,CAAA;IACnB,CAAC,CAAC,CAAA;AACJ,CAAC;AALD,sCAKC"}
1
+ {"version":3,"file":"setEnumerable.js","sourceRoot":"","sources":["../../../../../packages/object/src/lib/setEnumerable.ts"],"names":[],"mappings":";;;AACA,iFAA8E;AAE9E;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,aAAa,CAAC,MAA8B,EAAE,GAAG,UAAoB;IACnF,IAAA,2DAA4B,EAAC,MAAM,EAAE,UAAU,EAAE,CAAC,UAAU,EAAE,EAAE;QAC9D,UAAU,CAAC,UAAU,GAAG,IAAI,CAAA;QAC5B,OAAO,UAAU,CAAA;IACnB,CAAC,CAAC,CAAA;AACJ,CAAC;AALD,sCAKC"}
@@ -9,11 +9,11 @@ import { ObjectKey } from '@bemoje/types';
9
9
  * @throws Will throw an error if any of the specified properties do not exist on the object.
10
10
  * @example ```ts
11
11
  * setNonConfigurable({ a: 1, b: 2, c: 3 }, 'a', 'b');
12
- * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'a');;
12
+ * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'a');
13
13
  * //=> {value: 1, writable: true, enumerable: true, configurable: false}
14
- * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'b');;
14
+ * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'b');
15
15
  * //=> {value: 2, writable: true, enumerable: true, configurable: false}
16
- * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'c');;
16
+ * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'c');
17
17
  * //=> {value: 3, writable: true, enumerable: true, configurable: true}
18
18
  * ```
19
19
  */
@@ -1 +1 @@
1
- {"version":3,"file":"setNonConfigurable.d.ts","sourceRoot":"","sources":["../../../../../packages/object/src/lib/setNonConfigurable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAGzC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,GAAG,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAKhG"}
1
+ {"version":3,"file":"setNonConfigurable.d.ts","sourceRoot":"","sources":["../../../../../packages/object/src/lib/setNonConfigurable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,GAAG,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAKhG"}
@@ -12,11 +12,11 @@ const objUpdatePropertyDescriptors_1 = require("./objUpdatePropertyDescriptors")
12
12
  * @throws Will throw an error if any of the specified properties do not exist on the object.
13
13
  * @example ```ts
14
14
  * setNonConfigurable({ a: 1, b: 2, c: 3 }, 'a', 'b');
15
- * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'a');;
15
+ * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'a');
16
16
  * //=> {value: 1, writable: true, enumerable: true, configurable: false}
17
- * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'b');;
17
+ * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'b');
18
18
  * //=> {value: 2, writable: true, enumerable: true, configurable: false}
19
- * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'c');;
19
+ * Object.getOwnPropertyDescriptor({ a: 1, b: 2, c: 3 }, 'c');
20
20
  * //=> {value: 3, writable: true, enumerable: true, configurable: true}
21
21
  * ```
22
22
  */
@@ -1 +1 @@
1
- {"version":3,"file":"setNonConfigurable.js","sourceRoot":"","sources":["../../../../../packages/object/src/lib/setNonConfigurable.ts"],"names":[],"mappings":";;;AACA,iFAA6E;AAE7E;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,kBAAkB,CAAC,MAA8B,EAAE,GAAG,UAAoB;IACxF,IAAA,2DAA4B,EAAC,MAAM,EAAE,UAAU,EAAE,CAAC,UAAU,EAAE,EAAE;QAC9D,UAAU,CAAC,YAAY,GAAG,KAAK,CAAA;QAC/B,OAAO,UAAU,CAAA;IACnB,CAAC,CAAC,CAAA;AACJ,CAAC;AALD,gDAKC"}
1
+ {"version":3,"file":"setNonConfigurable.js","sourceRoot":"","sources":["../../../../../packages/object/src/lib/setNonConfigurable.ts"],"names":[],"mappings":";;;AACA,iFAA8E;AAE9E;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,kBAAkB,CAAC,MAA8B,EAAE,GAAG,UAAoB;IACxF,IAAA,2DAA4B,EAAC,MAAM,EAAE,UAAU,EAAE,CAAC,UAAU,EAAE,EAAE;QAC9D,UAAU,CAAC,YAAY,GAAG,KAAK,CAAA;QAC/B,OAAO,UAAU,CAAA;IACnB,CAAC,CAAC,CAAA;AACJ,CAAC;AALD,gDAKC"}
@@ -8,7 +8,7 @@ import { ObjectKey } from '@bemoje/types';
8
8
  * @throws Will throw an error if any of the specified properties do not exist on the object.
9
9
  * @example ```ts
10
10
  * setNonEnumerable({ a: 1, b: 2, c: 3 }, 'a', 'b');
11
- * Object.keys({ a: 1, b: 2, c: 3 });;
11
+ * Object.keys({ a: 1, b: 2, c: 3 });
12
12
  * //=> ['c']
13
13
  * ```
14
14
  */
@@ -1 +1 @@
1
- {"version":3,"file":"setNonEnumerable.d.ts","sourceRoot":"","sources":["../../../../../packages/object/src/lib/setNonEnumerable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAGzC;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,GAAG,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAK9F"}
1
+ {"version":3,"file":"setNonEnumerable.d.ts","sourceRoot":"","sources":["../../../../../packages/object/src/lib/setNonEnumerable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,GAAG,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAK9F"}
@@ -11,7 +11,7 @@ const objUpdatePropertyDescriptors_1 = require("./objUpdatePropertyDescriptors")
11
11
  * @throws Will throw an error if any of the specified properties do not exist on the object.
12
12
  * @example ```ts
13
13
  * setNonEnumerable({ a: 1, b: 2, c: 3 }, 'a', 'b');
14
- * Object.keys({ a: 1, b: 2, c: 3 });;
14
+ * Object.keys({ a: 1, b: 2, c: 3 });
15
15
  * //=> ['c']
16
16
  * ```
17
17
  */
@@ -1 +1 @@
1
- {"version":3,"file":"setNonEnumerable.js","sourceRoot":"","sources":["../../../../../packages/object/src/lib/setNonEnumerable.ts"],"names":[],"mappings":";;;AACA,iFAA6E;AAE7E;;;;;;;;;;;;GAYG;AACH,SAAgB,gBAAgB,CAAC,MAA8B,EAAE,GAAG,UAAoB;IACtF,IAAA,2DAA4B,EAAC,MAAM,EAAE,UAAU,EAAE,CAAC,UAAU,EAAE,EAAE;QAC9D,UAAU,CAAC,UAAU,GAAG,KAAK,CAAA;QAC7B,OAAO,UAAU,CAAA;IACnB,CAAC,CAAC,CAAA;AACJ,CAAC;AALD,4CAKC"}
1
+ {"version":3,"file":"setNonEnumerable.js","sourceRoot":"","sources":["../../../../../packages/object/src/lib/setNonEnumerable.ts"],"names":[],"mappings":";;;AACA,iFAA8E;AAE9E;;;;;;;;;;;;GAYG;AACH,SAAgB,gBAAgB,CAAC,MAA8B,EAAE,GAAG,UAAoB;IACtF,IAAA,2DAA4B,EAAC,MAAM,EAAE,UAAU,EAAE,CAAC,UAAU,EAAE,EAAE;QAC9D,UAAU,CAAC,UAAU,GAAG,KAAK,CAAA;QAC7B,OAAO,UAAU,CAAA;IACnB,CAAC,CAAC,CAAA;AACJ,CAAC;AALD,4CAKC"}
@@ -8,13 +8,13 @@ import { ObjectKey } from '@bemoje/types';
8
8
  * @example ```ts
9
9
  * const obj = { a: 1, b: 2, c: 3 };
10
10
  * setNonWritable(obj, 'a', 'b');
11
- * obj;;
11
+ * obj;
12
12
  * //=> { a: 1, b: 2, c: 3 }
13
- * obj.a = 10;;
13
+ * obj.a = 10;
14
14
  * //=> Throws an error
15
- * obj.b = 20;;
15
+ * obj.b = 20;
16
16
  * //=> Throws an error
17
- * obj.c = 30;;
17
+ * obj.c = 30;
18
18
  * //=> Works fine
19
19
  * ```
20
20
  */
@@ -1 +1 @@
1
- {"version":3,"file":"setNonWritable.d.ts","sourceRoot":"","sources":["../../../../../packages/object/src/lib/setNonWritable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAGzC;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,GAAG,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAK5F"}
1
+ {"version":3,"file":"setNonWritable.d.ts","sourceRoot":"","sources":["../../../../../packages/object/src/lib/setNonWritable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,GAAG,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAK5F"}
@@ -11,13 +11,13 @@ const objUpdatePropertyDescriptors_1 = require("./objUpdatePropertyDescriptors")
11
11
  * @example ```ts
12
12
  * const obj = { a: 1, b: 2, c: 3 };
13
13
  * setNonWritable(obj, 'a', 'b');
14
- * obj;;
14
+ * obj;
15
15
  * //=> { a: 1, b: 2, c: 3 }
16
- * obj.a = 10;;
16
+ * obj.a = 10;
17
17
  * //=> Throws an error
18
- * obj.b = 20;;
18
+ * obj.b = 20;
19
19
  * //=> Throws an error
20
- * obj.c = 30;;
20
+ * obj.c = 30;
21
21
  * //=> Works fine
22
22
  * ```
23
23
  */
@@ -1 +1 @@
1
- {"version":3,"file":"setNonWritable.js","sourceRoot":"","sources":["../../../../../packages/object/src/lib/setNonWritable.ts"],"names":[],"mappings":";;;AACA,iFAA6E;AAE7E;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,cAAc,CAAC,MAA8B,EAAE,GAAG,UAAoB;IACpF,IAAA,2DAA4B,EAAC,MAAM,EAAE,UAAU,EAAE,CAAC,UAAU,EAAE,EAAE;QAC9D,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAA;QAC3B,OAAO,UAAU,CAAA;IACnB,CAAC,CAAC,CAAA;AACJ,CAAC;AALD,wCAKC"}
1
+ {"version":3,"file":"setNonWritable.js","sourceRoot":"","sources":["../../../../../packages/object/src/lib/setNonWritable.ts"],"names":[],"mappings":";;;AACA,iFAA8E;AAE9E;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,cAAc,CAAC,MAA8B,EAAE,GAAG,UAAoB;IACpF,IAAA,2DAA4B,EAAC,MAAM,EAAE,UAAU,EAAE,CAAC,UAAU,EAAE,EAAE;QAC9D,UAAU,CAAC,QAAQ,GAAG,KAAK,CAAA;QAC3B,OAAO,UAAU,CAAA;IACnB,CAAC,CAAC,CAAA;AACJ,CAAC;AALD,wCAKC"}
@@ -6,9 +6,9 @@ import { ObjectKey } from '@bemoje/types';
6
6
  * @param propertyNames The names of the properties to be made writable.
7
7
  * @throws Will throw an error if any of the specified properties do not exist on the object.
8
8
  * @example ```ts
9
- * setWritable({ a: 1, b: 2 }, 'a', 'b').a = 3;;
9
+ * setWritable({ a: 1, b: 2 }, 'a', 'b').a = 3;
10
10
  * //=> 3
11
- * setWritable({ a: 1, b: 2 }, 'a', 'b').b = 4;;
11
+ * setWritable({ a: 1, b: 2 }, 'a', 'b').b = 4;
12
12
  * //=> 4
13
13
  * ```
14
14
  * @returns void
@@ -1 +1 @@
1
- {"version":3,"file":"setWritable.d.ts","sourceRoot":"","sources":["../../../../../packages/object/src/lib/setWritable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAGzC;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,GAAG,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAKzF"}
1
+ {"version":3,"file":"setWritable.d.ts","sourceRoot":"","sources":["../../../../../packages/object/src/lib/setWritable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG1C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,GAAG,CAAC,EAAE,GAAG,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAKzF"}
@@ -9,9 +9,9 @@ const objUpdatePropertyDescriptors_1 = require("./objUpdatePropertyDescriptors")
9
9
  * @param propertyNames The names of the properties to be made writable.
10
10
  * @throws Will throw an error if any of the specified properties do not exist on the object.
11
11
  * @example ```ts
12
- * setWritable({ a: 1, b: 2 }, 'a', 'b').a = 3;;
12
+ * setWritable({ a: 1, b: 2 }, 'a', 'b').a = 3;
13
13
  * //=> 3
14
- * setWritable({ a: 1, b: 2 }, 'a', 'b').b = 4;;
14
+ * setWritable({ a: 1, b: 2 }, 'a', 'b').b = 4;
15
15
  * //=> 4
16
16
  * ```
17
17
  * @returns void
@@ -1 +1 @@
1
- {"version":3,"file":"setWritable.js","sourceRoot":"","sources":["../../../../../packages/object/src/lib/setWritable.ts"],"names":[],"mappings":";;;AACA,iFAA6E;AAE7E;;;;;;;;;;;;;GAaG;AACH,SAAgB,WAAW,CAAC,MAA8B,EAAE,GAAG,UAAoB;IACjF,IAAA,2DAA4B,EAAC,MAAM,EAAE,UAAU,EAAE,CAAC,UAAU,EAAE,EAAE;QAC9D,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAA;QAC1B,OAAO,UAAU,CAAA;IACnB,CAAC,CAAC,CAAA;AACJ,CAAC;AALD,kCAKC"}
1
+ {"version":3,"file":"setWritable.js","sourceRoot":"","sources":["../../../../../packages/object/src/lib/setWritable.ts"],"names":[],"mappings":";;;AACA,iFAA8E;AAE9E;;;;;;;;;;;;;GAaG;AACH,SAAgB,WAAW,CAAC,MAA8B,EAAE,GAAG,UAAoB;IACjF,IAAA,2DAA4B,EAAC,MAAM,EAAE,UAAU,EAAE,CAAC,UAAU,EAAE,EAAE;QAC9D,UAAU,CAAC,QAAQ,GAAG,IAAI,CAAA;QAC1B,OAAO,UAAU,CAAA;IACnB,CAAC,CAAC,CAAA;AACJ,CAAC;AALD,kCAKC"}
@@ -0,0 +1,5 @@
1
+ import { TConstructor } from '@bemoje/types';
2
+ export declare function superChain(o: TConstructor | object, opts?: {
3
+ excludeSelf?: boolean;
4
+ }): Array<TConstructor>;
5
+ //# sourceMappingURL=superChain.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"superChain.d.ts","sourceRoot":"","sources":["../../../../../packages/object/src/lib/superChain.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAE5C,wBAAgB,UAAU,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,KAAK,CAAC,YAAY,CAAC,CAK1G"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.superChain = void 0;
4
+ const is_1 = require("@bemoje/is");
5
+ function superChain(o, opts) {
6
+ if ((0, is_1.isObject)(o))
7
+ o = Object.getPrototypeOf(o).constructor;
8
+ if (typeof o !== 'function')
9
+ throw new Error('Expected object or constructor.');
10
+ if (!o.name || o === Object)
11
+ return [Object];
12
+ return (opts?.excludeSelf ? [] : [o]).concat(superChain(Object.getPrototypeOf(o)));
13
+ }
14
+ exports.superChain = superChain;
15
+ //# sourceMappingURL=superChain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"superChain.js","sourceRoot":"","sources":["../../../../../packages/object/src/lib/superChain.ts"],"names":[],"mappings":";;;AAAA,mCAAqC;AAGrC,SAAgB,UAAU,CAAC,CAAwB,EAAE,IAAgC;IACnF,IAAI,IAAA,aAAQ,EAAC,CAAC,CAAC;QAAE,CAAC,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,WAAW,CAAA;IACzD,IAAI,OAAO,CAAC,KAAK,UAAU;QAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;IAC/E,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,MAAM;QAAE,OAAO,CAAC,MAAM,CAAC,CAAA;IAC5C,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAwB,CAAA;AAC3G,CAAC;AALD,gCAKC"}
@@ -5,7 +5,7 @@
5
5
  * @param pretty Optional parameter that determines whether the resulting JSON string should be pretty-printed. Default is `false`.
6
6
  * @returns The JSON string representation of the given data.
7
7
  * @example ```ts
8
- * toJson({ name: 'John', age: 30 }, true);;
8
+ * toJson({ name: 'John', age: 30 }, true);
9
9
  * //=> "{\n "name": "John",\n "age": 30\n}"
10
10
  * ```
11
11
  */
package/cjs/lib/toJson.js CHANGED
@@ -8,7 +8,7 @@ exports.toJson = void 0;
8
8
  * @param pretty Optional parameter that determines whether the resulting JSON string should be pretty-printed. Default is `false`.
9
9
  * @returns The JSON string representation of the given data.
10
10
  * @example ```ts
11
- * toJson({ name: 'John', age: 30 }, true);;
11
+ * toJson({ name: 'John', age: 30 }, true);
12
12
  * //=> "{\n "name": "John",\n "age": 30\n}"
13
13
  * ```
14
14
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bemoje/object",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "type": "commonjs",
5
5
  "main": "cjs/index.js",
6
6
  "types": "cjs/index.d.ts",
@@ -1,14 +0,0 @@
1
- /**
2
- * Creates a factory function for creating objects with specified keys and default values.
3
- * @template T The type of the values.
4
- * @param keys An array of strings representing the keys of the objects to be created.
5
- * @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.
6
- * @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.
7
- * @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.
8
- * @example ```ts
9
- * createObjectFactory(['key1', 'key2'], ['default1', 'default2'])(['value1']);
10
- * //=> { key1: 'value1', key2: 'default2' }
11
- * ```
12
- */
13
- export declare function createObjectFactory<T>(keys: string[], defaultValues?: T[]): (values?: T[]) => Record<string, T>;
14
- //# sourceMappingURL=createObjectFactory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createObjectFactory.d.ts","sourceRoot":"","sources":["../../../../../packages/object/src/lib/createObjectFactory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,aAAa,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,KAAK,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CA6B/G"}
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createObjectFactory = void 0;
4
- /**
5
- * Creates a factory function for creating objects with specified keys and default values.
6
- * @template T The type of the values.
7
- * @param keys An array of strings representing the keys of the objects to be created.
8
- * @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.
9
- * @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.
10
- * @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.
11
- * @example ```ts
12
- * createObjectFactory(['key1', 'key2'], ['default1', 'default2'])(['value1']);
13
- * //=> { key1: 'value1', key2: 'default2' }
14
- * ```
15
- */
16
- function createObjectFactory(keys, defaultValues) {
17
- const numKeys = keys.length;
18
- if (defaultValues && defaultValues.length > numKeys) {
19
- throw new Error('defaultValues length larger than keys length.');
20
- }
21
- return function factory(values) {
22
- if (values && values.length > numKeys) {
23
- throw new Error('values length larger than keys length.');
24
- }
25
- const o = {};
26
- for (let i = 0; i < numKeys; i++) {
27
- let value;
28
- if (values) {
29
- value = values[i];
30
- if (value === undefined && defaultValues) {
31
- value = defaultValues[i];
32
- }
33
- }
34
- else if (defaultValues) {
35
- value = defaultValues[i];
36
- }
37
- Object.defineProperty(o, keys[i], {
38
- enumerable: true,
39
- writable: true,
40
- configurable: true,
41
- value,
42
- });
43
- }
44
- return o;
45
- };
46
- }
47
- exports.createObjectFactory = createObjectFactory;
48
- //# sourceMappingURL=createObjectFactory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createObjectFactory.js","sourceRoot":"","sources":["../../../../../packages/object/src/lib/createObjectFactory.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;GAWG;AACH,SAAgB,mBAAmB,CAAI,IAAc,EAAE,aAAmB;IACxE,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAA;IAC3B,IAAI,aAAa,IAAI,aAAa,CAAC,MAAM,GAAG,OAAO,EAAE;QACnD,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAA;KACjE;IACD,OAAO,SAAS,OAAO,CAAC,MAAY;QAClC,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,OAAO,EAAE;YACrC,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;SAC1D;QACD,MAAM,CAAC,GAAG,EAAE,CAAA;QACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,EAAE,EAAE;YAChC,IAAI,KAAK,CAAA;YACT,IAAI,MAAM,EAAE;gBACV,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAA;gBACjB,IAAI,KAAK,KAAK,SAAS,IAAI,aAAa,EAAE;oBACxC,KAAK,GAAG,aAAa,CAAC,CAAC,CAAC,CAAA;iBACzB;aACF;iBAAM,IAAI,aAAa,EAAE;gBACxB,KAAK,GAAG,aAAa,CAAC,CAAC,CAAC,CAAA;aACzB;YACD,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE;gBAChC,UAAU,EAAE,IAAI;gBAChB,QAAQ,EAAE,IAAI;gBACd,YAAY,EAAE,IAAI;gBAClB,KAAK;aACN,CAAC,CAAA;SACH;QACD,OAAO,CAAC,CAAA;IACV,CAAC,CAAA;AACH,CAAC;AA7BD,kDA6BC"}
@@ -1,14 +0,0 @@
1
- import { TConstructorOf } from '@bemoje/types';
2
- /**
3
- * Returns the constructor of the given object.
4
- * @template T - The type of the object.
5
- * @param o The object whose constructor is to be returned.
6
- * @returns The constructor of the object.
7
- * @example ```ts
8
- * class MyClass {}
9
- * getConstructor(new MyClass()) === MyClass;;
10
- * //=> true
11
- * ```
12
- */
13
- export declare function getConstructor<T>(o: T): TConstructorOf<T>;
14
- //# sourceMappingURL=getConstructor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getConstructor.d.ts","sourceRoot":"","sources":["../../../../../packages/object/src/lib/getConstructor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAE9C;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAEzD"}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getConstructor = void 0;
4
- /**
5
- * Returns the constructor of the given object.
6
- * @template T - The type of the object.
7
- * @param o The object whose constructor is to be returned.
8
- * @returns The constructor of the object.
9
- * @example ```ts
10
- * class MyClass {}
11
- * getConstructor(new MyClass()) === MyClass;;
12
- * //=> true
13
- * ```
14
- */
15
- function getConstructor(o) {
16
- return Object.getPrototypeOf(o).constructor;
17
- }
18
- exports.getConstructor = getConstructor;
19
- //# sourceMappingURL=getConstructor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getConstructor.js","sourceRoot":"","sources":["../../../../../packages/object/src/lib/getConstructor.ts"],"names":[],"mappings":";;;AAEA;;;;;;;;;;GAUG;AACH,SAAgB,cAAc,CAAI,CAAI;IACpC,OAAO,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,WAAW,CAAA;AAC7C,CAAC;AAFD,wCAEC"}
@@ -1,25 +0,0 @@
1
- import { Any } from '@bemoje/types';
2
- /**
3
- * Iterate the prototype chain of a given object.
4
- * @remarks This function uses the `Reflect.getPrototypeOf` method to traverse the prototype chain.
5
- * It also uses the `isPrototype` and `isConstructor` helper functions to determine whether
6
- * the given object is a prototype or a constructor function.
7
- * @param object The object whose prototype chain is to be iterated over.
8
- * @throws If the provided object is not an object or a function, a TypeError will be thrown.
9
- * @returns A generator that yields each prototype in the chain.
10
- * @example ```ts
11
- * class A {}
12
- * class B extends A {}
13
- * class C extends B {}
14
- * const instance = new C()
15
- * iteratePrototypeChain(C)
16
- * //=> [ C, B, A, Function.prototype, Object.prototype]
17
- * iteratePrototypeChain(C.prototype)
18
- * //=> [C.prototype, B.prototype, A.prototype, Object.prototype]
19
- * iteratePrototypeChain(instance)
20
- * //=> [instance, C.prototype, B.prototype, A.prototype, Object.prototype]
21
- * ```
22
- */
23
- export declare function iteratePrototypeChain(object: Record<string, Any>): Generator<Record<string, Any>>;
24
- export declare function iteratePrototypeChain2(object: Record<string, Any>): Generator<Record<string, Any>>;
25
- //# sourceMappingURL=iteratePrototypeChain.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"iteratePrototypeChain.d.ts","sourceRoot":"","sources":["../../../../../packages/object/src/lib/iteratePrototypeChain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA;AAInC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAiB,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAkBlG;AAED,wBAAiB,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CASnG"}