@nejs/basic-extensions 1.7.0 → 1.8.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.
- package/README.md +374 -103
- package/dist/@nejs/basic-extensions.bundle.1.7.0.js +4 -0
- package/dist/@nejs/basic-extensions.bundle.1.7.0.js.map +7 -0
- package/dist/cjs/functionextensions.d.ts +1 -0
- package/dist/cjs/functionextensions.js +128 -18
- package/dist/cjs/functionextensions.js.map +1 -1
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/setextensions.d.ts +2 -0
- package/dist/cjs/setextensions.js +204 -0
- package/dist/cjs/setextensions.js.map +1 -0
- package/dist/mjs/functionextensions.d.ts +1 -0
- package/dist/mjs/functionextensions.js +127 -17
- package/dist/mjs/functionextensions.js.map +1 -1
- package/dist/mjs/index.js +4 -1
- package/dist/mjs/index.js.map +1 -1
- package/dist/mjs/setextensions.d.ts +2 -0
- package/dist/mjs/setextensions.js +201 -0
- package/dist/mjs/setextensions.js.map +1 -0
- package/docs/index.html +5020 -3328
- package/package.json +6 -3
- package/src/functionextensions.js +150 -24
- package/src/index.js +4 -1
- package/src/setextensions.js +242 -0
- package/tests/setextensions.test.js +89 -0
- package/dist/@nejs/basic-extensions.bundle.1.6.1.js +0 -4
- package/dist/@nejs/basic-extensions.bundle.1.6.1.js.map +0 -7
package/README.md
CHANGED
|
@@ -56,120 +56,148 @@ import { FunctionExtensions } from '@nejs/basic-extensions';
|
|
|
56
56
|
#### Table of Contents
|
|
57
57
|
|
|
58
58
|
* [FunctionExtensions](#functionextensions)
|
|
59
|
-
* [
|
|
59
|
+
* [isAsync](#isasync)
|
|
60
60
|
* [Parameters](#parameters)
|
|
61
|
-
* [
|
|
61
|
+
* [isAsyncGenerator](#isasyncgenerator)
|
|
62
62
|
* [Parameters](#parameters-1)
|
|
63
|
-
* [isAsync](#isasync)
|
|
64
|
-
* [Parameters](#parameters-2)
|
|
65
63
|
* [isBigArrow](#isbigarrow)
|
|
66
|
-
* [Parameters](#parameters-
|
|
64
|
+
* [Parameters](#parameters-2)
|
|
67
65
|
* [isBound](#isbound)
|
|
66
|
+
* [Parameters](#parameters-3)
|
|
67
|
+
* [isClass](#isclass)
|
|
68
68
|
* [Parameters](#parameters-4)
|
|
69
|
+
* [isFunction](#isfunction)
|
|
70
|
+
* [Parameters](#parameters-5)
|
|
71
|
+
* [isGenerator](#isgenerator)
|
|
72
|
+
* [Parameters](#parameters-6)
|
|
73
|
+
* [isAsync](#isasync-1)
|
|
74
|
+
* [isAsyncGenerator](#isasyncgenerator-1)
|
|
75
|
+
* [isBigArrow](#isbigarrow-1)
|
|
76
|
+
* [isBound](#isbound-1)
|
|
77
|
+
* [isClass](#isclass-1)
|
|
78
|
+
* [isFunction](#isfunction-1)
|
|
79
|
+
* [isGenerator](#isgenerator-1)
|
|
69
80
|
* [ObjectExtensions](#objectextensions)
|
|
70
81
|
* [isNullDefined](#isnulldefined)
|
|
71
|
-
* [Parameters](#parameters-
|
|
82
|
+
* [Parameters](#parameters-7)
|
|
72
83
|
* [hasStringTag](#hasstringtag)
|
|
73
|
-
* [Parameters](#parameters-
|
|
84
|
+
* [Parameters](#parameters-8)
|
|
74
85
|
* [getStringTag](#getstringtag)
|
|
75
|
-
* [Parameters](#parameters-
|
|
86
|
+
* [Parameters](#parameters-9)
|
|
76
87
|
* [getType](#gettype)
|
|
77
|
-
* [Parameters](#parameters-
|
|
88
|
+
* [Parameters](#parameters-10)
|
|
78
89
|
* [isObject](#isobject)
|
|
79
|
-
* [Parameters](#parameters-
|
|
90
|
+
* [Parameters](#parameters-11)
|
|
80
91
|
* [isPrimitive](#isprimitive)
|
|
81
|
-
* [Parameters](#parameters-
|
|
92
|
+
* [Parameters](#parameters-12)
|
|
82
93
|
* [isValidKey](#isvalidkey)
|
|
83
|
-
* [Parameters](#parameters-
|
|
94
|
+
* [Parameters](#parameters-13)
|
|
84
95
|
* [stripTo](#stripto)
|
|
85
|
-
* [Parameters](#parameters-
|
|
96
|
+
* [Parameters](#parameters-14)
|
|
86
97
|
* [stripTo](#stripto-1)
|
|
87
|
-
* [Parameters](#parameters-
|
|
98
|
+
* [Parameters](#parameters-15)
|
|
88
99
|
* [getKey](#getkey)
|
|
89
|
-
* [Parameters](#parameters-
|
|
100
|
+
* [Parameters](#parameters-16)
|
|
101
|
+
* [concat](#concat)
|
|
102
|
+
* [Parameters](#parameters-17)
|
|
103
|
+
* [contains](#contains)
|
|
104
|
+
* [Parameters](#parameters-18)
|
|
105
|
+
* [every](#every)
|
|
106
|
+
* [Parameters](#parameters-19)
|
|
107
|
+
* [find](#find)
|
|
108
|
+
* [Parameters](#parameters-20)
|
|
109
|
+
* [findLast](#findlast)
|
|
110
|
+
* [Parameters](#parameters-21)
|
|
111
|
+
* [length](#length)
|
|
112
|
+
* [map](#map)
|
|
113
|
+
* [Parameters](#parameters-22)
|
|
114
|
+
* [reduce](#reduce)
|
|
115
|
+
* [Parameters](#parameters-23)
|
|
116
|
+
* [some](#some)
|
|
117
|
+
* [Parameters](#parameters-24)
|
|
90
118
|
* [ReflectExtensions](#reflectextensions)
|
|
91
119
|
* [hasAll](#hasall)
|
|
92
|
-
* [Parameters](#parameters-
|
|
120
|
+
* [Parameters](#parameters-25)
|
|
93
121
|
* [ownDescriptors](#owndescriptors)
|
|
94
|
-
* [Parameters](#parameters-
|
|
122
|
+
* [Parameters](#parameters-26)
|
|
95
123
|
* [hasSome](#hassome)
|
|
96
|
-
* [Parameters](#parameters-
|
|
124
|
+
* [Parameters](#parameters-27)
|
|
97
125
|
* [entries](#entries)
|
|
98
|
-
* [Parameters](#parameters-
|
|
126
|
+
* [Parameters](#parameters-28)
|
|
99
127
|
* [values](#values)
|
|
100
|
-
* [Parameters](#parameters-
|
|
128
|
+
* [Parameters](#parameters-29)
|
|
101
129
|
* [StringExtensions](#stringextensions)
|
|
102
130
|
* [isString](#isstring)
|
|
103
|
-
* [Parameters](#parameters-
|
|
131
|
+
* [Parameters](#parameters-30)
|
|
104
132
|
* [SymbolExtensions](#symbolextensions)
|
|
105
133
|
* [isSymbol](#issymbol)
|
|
106
|
-
* [Parameters](#parameters-
|
|
134
|
+
* [Parameters](#parameters-31)
|
|
107
135
|
* [isRegistered](#isregistered)
|
|
108
|
-
* [Parameters](#parameters-
|
|
136
|
+
* [Parameters](#parameters-32)
|
|
109
137
|
* [isNonRegistered](#isnonregistered)
|
|
110
|
-
* [Parameters](#parameters-
|
|
138
|
+
* [Parameters](#parameters-33)
|
|
111
139
|
* [ArrayPrototypeExtensions](#arrayprototypeextensions)
|
|
112
|
-
* [contains](#contains)
|
|
113
|
-
* [Parameters](#parameters-
|
|
140
|
+
* [contains](#contains-1)
|
|
141
|
+
* [Parameters](#parameters-34)
|
|
114
142
|
* [findEntry](#findentry)
|
|
115
|
-
* [Parameters](#parameters-
|
|
143
|
+
* [Parameters](#parameters-35)
|
|
116
144
|
* [first](#first)
|
|
117
145
|
* [last](#last)
|
|
118
146
|
* [object](#object)
|
|
119
147
|
* [constructor](#constructor)
|
|
120
|
-
* [Parameters](#parameters-
|
|
148
|
+
* [Parameters](#parameters-36)
|
|
121
149
|
* [isAccessor](#isaccessor)
|
|
122
150
|
* [isData](#isdata)
|
|
123
151
|
* [isDescriptor](#isdescriptor)
|
|
124
152
|
* [configurable](#configurable)
|
|
125
153
|
* [configurable](#configurable-1)
|
|
126
|
-
* [Parameters](#parameters-
|
|
154
|
+
* [Parameters](#parameters-37)
|
|
127
155
|
* [enumerable](#enumerable)
|
|
128
156
|
* [enumerable](#enumerable-1)
|
|
129
|
-
* [Parameters](#parameters-
|
|
157
|
+
* [Parameters](#parameters-38)
|
|
130
158
|
* [writable](#writable)
|
|
131
159
|
* [writable](#writable-1)
|
|
132
|
-
* [Parameters](#parameters-
|
|
160
|
+
* [Parameters](#parameters-39)
|
|
133
161
|
* [value](#value)
|
|
134
162
|
* [value](#value-1)
|
|
135
|
-
* [Parameters](#parameters-
|
|
163
|
+
* [Parameters](#parameters-40)
|
|
136
164
|
* [get](#get)
|
|
137
165
|
* [get](#get-1)
|
|
138
|
-
* [Parameters](#parameters-
|
|
166
|
+
* [Parameters](#parameters-41)
|
|
139
167
|
* [boundGet](#boundget)
|
|
140
168
|
* [set](#set)
|
|
141
169
|
* [set](#set-1)
|
|
142
|
-
* [Parameters](#parameters-
|
|
170
|
+
* [Parameters](#parameters-42)
|
|
143
171
|
* [boundSet](#boundset)
|
|
144
172
|
* [hasObject](#hasobject)
|
|
145
173
|
* [object](#object-1)
|
|
146
174
|
* [object](#object-2)
|
|
147
|
-
* [Parameters](#parameters-
|
|
175
|
+
* [Parameters](#parameters-43)
|
|
148
176
|
* [for](#for)
|
|
149
|
-
* [Parameters](#parameters-
|
|
177
|
+
* [Parameters](#parameters-44)
|
|
150
178
|
* [applyTo](#applyto)
|
|
151
|
-
* [Parameters](#parameters-
|
|
179
|
+
* [Parameters](#parameters-45)
|
|
152
180
|
* [toPrimitive](#toprimitive)
|
|
153
|
-
* [Parameters](#parameters-
|
|
181
|
+
* [Parameters](#parameters-46)
|
|
154
182
|
* [toStringTag](#tostringtag)
|
|
155
183
|
* [for](#for-1)
|
|
156
|
-
* [Parameters](#parameters-
|
|
184
|
+
* [Parameters](#parameters-47)
|
|
157
185
|
* [getData](#getdata)
|
|
158
|
-
* [Parameters](#parameters-
|
|
186
|
+
* [Parameters](#parameters-48)
|
|
159
187
|
* [getAccessor](#getaccessor)
|
|
160
|
-
* [Parameters](#parameters-
|
|
188
|
+
* [Parameters](#parameters-49)
|
|
161
189
|
* [base](#base)
|
|
162
|
-
* [Parameters](#parameters-
|
|
190
|
+
* [Parameters](#parameters-50)
|
|
163
191
|
* [accessor](#accessor)
|
|
164
|
-
* [Parameters](#parameters-
|
|
192
|
+
* [Parameters](#parameters-51)
|
|
165
193
|
* [data](#data)
|
|
166
|
-
* [Parameters](#parameters-
|
|
194
|
+
* [Parameters](#parameters-52)
|
|
167
195
|
* [isDescriptor](#isdescriptor-1)
|
|
168
|
-
* [Parameters](#parameters-
|
|
196
|
+
* [Parameters](#parameters-53)
|
|
169
197
|
* [isData](#isdata-1)
|
|
170
|
-
* [Parameters](#parameters-
|
|
198
|
+
* [Parameters](#parameters-54)
|
|
171
199
|
* [isAccessor](#isaccessor-1)
|
|
172
|
-
* [Parameters](#parameters-
|
|
200
|
+
* [Parameters](#parameters-55)
|
|
173
201
|
* [flexible](#flexible)
|
|
174
202
|
* [enigmatic](#enigmatic)
|
|
175
203
|
* [intrinsic](#intrinsic)
|
|
@@ -178,85 +206,85 @@ import { FunctionExtensions } from '@nejs/basic-extensions';
|
|
|
178
206
|
* [ACCESSOR\_KEYS](#accessor_keys)
|
|
179
207
|
* [DATA\_KEYS](#data_keys)
|
|
180
208
|
* [maskAs](#maskas)
|
|
181
|
-
* [Parameters](#parameters-
|
|
209
|
+
* [Parameters](#parameters-56)
|
|
182
210
|
* [maskAsString](#maskasstring)
|
|
183
|
-
* [Parameters](#parameters-
|
|
211
|
+
* [Parameters](#parameters-57)
|
|
184
212
|
* [maskAsNumber](#maskasnumber)
|
|
185
|
-
* [Parameters](#parameters-
|
|
213
|
+
* [Parameters](#parameters-58)
|
|
186
214
|
* [GenericMask](#genericmask)
|
|
187
|
-
* [Parameters](#parameters-
|
|
215
|
+
* [Parameters](#parameters-59)
|
|
188
216
|
* [StringMask](#stringmask)
|
|
189
|
-
* [Parameters](#parameters-
|
|
217
|
+
* [Parameters](#parameters-60)
|
|
190
218
|
* [NumberMask](#numbermask)
|
|
191
|
-
* [Parameters](#parameters-
|
|
219
|
+
* [Parameters](#parameters-61)
|
|
192
220
|
* [RefSet](#refset)
|
|
193
221
|
* [objectifying](#objectifying)
|
|
194
|
-
* [Parameters](#parameters-
|
|
222
|
+
* [Parameters](#parameters-62)
|
|
195
223
|
* [objectifyValues](#objectifyvalues)
|
|
196
224
|
* [objectifyValues](#objectifyvalues-1)
|
|
197
|
-
* [Parameters](#parameters-
|
|
225
|
+
* [Parameters](#parameters-63)
|
|
198
226
|
* [add](#add)
|
|
199
|
-
* [Parameters](#parameters-
|
|
227
|
+
* [Parameters](#parameters-64)
|
|
200
228
|
* [addAll](#addall)
|
|
201
|
-
* [Parameters](#parameters-
|
|
229
|
+
* [Parameters](#parameters-65)
|
|
202
230
|
* [clean](#clean)
|
|
203
231
|
* [entries](#entries-1)
|
|
204
|
-
* [Parameters](#parameters-
|
|
232
|
+
* [Parameters](#parameters-66)
|
|
205
233
|
* [forEach](#foreach)
|
|
206
|
-
* [Parameters](#parameters-
|
|
234
|
+
* [Parameters](#parameters-67)
|
|
207
235
|
* [values](#values-1)
|
|
208
236
|
* [keys](#keys)
|
|
209
237
|
* [has](#has)
|
|
210
|
-
* [Parameters](#parameters-
|
|
211
|
-
* [contains](#contains-
|
|
212
|
-
* [Parameters](#parameters-
|
|
238
|
+
* [Parameters](#parameters-68)
|
|
239
|
+
* [contains](#contains-2)
|
|
240
|
+
* [Parameters](#parameters-69)
|
|
213
241
|
* [filter](#filter)
|
|
214
|
-
* [Parameters](#parameters-
|
|
215
|
-
* [find](#find)
|
|
216
|
-
* [Parameters](#parameters-
|
|
217
|
-
* [map](#map)
|
|
218
|
-
* [Parameters](#parameters-
|
|
242
|
+
* [Parameters](#parameters-70)
|
|
243
|
+
* [find](#find-1)
|
|
244
|
+
* [Parameters](#parameters-71)
|
|
245
|
+
* [map](#map-1)
|
|
246
|
+
* [Parameters](#parameters-72)
|
|
219
247
|
* [toStringTag](#tostringtag-1)
|
|
220
248
|
* [RefMap](#refmap)
|
|
221
|
-
* [Parameters](#parameters-
|
|
249
|
+
* [Parameters](#parameters-73)
|
|
222
250
|
* [objectifying](#objectifying-1)
|
|
223
|
-
* [Parameters](#parameters-
|
|
251
|
+
* [Parameters](#parameters-74)
|
|
224
252
|
* [asObject](#asobject)
|
|
225
253
|
* [objectifyValues](#objectifyvalues-2)
|
|
226
254
|
* [objectifyValues](#objectifyvalues-3)
|
|
227
|
-
* [Parameters](#parameters-
|
|
255
|
+
* [Parameters](#parameters-75)
|
|
228
256
|
* [get](#get-2)
|
|
229
|
-
* [Parameters](#parameters-
|
|
257
|
+
* [Parameters](#parameters-76)
|
|
230
258
|
* [set](#set-2)
|
|
231
|
-
* [Parameters](#parameters-
|
|
259
|
+
* [Parameters](#parameters-77)
|
|
232
260
|
* [setAll](#setall)
|
|
233
|
-
* [Parameters](#parameters-
|
|
261
|
+
* [Parameters](#parameters-78)
|
|
234
262
|
* [clean](#clean-1)
|
|
235
263
|
* [entries](#entries-2)
|
|
236
|
-
* [Parameters](#parameters-
|
|
264
|
+
* [Parameters](#parameters-79)
|
|
237
265
|
* [forEach](#foreach-1)
|
|
238
|
-
* [Parameters](#parameters-
|
|
266
|
+
* [Parameters](#parameters-80)
|
|
239
267
|
* [values](#values-2)
|
|
240
268
|
* [hasValue](#hasvalue)
|
|
241
|
-
* [Parameters](#parameters-
|
|
269
|
+
* [Parameters](#parameters-81)
|
|
242
270
|
* [filter](#filter-1)
|
|
243
|
-
* [Parameters](#parameters-
|
|
244
|
-
* [find](#find-
|
|
245
|
-
* [Parameters](#parameters-
|
|
246
|
-
* [map](#map-
|
|
247
|
-
* [Parameters](#parameters-
|
|
271
|
+
* [Parameters](#parameters-82)
|
|
272
|
+
* [find](#find-2)
|
|
273
|
+
* [Parameters](#parameters-83)
|
|
274
|
+
* [map](#map-2)
|
|
275
|
+
* [Parameters](#parameters-84)
|
|
248
276
|
* [iterator](#iterator)
|
|
249
277
|
* [toStringTag](#tostringtag-2)
|
|
250
278
|
* [isValidReference](#isvalidreference)
|
|
251
|
-
* [Parameters](#parameters-
|
|
279
|
+
* [Parameters](#parameters-85)
|
|
252
280
|
* [AsyncIterable](#asynciterable)
|
|
253
|
-
* [Parameters](#parameters-
|
|
281
|
+
* [Parameters](#parameters-86)
|
|
254
282
|
* [asyncIterator](#asynciterator)
|
|
255
283
|
* [toStringTag](#tostringtag-3)
|
|
256
284
|
* [isAsyncIterable](#isasynciterable)
|
|
257
|
-
* [Parameters](#parameters-
|
|
285
|
+
* [Parameters](#parameters-87)
|
|
258
286
|
* [AsyncIterator](#asynciterator-1)
|
|
259
|
-
* [Parameters](#parameters-
|
|
287
|
+
* [Parameters](#parameters-88)
|
|
260
288
|
* [asArray](#asarray)
|
|
261
289
|
* [asyncIterable](#asynciterable-1)
|
|
262
290
|
* [next](#next)
|
|
@@ -264,14 +292,14 @@ import { FunctionExtensions } from '@nejs/basic-extensions';
|
|
|
264
292
|
* [asyncIterator](#asynciterator-2)
|
|
265
293
|
* [toStringTag](#tostringtag-4)
|
|
266
294
|
* [Iterable](#iterable)
|
|
267
|
-
* [Parameters](#parameters-
|
|
295
|
+
* [Parameters](#parameters-89)
|
|
268
296
|
* [iterator](#iterator-1)
|
|
269
297
|
* [asArray](#asarray-1)
|
|
270
298
|
* [toStringTag](#tostringtag-5)
|
|
271
299
|
* [isIterable](#isiterable)
|
|
272
|
-
* [Parameters](#parameters-
|
|
300
|
+
* [Parameters](#parameters-90)
|
|
273
301
|
* [Iterator](#iterator-2)
|
|
274
|
-
* [Parameters](#parameters-
|
|
302
|
+
* [Parameters](#parameters-91)
|
|
275
303
|
* [asArray](#asarray-2)
|
|
276
304
|
* [iterable](#iterable-1)
|
|
277
305
|
* [next](#next-1)
|
|
@@ -290,6 +318,63 @@ async functions, and arrow functions in a more intuitive and straightforward
|
|
|
290
318
|
manner. This class is part of the `@nejs/extension` library and enhances the
|
|
291
319
|
capabilities of function handling and introspection in JavaScript.
|
|
292
320
|
|
|
321
|
+
#### isAsync
|
|
322
|
+
|
|
323
|
+
Determines if a given value is an asynchronous function. It checks if the
|
|
324
|
+
value is an instance of `Function` and if its string representation
|
|
325
|
+
includes the keyword 'Async'. This method is particularly useful for
|
|
326
|
+
identifying async functions.
|
|
327
|
+
|
|
328
|
+
##### Parameters
|
|
329
|
+
|
|
330
|
+
* `value` **any** The value to be checked.
|
|
331
|
+
|
|
332
|
+
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns `true` if the value is an async function,
|
|
333
|
+
otherwise `false`.
|
|
334
|
+
|
|
335
|
+
#### isAsyncGenerator
|
|
336
|
+
|
|
337
|
+
The function checks if a given value is an async generator function
|
|
338
|
+
|
|
339
|
+
##### Parameters
|
|
340
|
+
|
|
341
|
+
* `value` **any** The `value` parameter is the value that we want to
|
|
342
|
+
check if it is a generator function.
|
|
343
|
+
|
|
344
|
+
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** `true` if the value is an instance of a function and
|
|
345
|
+
its string tag is 'AsyncGeneratorFunction', otherwise it returns `false`.
|
|
346
|
+
|
|
347
|
+
#### isBigArrow
|
|
348
|
+
|
|
349
|
+
Checks if a given value is an arrow function. It verifies if the value is
|
|
350
|
+
an instance of `Function`, if its string representation includes the '=>'
|
|
351
|
+
symbol, and if it lacks a prototype, which is a characteristic of arrow
|
|
352
|
+
functions in JavaScript.
|
|
353
|
+
|
|
354
|
+
##### Parameters
|
|
355
|
+
|
|
356
|
+
* `value` **any** The value to be checked.
|
|
357
|
+
|
|
358
|
+
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns `true` if the value is an arrow function,
|
|
359
|
+
otherwise `false`.
|
|
360
|
+
|
|
361
|
+
#### isBound
|
|
362
|
+
|
|
363
|
+
Determines if a given value is a bound function. Bound functions are
|
|
364
|
+
created using the `Function.prototype.bind` method, which allows setting
|
|
365
|
+
the `this` value at the time of binding. This method checks if the value
|
|
366
|
+
is an instance of `Function`, if its string representation starts with
|
|
367
|
+
'bound', and if it lacks a `prototype` property. These characteristics
|
|
368
|
+
are indicative of bound functions in JavaScript.
|
|
369
|
+
|
|
370
|
+
##### Parameters
|
|
371
|
+
|
|
372
|
+
* `value` **any** The value to be checked, typically a function.
|
|
373
|
+
|
|
374
|
+
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns `true` if the value is a bound function,
|
|
375
|
+
otherwise `false`. Bound functions have a specific format in their
|
|
376
|
+
string representation and do not have their own `prototype` property.
|
|
377
|
+
|
|
293
378
|
#### isClass
|
|
294
379
|
|
|
295
380
|
Determines if a given value is a class. It checks if the value is an
|
|
@@ -317,35 +402,46 @@ classes, and async functions but excludes arrow functions.
|
|
|
317
402
|
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns `true` if the value is a regular function,
|
|
318
403
|
otherwise `false`.
|
|
319
404
|
|
|
320
|
-
####
|
|
405
|
+
#### isGenerator
|
|
406
|
+
|
|
407
|
+
The function checks if a given value is a generator function
|
|
408
|
+
|
|
409
|
+
##### Parameters
|
|
410
|
+
|
|
411
|
+
* `value` **any** The `value` parameter is the value that we want to
|
|
412
|
+
check if it is a generator function.
|
|
413
|
+
|
|
414
|
+
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** `true` if the value is an instance of a function and
|
|
415
|
+
its string tag is 'GeneratorFunction', otherwise it returns `false`.
|
|
416
|
+
|
|
417
|
+
### isAsync
|
|
321
418
|
|
|
322
419
|
Determines if a given value is an asynchronous function. It checks if the
|
|
323
420
|
value is an instance of `Function` and if its string representation
|
|
324
421
|
includes the keyword 'Async'. This method is particularly useful for
|
|
325
422
|
identifying async functions.
|
|
326
423
|
|
|
327
|
-
##### Parameters
|
|
328
|
-
|
|
329
|
-
* `value` **any** The value to be checked.
|
|
330
|
-
|
|
331
424
|
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns `true` if the value is an async function,
|
|
332
425
|
otherwise `false`.
|
|
333
426
|
|
|
334
|
-
|
|
427
|
+
### isAsyncGenerator
|
|
428
|
+
|
|
429
|
+
The function checks if a given value is an async generator function
|
|
430
|
+
|
|
431
|
+
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** `true` if the value is an instance of a function and
|
|
432
|
+
its string tag is 'AsyncGeneratorFunction', otherwise it returns `false`.
|
|
433
|
+
|
|
434
|
+
### isBigArrow
|
|
335
435
|
|
|
336
436
|
Checks if a given value is an arrow function. It verifies if the value is
|
|
337
437
|
an instance of `Function`, if its string representation includes the '=>'
|
|
338
438
|
symbol, and if it lacks a prototype, which is a characteristic of arrow
|
|
339
439
|
functions in JavaScript.
|
|
340
440
|
|
|
341
|
-
##### Parameters
|
|
342
|
-
|
|
343
|
-
* `value` **any** The value to be checked.
|
|
344
|
-
|
|
345
441
|
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns `true` if the value is an arrow function,
|
|
346
442
|
otherwise `false`.
|
|
347
443
|
|
|
348
|
-
|
|
444
|
+
### isBound
|
|
349
445
|
|
|
350
446
|
Determines if a given value is a bound function. Bound functions are
|
|
351
447
|
created using the `Function.prototype.bind` method, which allows setting
|
|
@@ -354,14 +450,36 @@ is an instance of `Function`, if its string representation starts with
|
|
|
354
450
|
'bound', and if it lacks a `prototype` property. These characteristics
|
|
355
451
|
are indicative of bound functions in JavaScript.
|
|
356
452
|
|
|
357
|
-
##### Parameters
|
|
358
|
-
|
|
359
|
-
* `value` **any** The value to be checked, typically a function.
|
|
360
|
-
|
|
361
453
|
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns `true` if the value is a bound function,
|
|
362
454
|
otherwise `false`. Bound functions have a specific format in their
|
|
363
455
|
string representation and do not have their own `prototype` property.
|
|
364
456
|
|
|
457
|
+
### isClass
|
|
458
|
+
|
|
459
|
+
Determines if a given value is a class. It checks if the value is an
|
|
460
|
+
instance of `Function` and if its string representation includes the
|
|
461
|
+
keyword 'class'. This method is useful for distinguishing classes from
|
|
462
|
+
other function types in JavaScript.
|
|
463
|
+
|
|
464
|
+
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns `true` if the value is a class, otherwise
|
|
465
|
+
`false`.
|
|
466
|
+
|
|
467
|
+
### isFunction
|
|
468
|
+
|
|
469
|
+
Checks if a given value is a regular function. This method verifies if
|
|
470
|
+
the value is an instance of `Function`, which includes regular functions,
|
|
471
|
+
classes, and async functions but excludes arrow functions.
|
|
472
|
+
|
|
473
|
+
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** Returns `true` if the value is a regular function,
|
|
474
|
+
otherwise `false`.
|
|
475
|
+
|
|
476
|
+
### isGenerator
|
|
477
|
+
|
|
478
|
+
The function checks if a given value is a generator function
|
|
479
|
+
|
|
480
|
+
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** `true` if the value is an instance of a function and
|
|
481
|
+
its string tag is 'GeneratorFunction', otherwise it returns `false`.
|
|
482
|
+
|
|
365
483
|
### ObjectExtensions
|
|
366
484
|
|
|
367
485
|
`ObjectExtensions` is a patch for the JavaScript built-in `Object` class.
|
|
@@ -529,6 +647,159 @@ in a map.
|
|
|
529
647
|
Returns **any** the key associated with the given value. If a matching key is
|
|
530
648
|
found, it is returned. If no matching key is found, null is returned.
|
|
531
649
|
|
|
650
|
+
### concat
|
|
651
|
+
|
|
652
|
+
Merges multiple iterables into the set. Each element from the iterables
|
|
653
|
+
is added to the set, ensuring uniqueness of all elements. This method
|
|
654
|
+
mutates the original set.
|
|
655
|
+
|
|
656
|
+
#### Parameters
|
|
657
|
+
|
|
658
|
+
* `iterables` **...[Iterable](#iterable)** One or more iterable objects (like Set
|
|
659
|
+
or Array) whose elements will be added to the set.
|
|
660
|
+
|
|
661
|
+
### contains
|
|
662
|
+
|
|
663
|
+
Checks to see if any value within the `Set` loosely equals the supplied
|
|
664
|
+
value.
|
|
665
|
+
|
|
666
|
+
#### Parameters
|
|
667
|
+
|
|
668
|
+
* `value` **any** any value that might be loosely equal to an item in the
|
|
669
|
+
set, as opposed to [Set.has](Set.has) which is the equivalent of a strict or
|
|
670
|
+
triple equals (`===`) check
|
|
671
|
+
|
|
672
|
+
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** `true` if any value within the set is loosely equal to
|
|
673
|
+
the supplied value, `false` otherwise
|
|
674
|
+
|
|
675
|
+
### every
|
|
676
|
+
|
|
677
|
+
Checks if every element in the set passes the test implemented by the
|
|
678
|
+
provided function. The function is called with each element of the set.
|
|
679
|
+
Note: Since sets do not have indices, the index parameter is always NaN.
|
|
680
|
+
|
|
681
|
+
#### Parameters
|
|
682
|
+
|
|
683
|
+
* `everyFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** The function to test each element. Receives
|
|
684
|
+
the element, index (always NaN), and the set itself.
|
|
685
|
+
* `thisArg` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Optional. Value to use as `this` when executing
|
|
686
|
+
`everyFn`.
|
|
687
|
+
|
|
688
|
+
<!---->
|
|
689
|
+
|
|
690
|
+
* Throws **[TypeError](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypeError)** If `everyFn` is not a function.
|
|
691
|
+
|
|
692
|
+
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** True if every element passes the test, false otherwise.
|
|
693
|
+
|
|
694
|
+
### find
|
|
695
|
+
|
|
696
|
+
Finds the first element in the set satisfying the provided testing
|
|
697
|
+
function. If no elements satisfy the testing function, undefined is
|
|
698
|
+
returned. The function is called with each element of the set.
|
|
699
|
+
Note: Since sets do not have indices, the index parameter is always NaN.
|
|
700
|
+
|
|
701
|
+
#### Parameters
|
|
702
|
+
|
|
703
|
+
* `findFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** The function to execute on each element. It
|
|
704
|
+
receives the element, index (always NaN), and the set itself.
|
|
705
|
+
* `thisArg` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Optional. Value to use as `this` when executing
|
|
706
|
+
`findFn`.
|
|
707
|
+
|
|
708
|
+
<!---->
|
|
709
|
+
|
|
710
|
+
* Throws **[TypeError](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypeError)** If `findFn` is not a function.
|
|
711
|
+
|
|
712
|
+
Returns **any** The first element that satisfies `findFn`, or undefined.
|
|
713
|
+
|
|
714
|
+
### findLast
|
|
715
|
+
|
|
716
|
+
Finds the last element in the set satisfying the provided testing function.
|
|
717
|
+
If no elements satisfy the testing function, undefined is returned. The
|
|
718
|
+
function is called with each element of the set in reverse order.
|
|
719
|
+
Note: Since sets do not have indices, the index parameter is always NaN.
|
|
720
|
+
|
|
721
|
+
#### Parameters
|
|
722
|
+
|
|
723
|
+
* `findFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** The function to execute on each element. It
|
|
724
|
+
receives the element, index (always NaN), and the set itself.
|
|
725
|
+
* `thisArg` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Optional. Value to use as `this` when executing
|
|
726
|
+
`findFn`.
|
|
727
|
+
|
|
728
|
+
<!---->
|
|
729
|
+
|
|
730
|
+
* Throws **[TypeError](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypeError)** If `findFn` is not a function.
|
|
731
|
+
|
|
732
|
+
Returns **any** The last element that satisfies `findFn`, or undefined.
|
|
733
|
+
|
|
734
|
+
### length
|
|
735
|
+
|
|
736
|
+
A getter property that returns the number of elements in the set.
|
|
737
|
+
This is an alias for the `size` property of the set.
|
|
738
|
+
|
|
739
|
+
Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** The number of elements in the set.
|
|
740
|
+
|
|
741
|
+
### map
|
|
742
|
+
|
|
743
|
+
Creates a new array populated with the results of calling the provided
|
|
744
|
+
function on every element in the set. The function is called with each
|
|
745
|
+
element of the set. Note: Since sets do not have indices, the index
|
|
746
|
+
parameter is always NaN.
|
|
747
|
+
|
|
748
|
+
#### Parameters
|
|
749
|
+
|
|
750
|
+
* `mapFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** The function to execute on each element. It
|
|
751
|
+
receives the element, index (always NaN), and the set itself.
|
|
752
|
+
* `thisArg` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Optional. Value to use as `this` when executing
|
|
753
|
+
`mapFn`.
|
|
754
|
+
|
|
755
|
+
<!---->
|
|
756
|
+
|
|
757
|
+
* Throws **[TypeError](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypeError)** If `mapFn` is not a function.
|
|
758
|
+
|
|
759
|
+
Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** A new array with each element being the result of the
|
|
760
|
+
`mapFn`.
|
|
761
|
+
|
|
762
|
+
### reduce
|
|
763
|
+
|
|
764
|
+
Applies a function against an accumulator and each element in the set to
|
|
765
|
+
reduce it to a single value. The function is called with each element of
|
|
766
|
+
the set. Note: Since sets do not have indices, the index parameter is
|
|
767
|
+
always NaN.
|
|
768
|
+
|
|
769
|
+
#### Parameters
|
|
770
|
+
|
|
771
|
+
* `reduceFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** The function to execute on each element. It
|
|
772
|
+
receives the accumulator, element, index (always NaN), and the set itself.
|
|
773
|
+
* `initialValue` **any** The initial value to start reducing from.
|
|
774
|
+
* `thisArg` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Optional. Value to use as `this` when executing
|
|
775
|
+
`reduceFn`.
|
|
776
|
+
|
|
777
|
+
<!---->
|
|
778
|
+
|
|
779
|
+
* Throws **[TypeError](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypeError)** If `reduceFn` is not a function.
|
|
780
|
+
|
|
781
|
+
Returns **any** The reduced value.
|
|
782
|
+
|
|
783
|
+
### some
|
|
784
|
+
|
|
785
|
+
Tests whether at least one element in the set passes the test implemented
|
|
786
|
+
by the provided function. The function is called with each element of the
|
|
787
|
+
set. Note: Since sets do not have indices, the index parameter is always NaN.
|
|
788
|
+
|
|
789
|
+
#### Parameters
|
|
790
|
+
|
|
791
|
+
* `someFn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** The function to test each element. It receives
|
|
792
|
+
the element, index (always NaN), and the set itself.
|
|
793
|
+
* `thisArg` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Optional. Value to use as `this` when executing
|
|
794
|
+
`someFn`.
|
|
795
|
+
|
|
796
|
+
<!---->
|
|
797
|
+
|
|
798
|
+
* Throws **[TypeError](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypeError)** If `someFn` is not a function.
|
|
799
|
+
|
|
800
|
+
Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** True if at least one element passes the test, false
|
|
801
|
+
otherwise.
|
|
802
|
+
|
|
532
803
|
### ReflectExtensions
|
|
533
804
|
|
|
534
805
|
The `ReflectExtensions` class is a patch applied to the built-in JavaScript
|