@nejs/basic-extensions 2.21.5 → 2.22.6

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 (266) hide show
  1. package/README.md +78 -4
  2. package/dist/@nejs/basic-extensions.bundle.2.22.6.js +25 -0
  3. package/dist/@nejs/basic-extensions.bundle.2.22.6.js.map +7 -0
  4. package/dist/cjs/classes/index.cjs +11129 -0
  5. package/dist/cjs/classes/index.cjs.map +7 -0
  6. package/dist/cjs/index.cjs +15191 -0
  7. package/dist/cjs/index.cjs.map +7 -0
  8. package/dist/cjs/utils/index.cjs +3954 -0
  9. package/dist/cjs/utils/index.cjs.map +7 -0
  10. package/dist/esm/basic-extensions.mjs +25 -0
  11. package/dist/esm/basic-extensions.mjs.map +7 -0
  12. package/package.json +16 -22
  13. package/repl.bootstrap.js +4 -7
  14. package/repl.history +26 -26
  15. package/src/classes/enumeration.js +466 -0
  16. package/src/classes/index.js +5 -1
  17. package/src/index.js +3 -1
  18. package/src/regular.expression.extensions.js +0 -35
  19. package/src/utils/toolkit.js +699 -516
  20. package/tests/arrayextensions.test.js +3 -3
  21. package/tests/index.test.js +3 -1
  22. package/tests/newClasses/asyncIterable.test.js +3 -3
  23. package/tests/newClasses/deferred.test.js +3 -3
  24. package/tests/newClasses/descriptor.test.js +3 -3
  25. package/tests/newClasses/iterable.test.js +3 -3
  26. package/tests/newClasses/refmap.test.js +3 -3
  27. package/tests/newClasses/refset.test.js +3 -3
  28. package/tests/objectextensions.test.js +3 -3
  29. package/tests/setextensions.test.js +3 -3
  30. package/tests/stringextensions.test.js +3 -2
  31. package/tests/utils/descriptor.utils.test.js +1 -1
  32. package/tests/utils/toolkit.test.js +429 -163
  33. package/.esdoc.json +0 -9
  34. package/.vscode/settings.json +0 -5
  35. package/bin/build +0 -27
  36. package/bin/clean +0 -14
  37. package/bin/esbuild +0 -91
  38. package/bin/fixup +0 -13
  39. package/bin/repl.basics.js +0 -584
  40. package/bin/repl.signature.js +0 -63
  41. package/bin/version +0 -100
  42. package/dist/@nejs/basic-extensions.bundle.2.21.5.js +0 -25
  43. package/dist/@nejs/basic-extensions.bundle.2.21.5.js.map +0 -7
  44. package/dist/cjs/array.extensions.d.ts +0 -39
  45. package/dist/cjs/array.extensions.js +0 -477
  46. package/dist/cjs/array.extensions.js.map +0 -1
  47. package/dist/cjs/big.int.extension.d.ts +0 -31
  48. package/dist/cjs/big.int.extension.js +0 -273
  49. package/dist/cjs/big.int.extension.js.map +0 -1
  50. package/dist/cjs/classes/asyncIterable.d.ts +0 -126
  51. package/dist/cjs/classes/asyncIterable.js +0 -209
  52. package/dist/cjs/classes/asyncIterable.js.map +0 -1
  53. package/dist/cjs/classes/deferred.d.ts +0 -146
  54. package/dist/cjs/classes/deferred.js +0 -291
  55. package/dist/cjs/classes/deferred.js.map +0 -1
  56. package/dist/cjs/classes/descriptor.d.ts +0 -334
  57. package/dist/cjs/classes/descriptor.js +0 -537
  58. package/dist/cjs/classes/descriptor.js.map +0 -1
  59. package/dist/cjs/classes/enum.d.ts +0 -50
  60. package/dist/cjs/classes/enum.js +0 -405
  61. package/dist/cjs/classes/enum.js.map +0 -1
  62. package/dist/cjs/classes/index.d.ts +0 -15
  63. package/dist/cjs/classes/index.js +0 -63
  64. package/dist/cjs/classes/index.js.map +0 -1
  65. package/dist/cjs/classes/introspector.d.ts +0 -20
  66. package/dist/cjs/classes/introspector.js +0 -130
  67. package/dist/cjs/classes/introspector.js.map +0 -1
  68. package/dist/cjs/classes/iterable.d.ts +0 -169
  69. package/dist/cjs/classes/iterable.js +0 -268
  70. package/dist/cjs/classes/iterable.js.map +0 -1
  71. package/dist/cjs/classes/param.parser.d.ts +0 -221
  72. package/dist/cjs/classes/param.parser.js +0 -242
  73. package/dist/cjs/classes/param.parser.js.map +0 -1
  74. package/dist/cjs/classes/pluggable.proxy.d.ts +0 -153
  75. package/dist/cjs/classes/pluggable.proxy.js +0 -444
  76. package/dist/cjs/classes/pluggable.proxy.js.map +0 -1
  77. package/dist/cjs/classes/property.d.ts +0 -79
  78. package/dist/cjs/classes/property.js +0 -284
  79. package/dist/cjs/classes/property.js.map +0 -1
  80. package/dist/cjs/classes/refmap.d.ts +0 -238
  81. package/dist/cjs/classes/refmap.js +0 -421
  82. package/dist/cjs/classes/refmap.js.map +0 -1
  83. package/dist/cjs/classes/refset.d.ts +0 -186
  84. package/dist/cjs/classes/refset.js +0 -370
  85. package/dist/cjs/classes/refset.js.map +0 -1
  86. package/dist/cjs/classes/symkeys.d.ts +0 -349
  87. package/dist/cjs/classes/symkeys.js +0 -510
  88. package/dist/cjs/classes/symkeys.js.map +0 -1
  89. package/dist/cjs/classes/type.d.ts +0 -56
  90. package/dist/cjs/classes/type.js +0 -405
  91. package/dist/cjs/classes/type.js.map +0 -1
  92. package/dist/cjs/function.extensions.d.ts +0 -12
  93. package/dist/cjs/function.extensions.js +0 -758
  94. package/dist/cjs/function.extensions.js.map +0 -1
  95. package/dist/cjs/global.this.d.ts +0 -2
  96. package/dist/cjs/global.this.js +0 -300
  97. package/dist/cjs/global.this.js.map +0 -1
  98. package/dist/cjs/index.d.ts +0 -31
  99. package/dist/cjs/index.js +0 -228
  100. package/dist/cjs/index.js.map +0 -1
  101. package/dist/cjs/json.extensions.d.ts +0 -2
  102. package/dist/cjs/json.extensions.js +0 -109
  103. package/dist/cjs/json.extensions.js.map +0 -1
  104. package/dist/cjs/map.extensions.d.ts +0 -3
  105. package/dist/cjs/map.extensions.js +0 -143
  106. package/dist/cjs/map.extensions.js.map +0 -1
  107. package/dist/cjs/math.extension.d.ts +0 -14
  108. package/dist/cjs/math.extension.js +0 -71
  109. package/dist/cjs/math.extension.js.map +0 -1
  110. package/dist/cjs/number.extension.d.ts +0 -44
  111. package/dist/cjs/number.extension.js +0 -278
  112. package/dist/cjs/number.extension.js.map +0 -1
  113. package/dist/cjs/object.extensions.d.ts +0 -33
  114. package/dist/cjs/object.extensions.js +0 -1091
  115. package/dist/cjs/object.extensions.js.map +0 -1
  116. package/dist/cjs/package.json +0 -3
  117. package/dist/cjs/proxy.extensions.d.ts +0 -2
  118. package/dist/cjs/proxy.extensions.js +0 -207
  119. package/dist/cjs/proxy.extensions.js.map +0 -1
  120. package/dist/cjs/reflect.extensions.d.ts +0 -14
  121. package/dist/cjs/reflect.extensions.js +0 -316
  122. package/dist/cjs/reflect.extensions.js.map +0 -1
  123. package/dist/cjs/regular.expression.extensions.d.ts +0 -2
  124. package/dist/cjs/regular.expression.extensions.js +0 -423
  125. package/dist/cjs/regular.expression.extensions.js.map +0 -1
  126. package/dist/cjs/set.extensions.d.ts +0 -40
  127. package/dist/cjs/set.extensions.js +0 -355
  128. package/dist/cjs/set.extensions.js.map +0 -1
  129. package/dist/cjs/string.extensions.d.ts +0 -23
  130. package/dist/cjs/string.extensions.js +0 -704
  131. package/dist/cjs/string.extensions.js.map +0 -1
  132. package/dist/cjs/symbol.extensions.d.ts +0 -11
  133. package/dist/cjs/symbol.extensions.js +0 -735
  134. package/dist/cjs/symbol.extensions.js.map +0 -1
  135. package/dist/cjs/utils/copy.object.d.ts +0 -408
  136. package/dist/cjs/utils/copy.object.js +0 -720
  137. package/dist/cjs/utils/copy.object.js.map +0 -1
  138. package/dist/cjs/utils/descriptor.utils.d.ts +0 -298
  139. package/dist/cjs/utils/descriptor.utils.js +0 -889
  140. package/dist/cjs/utils/descriptor.utils.js.map +0 -1
  141. package/dist/cjs/utils/index.d.ts +0 -75
  142. package/dist/cjs/utils/index.js +0 -61
  143. package/dist/cjs/utils/index.js.map +0 -1
  144. package/dist/cjs/utils/stdout.d.ts +0 -742
  145. package/dist/cjs/utils/stdout.js +0 -1042
  146. package/dist/cjs/utils/stdout.js.map +0 -1
  147. package/dist/cjs/utils/toolkit.d.ts +0 -1898
  148. package/dist/cjs/utils/toolkit.js +0 -1378
  149. package/dist/cjs/utils/toolkit.js.map +0 -1
  150. package/dist/cjs/weakref.extensions.d.ts +0 -2
  151. package/dist/cjs/weakref.extensions.js +0 -19
  152. package/dist/cjs/weakref.extensions.js.map +0 -1
  153. package/dist/mjs/array.extensions.d.ts +0 -39
  154. package/dist/mjs/array.extensions.js +0 -474
  155. package/dist/mjs/array.extensions.js.map +0 -1
  156. package/dist/mjs/big.int.extension.d.ts +0 -31
  157. package/dist/mjs/big.int.extension.js +0 -270
  158. package/dist/mjs/big.int.extension.js.map +0 -1
  159. package/dist/mjs/classes/asyncIterable.d.ts +0 -126
  160. package/dist/mjs/classes/asyncIterable.js +0 -204
  161. package/dist/mjs/classes/asyncIterable.js.map +0 -1
  162. package/dist/mjs/classes/deferred.d.ts +0 -146
  163. package/dist/mjs/classes/deferred.js +0 -287
  164. package/dist/mjs/classes/deferred.js.map +0 -1
  165. package/dist/mjs/classes/descriptor.d.ts +0 -334
  166. package/dist/mjs/classes/descriptor.js +0 -533
  167. package/dist/mjs/classes/descriptor.js.map +0 -1
  168. package/dist/mjs/classes/enum.d.ts +0 -50
  169. package/dist/mjs/classes/enum.js +0 -400
  170. package/dist/mjs/classes/enum.js.map +0 -1
  171. package/dist/mjs/classes/index.d.ts +0 -15
  172. package/dist/mjs/classes/index.js +0 -46
  173. package/dist/mjs/classes/index.js.map +0 -1
  174. package/dist/mjs/classes/introspector.d.ts +0 -20
  175. package/dist/mjs/classes/introspector.js +0 -126
  176. package/dist/mjs/classes/introspector.js.map +0 -1
  177. package/dist/mjs/classes/iterable.d.ts +0 -169
  178. package/dist/mjs/classes/iterable.js +0 -263
  179. package/dist/mjs/classes/iterable.js.map +0 -1
  180. package/dist/mjs/classes/param.parser.d.ts +0 -221
  181. package/dist/mjs/classes/param.parser.js +0 -238
  182. package/dist/mjs/classes/param.parser.js.map +0 -1
  183. package/dist/mjs/classes/pluggable.proxy.d.ts +0 -153
  184. package/dist/mjs/classes/pluggable.proxy.js +0 -438
  185. package/dist/mjs/classes/pluggable.proxy.js.map +0 -1
  186. package/dist/mjs/classes/property.d.ts +0 -79
  187. package/dist/mjs/classes/property.js +0 -280
  188. package/dist/mjs/classes/property.js.map +0 -1
  189. package/dist/mjs/classes/refmap.d.ts +0 -238
  190. package/dist/mjs/classes/refmap.js +0 -417
  191. package/dist/mjs/classes/refmap.js.map +0 -1
  192. package/dist/mjs/classes/refset.d.ts +0 -186
  193. package/dist/mjs/classes/refset.js +0 -366
  194. package/dist/mjs/classes/refset.js.map +0 -1
  195. package/dist/mjs/classes/symkeys.d.ts +0 -349
  196. package/dist/mjs/classes/symkeys.js +0 -506
  197. package/dist/mjs/classes/symkeys.js.map +0 -1
  198. package/dist/mjs/classes/type.d.ts +0 -56
  199. package/dist/mjs/classes/type.js +0 -401
  200. package/dist/mjs/classes/type.js.map +0 -1
  201. package/dist/mjs/function.extensions.d.ts +0 -12
  202. package/dist/mjs/function.extensions.js +0 -755
  203. package/dist/mjs/function.extensions.js.map +0 -1
  204. package/dist/mjs/global.this.d.ts +0 -2
  205. package/dist/mjs/global.this.js +0 -264
  206. package/dist/mjs/global.this.js.map +0 -1
  207. package/dist/mjs/index.d.ts +0 -31
  208. package/dist/mjs/index.js +0 -206
  209. package/dist/mjs/index.js.map +0 -1
  210. package/dist/mjs/json.extensions.d.ts +0 -2
  211. package/dist/mjs/json.extensions.js +0 -106
  212. package/dist/mjs/json.extensions.js.map +0 -1
  213. package/dist/mjs/map.extensions.d.ts +0 -3
  214. package/dist/mjs/map.extensions.js +0 -140
  215. package/dist/mjs/map.extensions.js.map +0 -1
  216. package/dist/mjs/math.extension.d.ts +0 -14
  217. package/dist/mjs/math.extension.js +0 -68
  218. package/dist/mjs/math.extension.js.map +0 -1
  219. package/dist/mjs/number.extension.d.ts +0 -44
  220. package/dist/mjs/number.extension.js +0 -275
  221. package/dist/mjs/number.extension.js.map +0 -1
  222. package/dist/mjs/object.extensions.d.ts +0 -33
  223. package/dist/mjs/object.extensions.js +0 -1088
  224. package/dist/mjs/object.extensions.js.map +0 -1
  225. package/dist/mjs/package.json +0 -3
  226. package/dist/mjs/proxy.extensions.d.ts +0 -2
  227. package/dist/mjs/proxy.extensions.js +0 -204
  228. package/dist/mjs/proxy.extensions.js.map +0 -1
  229. package/dist/mjs/reflect.extensions.d.ts +0 -14
  230. package/dist/mjs/reflect.extensions.js +0 -313
  231. package/dist/mjs/reflect.extensions.js.map +0 -1
  232. package/dist/mjs/regular.expression.extensions.d.ts +0 -2
  233. package/dist/mjs/regular.expression.extensions.js +0 -420
  234. package/dist/mjs/regular.expression.extensions.js.map +0 -1
  235. package/dist/mjs/set.extensions.d.ts +0 -40
  236. package/dist/mjs/set.extensions.js +0 -352
  237. package/dist/mjs/set.extensions.js.map +0 -1
  238. package/dist/mjs/string.extensions.d.ts +0 -23
  239. package/dist/mjs/string.extensions.js +0 -701
  240. package/dist/mjs/string.extensions.js.map +0 -1
  241. package/dist/mjs/symbol.extensions.d.ts +0 -11
  242. package/dist/mjs/symbol.extensions.js +0 -732
  243. package/dist/mjs/symbol.extensions.js.map +0 -1
  244. package/dist/mjs/utils/copy.object.d.ts +0 -408
  245. package/dist/mjs/utils/copy.object.js +0 -702
  246. package/dist/mjs/utils/copy.object.js.map +0 -1
  247. package/dist/mjs/utils/descriptor.utils.d.ts +0 -298
  248. package/dist/mjs/utils/descriptor.utils.js +0 -875
  249. package/dist/mjs/utils/descriptor.utils.js.map +0 -1
  250. package/dist/mjs/utils/index.d.ts +0 -75
  251. package/dist/mjs/utils/index.js +0 -45
  252. package/dist/mjs/utils/index.js.map +0 -1
  253. package/dist/mjs/utils/stdout.d.ts +0 -742
  254. package/dist/mjs/utils/stdout.js +0 -1037
  255. package/dist/mjs/utils/stdout.js.map +0 -1
  256. package/dist/mjs/utils/toolkit.d.ts +0 -1898
  257. package/dist/mjs/utils/toolkit.js +0 -1373
  258. package/dist/mjs/utils/toolkit.js.map +0 -1
  259. package/dist/mjs/weakref.extensions.d.ts +0 -2
  260. package/dist/mjs/weakref.extensions.js +0 -16
  261. package/dist/mjs/weakref.extensions.js.map +0 -1
  262. package/jsdoc-config.json +0 -31
  263. package/tsconfig.base.json +0 -28
  264. package/tsconfig.cjs.json +0 -8
  265. package/tsconfig.esm.json +0 -8
  266. package/vitest.config.js +0 -7
@@ -1,334 +0,0 @@
1
- export class Descriptor {
2
- /**
3
- * The function `getData` retrieves the value of a property from an object
4
- * if it exists and is a data property.
5
- *
6
- * @param {object} object - The "object" parameter is the object from which
7
- * we want to retrieve data.
8
- * @param {string|symbol} property - The `property` parameter is the name of
9
- * the property that you want to retrieve the data from.
10
- * @returns either the value of the specified property if it exists and is
11
- * a data property, or undefined if the property does not exist or is not
12
- * a data property.
13
- */
14
- static getData(object: object, property: string | symbol): any;
15
- /**
16
- * The function `getAccessor` checks if an object has a getter/setter accessor
17
- * for a given property and returns the accessor functions if found.
18
- *
19
- * @param object - The `object` parameter is the object from which we want to
20
- * retrieve the accessor for a specific property.
21
- * @param property - The `property` parameter is the name of the property for
22
- * which we want to get the accessor.
23
- * @returns an object that contains the getter and setter functions for the
24
- * specified property of the given object. If the property is an accessor
25
- * property (defined with a getter and/or setter), the returned object will
26
- * also have additional properties such as "accessor" and "descriptor". If
27
- * the property is not found or is not an accessor property, the function
28
- * returns undefined.
29
- */
30
- static getAccessor(object: any, property: any): any;
31
- /**
32
- * The function returns an object with enumerable and configurable properties
33
- * based on the input parameters.
34
- *
35
- * @param [enumerable=false] - A boolean value indicating whether the property
36
- * can be enumerated (listed) when iterating over the object's properties.
37
- * @param [configurable=false] - The `configurable` parameter determines
38
- * whether the property can be deleted or its attributes can be modified.
39
- * If `configurable` is set to `true`, the property can be deleted and its
40
- * attributes can be changed. If `configurable` is set to `false`, the
41
- * property cannot be deleted and
42
- * @returns An object with the properties `enumerable` and `configurable` is
43
- * being returned. The values of these properties are determined by the
44
- * arguments passed to the `base` function.
45
- */
46
- static base(enumerable?: boolean | undefined, configurable?: boolean | undefined): {
47
- enumerable: boolean;
48
- configurable: boolean;
49
- };
50
- /**
51
- * The function "newAccessor" creates a new property descriptor object with a
52
- * getter and setter function, along with optional enumerable and configurable
53
- * flags.
54
- *
55
- * @param getter - The getter parameter is a function that will be used as the
56
- * getter for the property. It will be called when the property is accessed.
57
- * @param setter - The `setter` parameter is a function that will be used as
58
- * the setter for the property. It will be called whenever the property is
59
- * assigned a new value.
60
- * @param [] - - `getter`: A function that will be used as the getter for the
61
- * property.
62
- * @returns an object with properties "get", "set", "enumerable", and
63
- * "configurable".
64
- */
65
- static accessor(...args: any[]): any;
66
- /**
67
- * The function "newData" creates a new data object with customizable
68
- * properties.
69
- *
70
- * @param value - The value parameter represents the value that will be
71
- * assigned to the property.
72
- * @param [writable=true] - The `writable` parameter determines whether the
73
- * value of the property can be changed. If `writable` is set to `true`, the
74
- * value can be changed. If `writable` is set to `false`, the value cannot be
75
- * changed.
76
- * @param [] - - `value`: The value to be assigned to the property.
77
- * @returns an object with properties `value`, `enumerable`, `writable`, and
78
- * `configurable`.
79
- */
80
- static data(value: any, writable?: boolean | undefined, { enumerable, configurable }?: {
81
- configurable: boolean;
82
- enumerable: boolean;
83
- } | undefined): any;
84
- /**
85
- * Shorthand for Object.getOwnPropertyDescriptor()
86
- *
87
- * @param {object} object a non-null object instance
88
- * @param {string|symbol} key a symbol or string referencing which key on the
89
- * object to return a descriptor for.
90
- * @returns an object descriptor for the requested field or null
91
- */
92
- static for(object: object, key: string | symbol, wrap?: boolean): PropertyDescriptor | Descriptor | null | undefined;
93
- /**
94
- * The function checks if an object is a likely an object descriptor in
95
- * JavaScript. This is determined as an object with some of the known
96
- * descriptor keys (e.g. enumerable, configurable, value, writable, get,
97
- * or set). Technically, any object could serve as a descriptor but this
98
- * function only returns true if known descriptor keys are found.
99
- *
100
- * @param {any} object - Any value we want to check for being a descriptor.
101
- * @param {boolean} returnStatsInstead defaults to false, but if the value
102
- * is `true` then an object with reasoning behind the decision of whether
103
- * or not the
104
- * @returns {IsDescriptorResponse} either a {@link boolean} value or
105
- * an object conforming to {@link IsDescriptorStats} if `returnStatsInstead`
106
- * is `true`
107
- *
108
- * @see {@link DescriptorUtils.isDescriptor}
109
- */
110
- static isDescriptor(object: any, returnStatsInstead?: boolean): IsDescriptorResponse;
111
- /**
112
- * The function checks if a given property descriptor or property of an
113
- * object is an accessor.
114
- *
115
- * @param {object} objectOrDescriptor - The `objectOrDescriptor` parameter
116
- * can be either a descriptor object or a property name.
117
- * @param {(string|number|symbol)?} property the property name you wish to
118
- * check the validity as an accessor descriptor. Only expected if the
119
- * `objectOrDescriptor` parameter is the object that would contain this
120
- * property.
121
- * @returns {@link Boolean} returning `true` if the `descriptor` object
122
- * has any keys that match the {@link Descriptor.ACCESSOR_KEYS} array,
123
- * otherwise it returns `false`.
124
- */
125
- static isAccessor(objectOrDescriptor: object, property: (string | number | symbol) | null): any;
126
- /**
127
- * The function checks if a given property or descriptor is a data property.
128
- *
129
- * @param {object} objectOrDescriptor - The `objectOrDescriptor` parameter
130
- * can be either a descriptor object or a property name.
131
- * @param {(string|number|symbol)?} property the property name you wish to
132
- * check the validity as an accessor descriptor. Only expected if the
133
- * `objectOrDescriptor` parameter is the object that would contain this
134
- * property.
135
- * @returns {@link Boolean} returning `true` if the `descriptor` object
136
- * has any keys that match the {@link Descriptor.DATA_KEYS} array, otherwise
137
- * it returns `false`.
138
- */
139
- static isData(objectOrDescriptor: object, property: (string | number | symbol) | null): any;
140
- /**
141
- * A base descriptor (new for each read) that is both enumerable and
142
- * configurable
143
- *
144
- * @returns `{ enumerable: true, configurable: true }`
145
- */
146
- static get flexible(): {
147
- enumerable: boolean;
148
- configurable: boolean;
149
- };
150
- /**
151
- * A base descriptor (new for each read) that is not enumerable but is
152
- * configurable
153
- *
154
- * @returns `{ enumerable: false, configurable: true }`
155
- */
156
- static get enigmatic(): {
157
- enumerable: boolean;
158
- configurable: boolean;
159
- };
160
- /**
161
- * A base descriptor (new for each read) that is neither enumerable
162
- * nor configurable.
163
- *
164
- * @returns `{ enumerable: false, configurable: false }`
165
- */
166
- static get intrinsic(): {
167
- enumerable: boolean;
168
- configurable: boolean;
169
- };
170
- /**
171
- * A base descriptor (new for each read) that is enumerable but
172
- * not configurable
173
- *
174
- * @returns `{ enumerable: true, configurable: false }`
175
- */
176
- static get transparent(): {
177
- enumerable: boolean;
178
- configurable: boolean;
179
- };
180
- /**
181
- * The function returns an array of shared descriptor keys.
182
- *
183
- * @returns An array containing the strings 'configurable' and 'enumerable'.
184
- */
185
- static get SHARED_KEYS(): string[];
186
- /**
187
- * The function returns an array of accessor descriptor keys.
188
- *
189
- * @returns An array containing the strings 'get' and 'set' is being returned.
190
- */
191
- static get ACCESSOR_KEYS(): string[];
192
- /**
193
- * The function returns an array of data descriptor keys.
194
- *
195
- * @returns An array containing the strings 'value' and 'writable' is being
196
- * returned.
197
- */
198
- static get DATA_KEYS(): string[];
199
- /**
200
- * Constructs a Descriptor instance which wraps and manages an object
201
- * property descriptor. The constructor can handle an existing descriptor
202
- * object or create a new one based on an object and a property key.
203
- *
204
- * @param {object|Descriptor} object - The target object or an existing
205
- * Descriptor instance. If it's an object, it is used in conjunction with
206
- * `key` to create a descriptor. If it's a Descriptor instance, it is used
207
- * directly as the descriptor.
208
- * @param {string|symbol} [key] - The property key for which the descriptor
209
- * is to be created. This parameter is ignored if `object` is a Descriptor
210
- * instance. If `key` is an object and `object` is a valid descriptor, `key`
211
- * is treated as the associated object.
212
- * @throws {Error} Throws an error if the constructed descriptor is not
213
- * valid.
214
- */
215
- constructor(object: object | Descriptor, key?: string | symbol, ...args: any[]);
216
- /**
217
- * The default private descriptor value is that of `enigmatic`
218
- *
219
- * @private
220
- * @type {object}
221
- */
222
- private _desc;
223
- /**
224
- * An optionally associated object, usually the parent from which
225
- * the descriptor was taken, or undefined if none was able to be
226
- * derived.
227
- *
228
- * @type {object}
229
- */
230
- _object: object;
231
- /**
232
- * Detects whether or not this instance is an accessor object descriptor
233
- *
234
- * @returns {boolean} true if this object has a getter or setter and is not
235
- * a data descriptor
236
- */
237
- get isAccessor(): boolean;
238
- /**
239
- * Detects whether or not this instance is an data object descriptor
240
- *
241
- * @returns {boolean} true if this object has a value property and is not
242
- * an accessor descriptor
243
- */
244
- get isData(): boolean;
245
- /**
246
- * Detects whether or not this instance is a valid object descriptor
247
- *
248
- * @returns {boolean} true if this descriptor store is a valid descriptor
249
- */
250
- get isDescriptor(): boolean;
251
- /**
252
- * Retrieves the {@link get} function for this accessor and binds it to
253
- * the object from which the descriptor was derived, if that value is set.
254
- * Otherwise this method is identical to the {@link get} accessor.
255
- *
256
- * @returns {function} the getter if one is defined. If possible this
257
- * getter will be bound the associated and previously set `object`.
258
- */
259
- get boundGet(): Function;
260
- /**
261
- * Retrieves the {@link set} function for this accessor and binds it to
262
- * the object from which the descriptor was derived, if that value is set.
263
- * Otherwise this method is identical to the {@link set} accessor.
264
- *
265
- * @returns {function} the setter if one is defined. If possible this
266
- * setter will be bound the associated and previously set `object`.
267
- */
268
- get boundSet(): Function;
269
- /**
270
- * The function checks the descriptor's associated object has been set on this
271
- * instance of `Descriptor`.
272
- *
273
- * @returns {boolean} `true` if the `object` property has been set,
274
- * `false` otherwise
275
- */
276
- get hasObject(): boolean;
277
- /**
278
- * Sets the descriptor's associated `object` value. This is usually the
279
- * parent object from which the descriptor was derived.
280
- *
281
- * @param {object} value sets the object for which this descriptor is to
282
- * be associated with.
283
- */
284
- set object(value: object);
285
- /**
286
- * Returns the descriptor's associated `object` value. This is usually the
287
- * parent object from which the descriptor was derived. If the value is preset
288
- * it will be returned. Undefined will be returned otherwise
289
- *
290
- * @returns {object} the associated object for this descriptor or undefined
291
- * if it has not yet been set.
292
- */
293
- get object(): object;
294
- /**
295
- * Take the descriptor defined by this objects values and apply them to
296
- * the specified object using the specified key.
297
- *
298
- * @param {object} object the object to apply this descriptor to
299
- * @param {string|symbol} forKey the string or symbol for which this
300
- * descriptor will abe applied
301
- */
302
- applyTo(object: object, forKey: string | symbol, bindAccessors?: boolean): object;
303
- /**
304
- * Converts this Descriptor class instance into a basic object descriptor
305
- * that is accepted by all the standard JavaScript runtime methods that
306
- * deal with object descriptors.
307
- *
308
- * @param {boolean|object} bindAccessors if `true`, a non-fatal attempt to
309
- * bind accessor getter and setter methods is made before returning the
310
- * object. If `bindAccessors` is truthy and is also an object, this is the
311
- * object the accessors will be bound to. If the value is falsy or if the
312
- * descriptor instance represents a data descriptor, nothing happens.
313
- * @returns {object} the object instance's basic object representation as
314
- * a descriptor.
315
- */
316
- toObject(bindAccessors?: boolean | object): object;
317
- /**
318
- * Converts this descriptor object into a base representation
319
- *
320
- * @param {string} hint one of `string`, `number` or default;
321
- * @returns if the hint is 'string', then a string identifying the enum
322
- * and its type is returned. `number` will always be NaN since it is incoret
323
- */
324
- [Symbol.toPrimitive](hint: string): string | number | object | undefined;
325
- /**
326
- * Ensures that the constructor of this object instance's name
327
- * is returned if the string tag for this instance is queried
328
- *
329
- * @returns {string} the name of the class
330
- */
331
- get [Symbol.toStringTag](): string;
332
- }
333
- export const DescriptorExtensions: Extension;
334
- import { Extension } from '@nejs/extension';