@nejs/basic-extensions 2.9.0 → 2.11.0

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 (176) hide show
  1. package/dist/@nejs/basic-extensions.bundle.2.11.0.js +19 -0
  2. package/dist/@nejs/basic-extensions.bundle.2.11.0.js.map +7 -0
  3. package/dist/cjs/array.extensions.js +174 -0
  4. package/dist/cjs/array.extensions.js.map +1 -1
  5. package/dist/cjs/big.int.extension.js +1 -0
  6. package/dist/cjs/big.int.extension.js.map +1 -1
  7. package/dist/cjs/classes/descriptor.d.ts +67 -155
  8. package/dist/cjs/classes/descriptor.js +185 -278
  9. package/dist/cjs/classes/descriptor.js.map +1 -1
  10. package/dist/cjs/classes/index.d.ts +1 -0
  11. package/dist/cjs/classes/index.js +3 -0
  12. package/dist/cjs/classes/index.js.map +1 -1
  13. package/dist/cjs/classes/iterable.d.ts +44 -0
  14. package/dist/cjs/classes/iterable.js +64 -0
  15. package/dist/cjs/classes/iterable.js.map +1 -1
  16. package/dist/cjs/classes/param.parser.d.ts +10 -10
  17. package/dist/cjs/classes/property.d.ts +86 -0
  18. package/dist/cjs/classes/property.js +284 -0
  19. package/dist/cjs/classes/property.js.map +1 -0
  20. package/dist/cjs/classes/symkeys.d.ts +68 -11
  21. package/dist/cjs/classes/symkeys.js +103 -17
  22. package/dist/cjs/classes/symkeys.js.map +1 -1
  23. package/dist/cjs/classes/type.d.ts +4 -4
  24. package/dist/cjs/function.extensions.js +1 -0
  25. package/dist/cjs/function.extensions.js.map +1 -1
  26. package/dist/cjs/global.this.js +29 -0
  27. package/dist/cjs/global.this.js.map +1 -1
  28. package/dist/cjs/index.d.ts +3 -0
  29. package/dist/cjs/index.js +19 -0
  30. package/dist/cjs/index.js.map +1 -1
  31. package/dist/cjs/json.extensions.js +19 -18
  32. package/dist/cjs/json.extensions.js.map +1 -1
  33. package/dist/cjs/map.extensions.js +1 -0
  34. package/dist/cjs/map.extensions.js.map +1 -1
  35. package/dist/cjs/number.extension.js +1 -0
  36. package/dist/cjs/number.extension.js.map +1 -1
  37. package/dist/cjs/object.extensions.d.ts +0 -29
  38. package/dist/cjs/object.extensions.js +218 -255
  39. package/dist/cjs/object.extensions.js.map +1 -1
  40. package/dist/cjs/set.extensions.js +1 -0
  41. package/dist/cjs/set.extensions.js.map +1 -1
  42. package/dist/cjs/string.extensions.js +474 -469
  43. package/dist/cjs/string.extensions.js.map +1 -1
  44. package/dist/cjs/symbol.extensions.js +387 -32
  45. package/dist/cjs/symbol.extensions.js.map +1 -1
  46. package/dist/cjs/utils/copy.object.d.ts +408 -0
  47. package/dist/cjs/utils/copy.object.js +720 -0
  48. package/dist/cjs/utils/copy.object.js.map +1 -0
  49. package/dist/cjs/utils/descriptor.utils.d.ts +146 -0
  50. package/dist/cjs/utils/descriptor.utils.js +614 -0
  51. package/dist/cjs/utils/descriptor.utils.js.map +1 -0
  52. package/dist/cjs/utils/index.d.ts +60 -0
  53. package/dist/cjs/utils/index.js +52 -0
  54. package/dist/cjs/utils/index.js.map +1 -0
  55. package/dist/cjs/utils/toolkit.d.ts +1898 -0
  56. package/dist/cjs/utils/toolkit.js +1378 -0
  57. package/dist/cjs/utils/toolkit.js.map +1 -0
  58. package/dist/mjs/array.extensions.js +174 -0
  59. package/dist/mjs/array.extensions.js.map +1 -1
  60. package/dist/mjs/big.int.extension.js +1 -0
  61. package/dist/mjs/big.int.extension.js.map +1 -1
  62. package/dist/mjs/classes/descriptor.d.ts +67 -155
  63. package/dist/mjs/classes/descriptor.js +185 -278
  64. package/dist/mjs/classes/descriptor.js.map +1 -1
  65. package/dist/mjs/classes/index.d.ts +1 -0
  66. package/dist/mjs/classes/index.js +3 -0
  67. package/dist/mjs/classes/index.js.map +1 -1
  68. package/dist/mjs/classes/iterable.d.ts +44 -0
  69. package/dist/mjs/classes/iterable.js +64 -0
  70. package/dist/mjs/classes/iterable.js.map +1 -1
  71. package/dist/mjs/classes/param.parser.d.ts +10 -10
  72. package/dist/mjs/classes/property.d.ts +86 -0
  73. package/dist/mjs/classes/property.js +280 -0
  74. package/dist/mjs/classes/property.js.map +1 -0
  75. package/dist/mjs/classes/symkeys.d.ts +68 -11
  76. package/dist/mjs/classes/symkeys.js +103 -17
  77. package/dist/mjs/classes/symkeys.js.map +1 -1
  78. package/dist/mjs/classes/type.d.ts +4 -4
  79. package/dist/mjs/function.extensions.js +1 -0
  80. package/dist/mjs/function.extensions.js.map +1 -1
  81. package/dist/mjs/global.this.js +6 -0
  82. package/dist/mjs/global.this.js.map +1 -1
  83. package/dist/mjs/index.d.ts +3 -0
  84. package/dist/mjs/index.js +5 -0
  85. package/dist/mjs/index.js.map +1 -1
  86. package/dist/mjs/json.extensions.js +19 -18
  87. package/dist/mjs/json.extensions.js.map +1 -1
  88. package/dist/mjs/map.extensions.js +1 -0
  89. package/dist/mjs/map.extensions.js.map +1 -1
  90. package/dist/mjs/number.extension.js +1 -0
  91. package/dist/mjs/number.extension.js.map +1 -1
  92. package/dist/mjs/object.extensions.d.ts +0 -29
  93. package/dist/mjs/object.extensions.js +215 -251
  94. package/dist/mjs/object.extensions.js.map +1 -1
  95. package/dist/mjs/set.extensions.js +1 -0
  96. package/dist/mjs/set.extensions.js.map +1 -1
  97. package/dist/mjs/string.extensions.js +474 -469
  98. package/dist/mjs/string.extensions.js.map +1 -1
  99. package/dist/mjs/symbol.extensions.js +387 -32
  100. package/dist/mjs/symbol.extensions.js.map +1 -1
  101. package/dist/mjs/utils/copy.object.d.ts +408 -0
  102. package/dist/mjs/utils/copy.object.js +702 -0
  103. package/dist/mjs/utils/copy.object.js.map +1 -0
  104. package/dist/mjs/utils/descriptor.utils.d.ts +146 -0
  105. package/dist/mjs/utils/descriptor.utils.js +606 -0
  106. package/dist/mjs/utils/descriptor.utils.js.map +1 -0
  107. package/dist/mjs/utils/index.d.ts +60 -0
  108. package/dist/mjs/utils/index.js +36 -0
  109. package/dist/mjs/utils/index.js.map +1 -0
  110. package/dist/mjs/utils/toolkit.d.ts +1898 -0
  111. package/dist/mjs/utils/toolkit.js +1373 -0
  112. package/dist/mjs/utils/toolkit.js.map +1 -0
  113. package/package.json +29 -37
  114. package/repl.bootstrap.js +12 -1
  115. package/src/array.extensions.js +191 -1
  116. package/src/big.int.extension.js +3 -1
  117. package/src/classes/descriptor.js +206 -305
  118. package/src/classes/index.js +4 -0
  119. package/src/classes/iterable.js +74 -0
  120. package/src/classes/property.js +333 -0
  121. package/src/classes/symkeys.js +120 -19
  122. package/src/function.extensions.js +2 -0
  123. package/src/global.this.js +8 -0
  124. package/src/index.js +6 -0
  125. package/src/json.extensions.js +18 -19
  126. package/src/map.extensions.js +3 -1
  127. package/src/number.extension.js +3 -1
  128. package/src/object.extensions.js +240 -277
  129. package/src/set.extensions.js +3 -1
  130. package/src/string.extensions.js +512 -506
  131. package/src/symbol.extensions.js +413 -30
  132. package/src/utils/copy.object.js +780 -0
  133. package/src/utils/descriptor.utils.js +707 -0
  134. package/src/utils/index.js +74 -0
  135. package/src/utils/toolkit.js +1473 -0
  136. package/tests/arrayextensions.test.js +2 -0
  137. package/tests/index.test.js +1 -0
  138. package/tests/newClasses/asyncIterable.test.js +2 -0
  139. package/tests/newClasses/deferred.test.js +5 -3
  140. package/tests/newClasses/descriptor.test.js +6 -8
  141. package/tests/newClasses/iterable.test.js +2 -0
  142. package/tests/newClasses/refmap.test.js +2 -1
  143. package/tests/newClasses/refset.test.js +2 -0
  144. package/tests/objectextensions.test.js +2 -0
  145. package/tests/setextensions.test.js +2 -0
  146. package/tests/stringextensions.test.js +1 -0
  147. package/tests/utils/toolkit.test.js +223 -0
  148. package/tsconfig.base.json +1 -1
  149. package/vitest.config.js +7 -0
  150. package/dist/@nejs/basic-extensions.bundle.2.8.0.js +0 -19
  151. package/dist/@nejs/basic-extensions.bundle.2.8.0.js.map +0 -7
  152. package/docs/assets/anchor.js +0 -350
  153. package/docs/assets/bass-addons.css +0 -12
  154. package/docs/assets/bass.css +0 -544
  155. package/docs/assets/fonts/EOT/SourceCodePro-Bold.eot +0 -0
  156. package/docs/assets/fonts/EOT/SourceCodePro-Regular.eot +0 -0
  157. package/docs/assets/fonts/LICENSE.txt +0 -93
  158. package/docs/assets/fonts/OTF/SourceCodePro-Bold.otf +0 -0
  159. package/docs/assets/fonts/OTF/SourceCodePro-Regular.otf +0 -0
  160. package/docs/assets/fonts/TTF/SourceCodePro-Bold.ttf +0 -0
  161. package/docs/assets/fonts/TTF/SourceCodePro-Regular.ttf +0 -0
  162. package/docs/assets/fonts/WOFF/OTF/SourceCodePro-Bold.otf.woff +0 -0
  163. package/docs/assets/fonts/WOFF/OTF/SourceCodePro-Regular.otf.woff +0 -0
  164. package/docs/assets/fonts/WOFF/TTF/SourceCodePro-Bold.ttf.woff +0 -0
  165. package/docs/assets/fonts/WOFF/TTF/SourceCodePro-Regular.ttf.woff +0 -0
  166. package/docs/assets/fonts/WOFF2/OTF/SourceCodePro-Bold.otf.woff2 +0 -0
  167. package/docs/assets/fonts/WOFF2/OTF/SourceCodePro-Regular.otf.woff2 +0 -0
  168. package/docs/assets/fonts/WOFF2/TTF/SourceCodePro-Bold.ttf.woff2 +0 -0
  169. package/docs/assets/fonts/WOFF2/TTF/SourceCodePro-Regular.ttf.woff2 +0 -0
  170. package/docs/assets/fonts/source-code-pro.css +0 -23
  171. package/docs/assets/github.css +0 -123
  172. package/docs/assets/site.js +0 -168
  173. package/docs/assets/split.css +0 -15
  174. package/docs/assets/split.js +0 -782
  175. package/docs/assets/style.css +0 -147
  176. package/docs/index.html +0 -35485
@@ -0,0 +1,606 @@
1
+ /** @typedef {string|symbol|number} PropertyKey */
2
+ /**
3
+ * The `IsDescriptorStats` block contains all the information used to make
4
+ * a determination as to whether a given value is a an instance of the type
5
+ * {@link PropertyDescriptor} or at least compatible to used as one.
6
+ *
7
+ * @typedef {Object} IsDescriptorStats
8
+ * @property {number} confidence this is going to be a number from 0.0-1.0
9
+ * indicating the confidence ratio that the object supplied to `isDescriptor`
10
+ * is actually a valid `PropertyDescriptor` object. If the number is greater
11
+ * than 0 but less than 1.0, it likely indicates that the object can be used
12
+ * as a `PropertyDescriptor` but one or more factors gives it less than 100%
13
+ * confidence that being such is the objects intended purpose (e.g. it could
14
+ * be that there are more properties than a descriptor might have or that
15
+ * it is missing crucial properties such as `value`, `get` or `set`)
16
+ * @property {boolean} isAccessor true if the object is functional as an
17
+ * accessor descriptor; false otherwise
18
+ * @property {boolean} isData true if the object is functional as a data
19
+ * descriptor; false otherwise
20
+ * @property {boolean} isValid true if the object is technically a valid
21
+ * `PropertyDescriptor` object or compatible as one.
22
+ * @property {boolean} hasBaseDescriptorKeys true if the object has either
23
+ * `configurable` or `enumerable` property keys and both are `undefined` or
24
+ * of type `boolean`.
25
+ * @property {boolean} hasAccessorKeys true if the object has either `get`
26
+ * or `set` property keys and both are either `undefined` or of type
27
+ * `function`
28
+ * @property {boolean} hasDataKeys true if the object has either `value` or
29
+ * `writable` property keys and if `writable` is present, then it is of type
30
+ * `boolean`
31
+ */
32
+ /**
33
+ * The response from a call to {@link DescriptorUtils.isDescriptor} can
34
+ * be either a {@link boolean} or a {@link IsDescriptorStats} object.
35
+ *
36
+ * @typedef {IsDescriptorStats | boolean} IsDescriptorResponse
37
+ */
38
+ /**
39
+ * A set of utility functions work with {@link PropertyDescriptor} objects.
40
+ * The creation of property descriptors can be large in boiler plate so
41
+ * these tools can reduce the boiler plate and increase readability.
42
+ *
43
+ * @name DescriptorUtils
44
+ * @typedef {DescriptorUtils}
45
+ */
46
+ export const DescriptorUtils = {
47
+ /**
48
+ * Creates an accessor descriptor object
49
+ *
50
+ * This function has multiple possible overloads
51
+ *
52
+ * ```markdown
53
+ * _**zeroFn** is a function that takes no parameters_
54
+ * _**oneFn** is a function that takes a single parameter_
55
+ * _**oneOrNone** is a either a function that takes a single parameter or nullish_
56
+ * _**nonFn** is any value that is not a function_
57
+ * _**nullish** is either null or undefined_
58
+ * _**...** means configurable?, enumerable?, storage?, key? liaison? as
59
+ * subsequent following parameters in that order_
60
+ *
61
+ * **accessor()**
62
+ * creates a storage backed accessor that is both read and write.
63
+ * The storage object will be a provided empty object with the key
64
+ * being 'value'. Configurable and enumerable flags will be set to
65
+ * `true`.
66
+ *
67
+ * **accessor(options)**
68
+ * this single argument variant of accessor() consists of a single
69
+ * options object. If neither `get` nor `set` are provided, a
70
+ * storage backed read-write accessor with undefined as the initial
71
+ * value will be constructed.
72
+ *
73
+ * **accessor(nonFn)**
74
+ * **accessor(any, true, options?)**
75
+ * **accessor(any, true, ...)**
76
+ * supplying only a non-function only parameter or any value and the
77
+ * value `true` as the second parameter, you will get a read-write
78
+ * accessor stored in the default or specified storage. The resultant
79
+ * initial value will be whatever is provided as the first parameter.
80
+ * See options to customize `configurable`, `enumerable`, `storage`,
81
+ * `key` and the `liaison` factory function.
82
+ *
83
+ * **accessor(any, false, options?)**
84
+ * **accessor(any, false, ...)**
85
+ * supplying only a non-function only parameter or any value and the
86
+ * value `false` as the second parameter, you will get a read-only
87
+ * getter stored in the default or specified storage. The resultant
88
+ * value will be whatever is provided as the first parameter.
89
+ * See options to customize `configurable`, `enumerable`, `storage`,
90
+ * `key` and the `liaison` factory function.
91
+ *
92
+ * **accessor(zeroFn)**
93
+ * **accessor(zeroFn, nullish, options?)**
94
+ * **accessor(zeroFn, nullish, ...)**
95
+ * creates a generic read-only accessor with the first no-argument
96
+ * function parameter being the getter and either null or undefined
97
+ * for the setter. Either an options object or the manually ordered
98
+ * parameters can optionally follow if a nullish value for setter
99
+ * is provided.
100
+ *
101
+ * **accessor(zeroFn, oneOrNone, options?)**
102
+ * **accessor(zeroFn, oneOrNone, ...)**
103
+ * creates a generic read-write accessor with the first no-argument
104
+ * function parameter being the getter and the second single-argument
105
+ * function parameter being the setter. Either an options object or
106
+ * the manually ordered parameters can optionally follow.
107
+ *
108
+ * **accessor(oneFn, oneFn, options?)**
109
+ * **accessor(oneFn, oneFn, ...)**
110
+ * this special variant of the accessor() invocation, allows a single
111
+ * argument getter and setter factory to be supplied. These will
112
+ * automatically be invoked with the specified or default storage
113
+ * object. The result of the getter factory should be a no argument
114
+ * function. And the result of the setter factory should be a single
115
+ * argument function. The options for `liaison` and `key` will be
116
+ * ignored and should be handled specifically in the factory
117
+ * functions to suit your own use case.
118
+ * ```
119
+ *
120
+ * Options are an object oriented way of supplying the alternate
121
+ * flags to the data descriptor. They are
122
+ *
123
+ * • `get` - only referenced when an options object is the only parameter
124
+ * • `set` - only referenced when an options object is the only parameter
125
+ * • `configurable` - if true, the descriptor of the object that this
126
+ * accessor descriptor represents can be redefined at later time by
127
+ * subsequent calls to {@link Object.defineProperty} or
128
+ * {@link Object.defineProperties}
129
+ * • `enumerable` - if true, enumeration over the object this
130
+ * descriptor is applied to, will show the property
131
+ * represented by this descriptor. See the associated MDN
132
+ * page regarding this {@link PropertyDescriptor} if you
133
+ * want to know more.
134
+ * • `storage` - an object, usually {@link Object} or {@link Map} or
135
+ * nullish if unused
136
+ * • `key` - a {@link PropertyKey} of your choosing or the default
137
+ * string `"value"`
138
+ * • `bind` - true if you wish to have the `storage` object bound as
139
+ * the `thisObj` for both the `get` and `set` functions when
140
+ * storage is used. **note* this will not work if you supply a
141
+ * big arrow function for the accessor function in question. This
142
+ * defaults to `false`.
143
+ * • `liaison` - an optional factory function that must return an
144
+ * object with two properties. The first is a `get()` function that
145
+ * returns a value and the second is a `set(value)` function that
146
+ * stores a value. The factory function receives `storage` and
147
+ * `key`, in that order. The default uses {@link Map.get} and
148
+ * {@link Map.set} if the storage is an instance of {@link Map}.
149
+ * Otherwise, the typical `object[key]` format is used if the
150
+ * storage object is an instanceof {@link Object}
151
+ *
152
+ * @param {(object|any)?} value the JavaScript value representing
153
+ * this descriptor's value or an options object if it is the
154
+ * only parameter.
155
+ * @param {(object|boolean)?} optionsOrConfigurable true or false if
156
+ * you wish the `configurable` flag to be set. Optionally supply an
157
+ * object with one of the supported options to configure the run
158
+ * of the function.
159
+ * @param {boolean?} enumerable true or false if you wish to
160
+ * configure the `.enumerable` property of the descriptor
161
+ * @param {object?} storage an object upon which data storage should
162
+ * be written to and read from. Defaults to an empty {@link Object}
163
+ * when storage is needed and not supplied via this parameter or
164
+ * an options object.
165
+ * @param {PropertyKey?} key the key used to store content on the
166
+ * storage object.
167
+ * @param {(object, PropertyKey) => { get: ()=>any, set: (v)=>void}} liaison
168
+ * an optional function that, given a storage object and property key,
169
+ * returns an object with a no argument `get()` function that returns
170
+ * the value on the storage object with a given key and a single argument
171
+ * `set(value)` function that stores a new value using the property key
172
+ * on the supplied storage object. This exists because access to a
173
+ * {@link Map} and {@link Object} values are handled differently. If you
174
+ * need support for some other class than `Map` or `Object` then you
175
+ * should provide a liaison function to define access.
176
+ *
177
+ * @returns {PropertyDescriptor}
178
+ *
179
+ * @see {@link PropertyDescriptor}
180
+ * @note More info on this can be found at the
181
+ * [MDN Object.defineProperty/ies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty)
182
+ * page
183
+ *
184
+ * @type {Function & { keys: string[] }}
185
+ */
186
+ get accessor() {
187
+ function accessor(get, set, optionsOrConfigurable = true, enumerable = true, storage, key = 'value', liaison) {
188
+ const count = arguments.length;
189
+ const storageKeys = ['storage', 'key', 'liaison', 'initial', 'bind'];
190
+ const optionKeys = [
191
+ // accessor functions
192
+ 'get', 'set',
193
+ // descriptor flags
194
+ 'configurable', 'enumerable',
195
+ // storage configuration keys
196
+ ...storageKeys
197
+ ];
198
+ const has = (object, key) => isObject(object) && Reflect.has(object, key);
199
+ const isOpts = object => optionKeys.some(key => has(object, key));
200
+ let configurable = !!optionsOrConfigurable;
201
+ let initial = undefined;
202
+ let bind = false;
203
+ let options = {};
204
+ if (count === 1 && isObject(get) && hasSome(get, ...optionKeys)) {
205
+ options = { ...get };
206
+ ({ get, set } = get);
207
+ }
208
+ if (isObject(optionsOrConfigurable) || isObject(set)) {
209
+ options = isObject(set) && count === 2
210
+ ? { ...set }
211
+ : { ...optionsOrConfigurable };
212
+ ({ configurable, enumerable, storage, key, bind, initial } = options);
213
+ }
214
+ liaison = options?.liaison ?? liaison ?? ((storage, key) => ({
215
+ get() {
216
+ if (storage instanceof Map)
217
+ return storage.get(key);
218
+ else if (isObject(storage))
219
+ return storage[key];
220
+ },
221
+ set(value) {
222
+ if (storage instanceof Map)
223
+ storage.set(key, value);
224
+ else if (isObject(storage))
225
+ storage[key] = value;
226
+ }
227
+ }));
228
+ configurable = configurable ?? true;
229
+ enumerable = enumerable ?? true;
230
+ key = key ?? 'value';
231
+ bind = bind ?? false;
232
+ const yesFn = (value) => typeof value === 'function';
233
+ const zeroFn = (value) => (yesFn(value) && value.length === 0);
234
+ const oneFn = (value) => (yesFn(value) && value.length === 1);
235
+ const isTrue = (value) => value === true;
236
+ const isFalse = (value) => value === false;
237
+ const addRefs = (fn, value) => Object.defineProperties(fn, {
238
+ storage: { value, configurable: true, enumerable: true },
239
+ key: { value: key, configurable: true, enumerable: true },
240
+ });
241
+ if (count === 0 || (!get && !set)) {
242
+ storage = { [key]: initial };
243
+ const _ = liaison(storage, key);
244
+ get = addRefs(function () { return _.get(); }, storage);
245
+ set = addRefs(function (value) { _.set(value); }, storage);
246
+ return { get, set, configurable, enumerable };
247
+ }
248
+ if (count === 1 && oneFn(get)) {
249
+ set = false;
250
+ }
251
+ if (isTrue(set) || isFalse(set)) {
252
+ storage = { [key]: get };
253
+ const _ = liaison(storage, key);
254
+ let _get = function () { return _.get(); };
255
+ let _set = function (value) { _.set(value); };
256
+ if (bind) {
257
+ _get = _get.bind(storage);
258
+ _set = _set.bind(storage);
259
+ }
260
+ get = addRefs(_get, storage);
261
+ set = addRefs(_set, storage);
262
+ return {
263
+ get,
264
+ set: isFalse(set) ? undefined : set,
265
+ configurable,
266
+ enumerable
267
+ };
268
+ }
269
+ if ((zeroFn(get) && !set) || (zeroFn(get) && oneFn(set))) {
270
+ const descriptor = { get, set, configurable, enumerable };
271
+ if (isObject(options) && Reflect.has(options, 'initial'))
272
+ descriptor.set(initial);
273
+ return descriptor;
274
+ }
275
+ if (oneFn(get) && oneFn(set)) {
276
+ storage = storage || {};
277
+ let _get = get(storage);
278
+ let _set = set(storage);
279
+ if (bind) {
280
+ _get = _get.bind(storage);
281
+ _set = _set.bind(storage);
282
+ }
283
+ return {
284
+ get: addRefs(_get, storage),
285
+ set: addRefs(_set, storage),
286
+ configurable,
287
+ enumerable,
288
+ };
289
+ }
290
+ return { get, set, configurable, enumerable };
291
+ }
292
+ Object.defineProperty(accessor, 'keys', {
293
+ get() { return ['get', 'set', 'configurable', 'enumerable']; },
294
+ configurable: true,
295
+ enumerable: true,
296
+ });
297
+ return accessor;
298
+ },
299
+ /**
300
+ * Creates a data descriptor object
301
+ *
302
+ * This function has multiple possible overloads
303
+ *
304
+ * ```markdown
305
+ * **data()**
306
+ * creates a data descriptor with a value of `undefined` that
307
+ * is writable, configurable and enumerable.
308
+ *
309
+ * **data(options)**
310
+ * if the only parameter is an object and that object contains
311
+ * at least a `.value` property, this funtion will return a
312
+ * data descriptor with the associated values. This variant
313
+ * is useful if you want to extract the normal data descriptor
314
+ * properties: value, writable, configurable and/or enumerable
315
+ * from an object that has properties with these names, in
316
+ * addition to other properties or functions. Note that if you
317
+ * wish for the value of the descriptor to be an object that
318
+ * also contains a `.value` property, use `data({value: obj})`
319
+ * instead.
320
+ *
321
+ * **data(value)**
322
+ * **data(value, options?)**
323
+ * creates a data descriptor from the supplied `value`,
324
+ * optionally augmented by additional `options`. The defaults
325
+ * for this writable, configurable and enumerable values set
326
+ * to `true`
327
+ *
328
+ * **data(value, writable?, configurable?, enumerable?)**
329
+ * if writable, configurable or enumerable or true or false
330
+ * then this function creates a data descriptor with those
331
+ * flags and the supplied value (there's no real reason to
332
+ * invoke this function if you're supplying all four values)
333
+ * ```
334
+ *
335
+ * Options are an object oriented way of supplying the alternate
336
+ * flags to the data descriptor. They are
337
+ *
338
+ * • `value` - only referenced when an options object is the
339
+ * only parameter
340
+ * • `writable` - true if the value represented by this data
341
+ * descriptor can be reassigned a new value.
342
+ * • `configurable` - if true, the descriptor of the object
343
+ * that this data descriptor represents can be redefined at
344
+ * later time by subsequent calls to `Object.defineProperty`
345
+ * or `Object.defineProperties`. If `.configurable` is true
346
+ * this can be done even if `.writable` is set to false
347
+ * • `enumerable` - if true, enumeration over the object this
348
+ * descriptor is applied to, will show the property
349
+ * represented by this descriptor. See the associated MDN
350
+ * page regarding this `PropertyDescriptor` if you want to
351
+ * know more.
352
+ *
353
+ * @param {(object|any)?} value the JavaScript value representing
354
+ * this descriptor's value or an options object if it is the
355
+ * only parameter.
356
+ * @param {(object|boolean)?} optionsOrWritable true or false if
357
+ * you wish the writable flag to be set. Optionally supply an
358
+ * object with one of the supported options to configure the run
359
+ * of the function.
360
+ * @param {boolean?} configurable true or false if you wish to
361
+ * configure the `.configurable` property of the descriptor
362
+ * @param {boolean?} enumerable true or false if you wish to
363
+ * configure the `.enumerable` property of the descriptor
364
+ * @returns {PropertyDescriptor}
365
+ *
366
+ * @note More info on this can be found at the
367
+ * [MDN Object.defineProperty/ies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty)
368
+ * page
369
+ *
370
+ * @type {Function & { keys: string[] }}
371
+ */
372
+ get data() {
373
+ function data(value, optionsOrWritable, configurable, enumerable) {
374
+ if (arguments.length === 0) {
375
+ return {
376
+ value: undefined,
377
+ writable: true,
378
+ configurable: true,
379
+ enumerable: true
380
+ };
381
+ }
382
+ let writable = isObject(optionsOrWritable)
383
+ ? !!optionsOrWritable // further defined below
384
+ : true;
385
+ let options = typeof optionsOrWritable === 'boolean'
386
+ ? {}
387
+ : optionsOrWritable;
388
+ configurable = configurable ?? true;
389
+ enumerable = enumerable ?? true;
390
+ if (isObject(value) && hasSome(value, 'value')) {
391
+ options = value;
392
+ ({ value } = value);
393
+ }
394
+ if (isObject(optionsOrWritable)) {
395
+ ({ writable, configurable, enumerable } = {
396
+ ...{ writable: true, configurable: true, enumerable: true, },
397
+ ...optionsOrWritable
398
+ });
399
+ }
400
+ return { value, writable, configurable, enumerable };
401
+ }
402
+ Object.defineProperty(data, 'keys', {
403
+ value: ['value', 'writable', 'configurable', 'enumerable'],
404
+ writable: false,
405
+ configurable: true,
406
+ enumerable: true
407
+ });
408
+ return data;
409
+ },
410
+ /**
411
+ * A function that, given a value that might be a `PropertyDescriptor`,
412
+ * calculates a deterministic probability that the supplied value is
413
+ * an object that either is a `PropertyDescriptor` or that can function
414
+ * as one.
415
+ *
416
+ * @param {unknown} value a JavaScript value that might be a
417
+ * `PropertyDescriptor` type.
418
+ * @param {boolean?} returnStats if this value is true, instead of returning
419
+ * a determined boolean value indicating the supplied value might be a
420
+ * `PropertyDescriptor`, an object containing the determined flags and score
421
+ * the led to the determination instead is returned.
422
+ * @param {boolean?} strict if this value is `true`, which is the default,
423
+ * then the function will not allow descriptor compatible objects, rather it
424
+ * will only return true if the object has keys that belong in a descriptor
425
+ * and do not form an invalid combination.
426
+ * @returns {IsDescriptorResponse} if `returnStats` is `true`
427
+ * an object of type {@link IsDescriptorStats} is returned. This object
428
+ * will have a lot of {@link Boolean} flags pertaining to the `true`/`false`
429
+ * evaluation. If `returnStats` is `false`, then a boolean value denoting
430
+ * whether or not the value is a {@link PropertyDescriptor} is returned
431
+ * instead. This is effectively the same as the `isValid` parameter from the
432
+ * stats block.
433
+ */
434
+ isDescriptor(value, returnStats = false, strict = true) {
435
+ if (!value || typeof value !== 'object' || !(value instanceof Object))
436
+ return false;
437
+ const areBools = (...props) => props.flat().every(prop => boolTypes.includes(typeof value[prop]));
438
+ const areFuncs = (...props) => props.flat().every(prop => funcTypes.includes(typeof value[prop]));
439
+ const hasKeyFn = (property) => Reflect.has(value, property);
440
+ const isOfType = (type) => (element) => typeof element === type;
441
+ const baseProps = ['configurable', 'enumerable'];
442
+ const dataProps = ['value', 'writable'];
443
+ const accessorProps = ['get', 'set'];
444
+ const anyDescProps = [...baseProps, ...dataProps, ...accessorProps];
445
+ const boolTypes = ['undefined', 'boolean'];
446
+ const funcTypes = ['undefined', 'function'];
447
+ const stats = {
448
+ confidence: 0,
449
+ hasAccessorKeys: false,
450
+ hasBaseDescriptorKeys: false,
451
+ hasDataKeys: false,
452
+ isAccessor: false,
453
+ isData: false,
454
+ isValid: false,
455
+ };
456
+ let score = 0;
457
+ if (value && typeof value === 'object') {
458
+ const objKeys = Reflect.ownKeys(value);
459
+ const nonDescKeys = objKeys.filter(k => !(anyDescProps.includes(k)));
460
+ if (strict && nonDescKeys.length)
461
+ return false;
462
+ if (objKeys.length <= 4)
463
+ score++;
464
+ stats.hasAccessorKeys =
465
+ accessorProps.some(hasKeyFn) && areFuncs(accessorProps);
466
+ stats.hasDataKeys =
467
+ dataProps.some(hasKeyFn) && areBools('writable');
468
+ stats.hasBaseDescriptorKeys =
469
+ baseProps.some(hasKeyFn) && areBools(baseProps);
470
+ if (stats.hasBaseDescriptorKeys)
471
+ score++;
472
+ if (stats.hasAccessorKeys || stats.hasDataKeys)
473
+ score++;
474
+ if (score > 0)
475
+ stats.isValid = true;
476
+ if (score > 0 && stats.hasAccessorKeys)
477
+ stats.isAccessor = true;
478
+ if (score > 0 && stats.hasDataKeys)
479
+ stats.isData = true;
480
+ if (stats.isValid && stats.isData && Reflect.has(value, 'value'))
481
+ score++;
482
+ else if (stats.isValid && stats.isAccessor) {
483
+ if ([value?.get, value?.set].some(isOfType('function')))
484
+ score++;
485
+ }
486
+ if (stats.hasAccessorKeys && stats.hasDataKeys) {
487
+ score = 0;
488
+ stats.isValid = false;
489
+ }
490
+ stats.confidence = parseFloat(score / 4.0);
491
+ }
492
+ if (returnStats)
493
+ return stats;
494
+ return score >= 0.0
495
+ ? true
496
+ : false;
497
+ },
498
+ /**
499
+ * Retrieves the keys associated with accessor descriptors.
500
+ *
501
+ * Accessor descriptors are property descriptors that define
502
+ * getter and/or setter functions for a property.
503
+ *
504
+ * @type {string[]}
505
+ *
506
+ * @example
507
+ * // Example usage:
508
+ * const keys = DescriptorUtils.kAccessorDescriptorKeys
509
+ * console.log(keys) // Output: ['get', 'set']
510
+ */
511
+ get kAccessorDescriptorKeys() {
512
+ return ['get', 'set'];
513
+ },
514
+ /**
515
+ * Retrieves the keys associated with data descriptors.
516
+ *
517
+ * Data descriptors are property descriptors that define a value
518
+ * and optionally a writable attribute for a property.
519
+ *
520
+ * @type {string[]}
521
+ *
522
+ * @example
523
+ * // Example usage:
524
+ * const keys = DescriptorUtils.kDataDescriptorKeys
525
+ * console.log(keys) // Output: ['value', 'writable']
526
+ */
527
+ get kDataDescriptorKeys() {
528
+ return ['value', 'writable'];
529
+ },
530
+ /**
531
+ * Retrieves the keys associated with shared descriptors.
532
+ *
533
+ * Shared descriptors are property descriptors that define
534
+ * common attributes for a property, such as whether the
535
+ * property is configurable or enumerable.
536
+ *
537
+ * @type {string[]}
538
+ *
539
+ * @example
540
+ * // Example usage:
541
+ * const keys = DescriptorUtils.kSharedDescriptorKeys
542
+ * console.log(keys) // Output: ['configurable', 'enumerable']
543
+ */
544
+ get kSharedDescriptorKeys() {
545
+ return ['configurable', 'enumerable'];
546
+ },
547
+ /**
548
+ * Retrieves all descriptor keys, combining accessor, data, and shared
549
+ * descriptor keys.
550
+ *
551
+ * This getter method aggregates keys from accessor descriptors,
552
+ * data descriptors, and shared descriptors into a single array.
553
+ * This can be useful when you need to validate or inspect all
554
+ * possible descriptor keys.
555
+ *
556
+ * @type {string[]}
557
+ *
558
+ * @example
559
+ * // Example usage:
560
+ * const allKeys = DescriptorUtils.kDescriptorKeys
561
+ * console.log(allKeys)
562
+ * // Output: [
563
+ * // 'get', 'set', 'value', 'writable', 'configurable', 'enumerable'
564
+ * // ]
565
+ */
566
+ get kDescriptorKeys() {
567
+ return [
568
+ ...(this.kAccessorDescriptorKeys),
569
+ ...(this.kDataDescriptorKeys),
570
+ ...(this.kSharedDescriptorKeys),
571
+ ];
572
+ }
573
+ };
574
+ // Destructure the functions individually...
575
+ const { accessor, data, isDescriptor } = DescriptorUtils;
576
+ // ...also destructure the constants individually....
577
+ const { kAccessorDescriptorKeys, kDataDescriptorKeys, kDescriptorKeys, kSharedDescriptorKeys } = DescriptorUtils;
578
+ // ... so they can also be individually exported.
579
+ export { accessor, data, isDescriptor, kAccessorDescriptorKeys, kDataDescriptorKeys, kDescriptorKeys, kSharedDescriptorKeys };
580
+ // Provide default exports as well
581
+ export default {
582
+ DescriptorUtils,
583
+ accessor,
584
+ data,
585
+ isDescriptor,
586
+ kAccessorDescriptorKeys,
587
+ kDataDescriptorKeys,
588
+ kDescriptorKeys,
589
+ kSharedDescriptorKeys
590
+ };
591
+ // ---- non-exported helper functions ----
592
+ function isObject(o) { return o && typeof o === 'object'; }
593
+ function isValidKey(o) { return ['string', 'symbol'].some(t => typeof o === t); }
594
+ function hasAll(object, ...keys) { return hasQuantity('every', object, keys); }
595
+ function hasSome(object, ...keys) { return hasQuantity('some', object, keys); }
596
+ function hasQuantity(quantityFn, object, keys) {
597
+ return isObject(object) && (keys.flat(Infinity)
598
+ .map(key => Reflect.has(object, key))[quantityFn](has => has));
599
+ }
600
+ function hasOne(object, ...keys) {
601
+ return isObject(object) && (keys.flat(Infinity)
602
+ .map(key => Reflect.has(object, key))
603
+ .filter(has => has)
604
+ .length === 1);
605
+ }
606
+ //# sourceMappingURL=descriptor.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor.utils.js","sourceRoot":"","sources":["../../../src/utils/descriptor.utils.js"],"names":[],"mappings":"AAAA,kDAAkD;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;;GAKG;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0IG;IACH,IAAI,QAAQ;QACV,SAAS,QAAQ,CACf,GAAG,EACH,GAAG,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