si-funciona 2.3.2 → 2.3.4
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 +1337 -1244
- package/browser/siFunciona.js +24205 -24282
- package/browser/siFunciona.min.js +1 -1
- package/dist/helpers/arrays/BasicQueue.d.ts +66 -61
- package/dist/helpers/arrays/BasicQueue.js +62 -60
- package/dist/helpers/arrays/BasicQueue.min.js +1 -1
- package/dist/helpers/arrays/addUniqueToArray.d.ts +1 -0
- package/dist/helpers/arrays/buildArray.d.ts +1 -0
- package/dist/helpers/arrays/buildArrayOfReferences.d.ts +1 -0
- package/dist/helpers/arrays/compareArrays.d.ts +1 -0
- package/dist/helpers/arrays/compareArrays.js +24 -30
- package/dist/helpers/arrays/compareArrays.min.js +1 -1
- package/dist/helpers/arrays/mergeArrays.d.ts +1 -0
- package/dist/helpers/arrays/mergeArrays.js +2 -7
- package/dist/helpers/arrays/mergeArrays.min.js +1 -1
- package/dist/helpers/arrays/uniqueArray.d.ts +1 -0
- package/dist/helpers/arrays.d.ts +22 -20
- package/dist/helpers/arrays.js +33 -32
- package/dist/helpers/descriptors/assignDescriptor.d.ts +15 -11
- package/dist/helpers/descriptors/assignDescriptor.js +58 -60
- package/dist/helpers/descriptors/assignDescriptor.min.js +1 -1
- package/dist/helpers/descriptors/assignDescriptorDetail.d.ts +15 -11
- package/dist/helpers/descriptors/assignDescriptorDetail.js +37 -38
- package/dist/helpers/descriptors/assignDescriptorDetail.min.js +1 -1
- package/dist/helpers/descriptors/checkClearValues.d.ts +13 -11
- package/dist/helpers/descriptors/checkClearValues.js +21 -23
- package/dist/helpers/descriptors/checkClearValues.min.js +1 -1
- package/dist/helpers/descriptors/checkDescriptorComplete.d.ts +12 -10
- package/dist/helpers/descriptors/checkDescriptorComplete.js +20 -19
- package/dist/helpers/descriptors/cloneDescriptor.d.ts +11 -10
- package/dist/helpers/descriptors/cloneDescriptor.js +36 -37
- package/dist/helpers/descriptors/cloneDescriptor.min.js +1 -1
- package/dist/helpers/descriptors/cloneDescriptorDetail.d.ts +11 -10
- package/dist/helpers/descriptors/cloneDescriptorDetail.js +27 -27
- package/dist/helpers/descriptors/compareDescriptor.d.ts +14 -11
- package/dist/helpers/descriptors/compareDescriptor.js +33 -32
- package/dist/helpers/descriptors/compareDescriptor.min.js +1 -1
- package/dist/helpers/descriptors/describeObject.d.ts +16 -13
- package/dist/helpers/descriptors/describeObject.js +53 -51
- package/dist/helpers/descriptors/describeObjectDetail.d.ts +15 -12
- package/dist/helpers/descriptors/describeObjectDetail.js +38 -38
- package/dist/helpers/descriptors/describeObjectDetail.min.js +1 -1
- package/dist/helpers/descriptors/describeObjectMap.d.ts +37 -20
- package/dist/helpers/descriptors/describeObjectMap.js +108 -97
- package/dist/helpers/descriptors/describeObjectMap.min.js +1 -1
- package/dist/helpers/descriptors/nextReference.d.ts +14 -11
- package/dist/helpers/descriptors/nextReference.js +31 -29
- package/dist/helpers/descriptors/sameDescriptor.d.ts +14 -11
- package/dist/helpers/descriptors/sameDescriptor.js +22 -20
- package/dist/helpers/descriptors/samples/descriptor.d.ts +35 -27
- package/dist/helpers/descriptors/samples/descriptorDetail.d.ts +43 -34
- package/dist/helpers/descriptors/samples/descriptorMap.d.ts +17 -12
- package/dist/helpers/descriptors/samples/mappedDescriptorMap.d.ts +11 -7
- package/dist/helpers/descriptors/samples/mappedDescriptorMap.js +287 -284
- package/dist/helpers/descriptors.d.ts +45 -28
- package/dist/helpers/descriptors.js +58 -42
- package/dist/helpers/functions/callWithParams.d.ts +1 -0
- package/dist/helpers/functions/callWithParams.js +1 -6
- package/dist/helpers/functions/callWithParams.min.js +1 -1
- package/dist/helpers/functions/curry.d.ts +1 -0
- package/dist/helpers/functions/curry.js +1 -12
- package/dist/helpers/functions/curry.min.js +1 -1
- package/dist/helpers/functions/delay.d.ts +1 -0
- package/dist/helpers/functions/delay.js +4 -5
- package/dist/helpers/functions/delay.min.js +1 -1
- package/dist/helpers/functions/makeBasicQueue.d.ts +11 -10
- package/dist/helpers/functions/makeBasicQueue.js +19 -20
- package/dist/helpers/functions/makeBasicQueue.min.js +1 -1
- package/dist/helpers/functions/onBodyLoad.d.ts +1 -0
- package/dist/helpers/functions/onBodyLoad.js +1 -2
- package/dist/helpers/functions/onBodyLoad.min.js +1 -1
- package/dist/helpers/functions/pipe.d.ts +1 -0
- package/dist/helpers/functions/pipe.js +3 -6
- package/dist/helpers/functions/pipe.min.js +1 -1
- package/dist/helpers/functions/preloadParams.d.ts +1 -0
- package/dist/helpers/functions/preloadParams.js +3 -8
- package/dist/helpers/functions/preloadParams.min.js +1 -1
- package/dist/helpers/functions/queueManager.d.ts +50 -47
- package/dist/helpers/functions/queueManager.js +124 -132
- package/dist/helpers/functions/queueManager.min.js +1 -1
- package/dist/helpers/functions/queueTimeout.d.ts +1 -0
- package/dist/helpers/functions/queueTimeout.js +2 -10
- package/dist/helpers/functions/queueTimeout.min.js +1 -1
- package/dist/helpers/functions/relevancyFilter.d.ts +36 -35
- package/dist/helpers/functions/relevancyFilter.js +34 -36
- package/dist/helpers/functions/relevancyFilter.min.js +1 -1
- package/dist/helpers/functions/trace.d.ts +15 -12
- package/dist/helpers/functions/trace.js +25 -26
- package/dist/helpers/functions/trace.min.js +1 -1
- package/dist/helpers/functions.d.ts +1 -0
- package/dist/helpers/numbers/absoluteMax.d.ts +1 -0
- package/dist/helpers/numbers/absoluteMin.d.ts +1 -0
- package/dist/helpers/numbers/compare.d.ts +1 -0
- package/dist/helpers/numbers/greatestCommonDivisor.d.ts +1 -0
- package/dist/helpers/numbers/leastCommonMultiple.d.ts +1 -0
- package/dist/helpers/numbers/lowestCommonDenominator.d.ts +11 -10
- package/dist/helpers/numbers/lowestCommonDenominator.js +20 -23
- package/dist/helpers/numbers/lowestCommonDenominator.min.js +1 -1
- package/dist/helpers/numbers/randomInteger.d.ts +1 -0
- package/dist/helpers/numbers/randomInteger.js +1 -5
- package/dist/helpers/numbers/randomInteger.min.js +1 -1
- package/dist/helpers/numbers/randomNumber.d.ts +1 -0
- package/dist/helpers/numbers/randomNumber.js +1 -5
- package/dist/helpers/numbers/randomNumber.min.js +1 -1
- package/dist/helpers/numbers/simplestRatio.d.ts +1 -0
- package/dist/helpers/numbers/simplestRatio.js +4 -4
- package/dist/helpers/numbers/simplestRatio.min.js +1 -1
- package/dist/helpers/numbers.d.ts +1 -0
- package/dist/helpers/objects/cloneObject.d.ts +1 -0
- package/dist/helpers/objects/cloneObject.js +10 -15
- package/dist/helpers/objects/cloneObject.min.js +1 -1
- package/dist/helpers/objects/dotGet.d.ts +1 -0
- package/dist/helpers/objects/dotGet.js +1 -2
- package/dist/helpers/objects/dotGet.min.js +1 -1
- package/dist/helpers/objects/dotNotate.d.ts +1 -0
- package/dist/helpers/objects/dotNotate.js +6 -15
- package/dist/helpers/objects/dotNotate.min.js +1 -1
- package/dist/helpers/objects/dotSet.d.ts +1 -0
- package/dist/helpers/objects/dotSet.js +1 -2
- package/dist/helpers/objects/dotSet.min.js +1 -1
- package/dist/helpers/objects/dotUnset.d.ts +1 -0
- package/dist/helpers/objects/emptyObject.d.ts +1 -0
- package/dist/helpers/objects/filterObject.d.ts +1 -0
- package/dist/helpers/objects/filterObject.js +8 -11
- package/dist/helpers/objects/filterObject.min.js +1 -1
- package/dist/helpers/objects/isCloneable.d.ts +1 -0
- package/dist/helpers/objects/isInstanceObject.d.ts +1 -0
- package/dist/helpers/objects/isObject.d.ts +1 -0
- package/dist/helpers/objects/mapObject.d.ts +1 -0
- package/dist/helpers/objects/mapObject.js +1 -4
- package/dist/helpers/objects/mapObject.min.js +1 -1
- package/dist/helpers/objects/mergeObjects.d.ts +1 -0
- package/dist/helpers/objects/mergeObjectsBase.d.ts +1 -0
- package/dist/helpers/objects/mergeObjectsBase.js +58 -67
- package/dist/helpers/objects/mergeObjectsBase.min.js +1 -1
- package/dist/helpers/objects/mergeObjectsMutable.d.ts +1 -0
- package/dist/helpers/objects/objectKeys.d.ts +1 -0
- package/dist/helpers/objects/objectKeys.js +1 -2
- package/dist/helpers/objects/objectKeys.min.js +1 -1
- package/dist/helpers/objects/objectValues.d.ts +1 -0
- package/dist/helpers/objects/objectValues.js +1 -4
- package/dist/helpers/objects/objectValues.min.js +1 -1
- package/dist/helpers/objects/reduceObject.d.ts +1 -0
- package/dist/helpers/objects/reduceObject.js +1 -4
- package/dist/helpers/objects/reduceObject.min.js +1 -1
- package/dist/helpers/objects/setAndReturnValue.d.ts +1 -0
- package/dist/helpers/objects/setValue.d.ts +1 -0
- package/dist/helpers/objects.d.ts +5 -4
- package/dist/helpers/strings/camelCase.d.ts +10 -9
- package/dist/helpers/strings/camelCase.js +20 -20
- package/dist/helpers/strings/kabobCase.d.ts +10 -9
- package/dist/helpers/strings/kabobCase.js +19 -19
- package/dist/helpers/strings/makeFilepath.d.ts +10 -9
- package/dist/helpers/strings/makeFilepath.js +49 -50
- package/dist/helpers/strings/makeFilepath.min.js +1 -1
- package/dist/helpers/strings/makeRelativePath.d.ts +10 -9
- package/dist/helpers/strings/makeRelativePath.js +43 -43
- package/dist/helpers/strings/makeRelativePath.min.js +1 -1
- package/dist/helpers/strings/regexEscape.d.ts +9 -8
- package/dist/helpers/strings/regexEscape.js +15 -17
- package/dist/helpers/strings/regexEscape.min.js +1 -1
- package/dist/helpers/strings/snakeCase.d.ts +10 -9
- package/dist/helpers/strings/snakeCase.js +19 -19
- package/dist/helpers/strings/strAfter.d.ts +11 -10
- package/dist/helpers/strings/strAfter.js +19 -19
- package/dist/helpers/strings/strAfterLast.d.ts +11 -10
- package/dist/helpers/strings/strAfterLast.js +19 -19
- package/dist/helpers/strings/strBefore.d.ts +11 -10
- package/dist/helpers/strings/strBefore.js +19 -19
- package/dist/helpers/strings/strBeforeLast.d.ts +11 -10
- package/dist/helpers/strings/strBeforeLast.js +19 -19
- package/dist/helpers/strings/titleCase.d.ts +10 -9
- package/dist/helpers/strings/titleCase.js +20 -20
- package/dist/helpers/strings/ucFirst.d.ts +10 -9
- package/dist/helpers/strings/ucFirst.js +15 -15
- package/dist/helpers/strings/words.d.ts +11 -9
- package/dist/helpers/strings/words.js +16 -16
- package/dist/helpers/strings/words.min.js +1 -1
- package/dist/helpers/strings.d.ts +1 -0
- package/dist/main.d.ts +1 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,1247 +2,1340 @@
|
|
|
2
2
|
|
|
3
3
|
## Funciones de utilidad para uso general. [General usage utility functions.]
|
|
4
4
|
|
|
5
|
-
## Modules
|
|
6
|
-
|
|
7
|
-
<dl>
|
|
8
|
-
<dt><a href="#module_siFunciona">siFunciona</a></dt>
|
|
9
|
-
<dd><p>All the siFunciona system functions for stringing together functions and simplifying logic.</p>
|
|
10
|
-
</dd>
|
|
11
|
-
<dt><a href="#module_stringHelpers">stringHelpers</a></dt>
|
|
12
|
-
<dd><p>Manage how strings are manipulated with these utilities.</p>
|
|
13
|
-
</dd>
|
|
14
|
-
<dt><a href="#module_objectHelpers">objectHelpers</a></dt>
|
|
15
|
-
<dd><p>Simplify working with object by providing array-like parsing. Also, provides cloning and merging along with accessors that always have a return value for optimal nesting.</p>
|
|
16
|
-
</dd>
|
|
17
|
-
<dt><a href="#module_numberHelpers">numberHelpers</a></dt>
|
|
18
|
-
<dd><p>Some number comparators and random number generators.</p>
|
|
19
|
-
</dd>
|
|
20
|
-
<dt><a href="#module_functionHelpers">functionHelpers</a></dt>
|
|
21
|
-
<dd><p>Manage how functions are called with these utilities.</p>
|
|
22
|
-
</dd>
|
|
23
|
-
<dt><a href="#module_objectDescriptors">objectDescriptors</a></dt>
|
|
24
|
-
<dd><p>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
<
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
|
207
|
-
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
* [
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
<
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
<
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
<
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
|
352
|
-
|
|
|
353
|
-
|
|
354
|
-
<
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
|
367
|
-
|
|
|
368
|
-
|
|
369
|
-
<
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
|
388
|
-
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
|
399
|
-
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
<
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
<
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
<
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
<
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
|
498
|
-
|
|
499
|
-
<
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
The
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
<
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
<
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
|
729
|
-
|
|
|
730
|
-
| [
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
|
751
|
-
|
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
<
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
<
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
|
817
|
-
|
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
|
829
|
-
|
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
|
840
|
-
|
|
|
841
|
-
|
|
|
842
|
-
|
|
843
|
-
<a name="module_functionHelpers.
|
|
844
|
-
|
|
845
|
-
### functionHelpers.
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
**Kind**: static
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
**Kind**: static method of [<code>objectDescriptors</code>](#module_objectDescriptors)
|
|
992
|
-
|
|
993
|
-
| Param | Type |
|
|
994
|
-
| --- | --- |
|
|
995
|
-
|
|
|
996
|
-
|
|
997
|
-
<a
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
|
1039
|
-
|
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
**Kind**: static method of [<code>objectDescriptors</code>](#module_objectDescriptors)
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
|
1052
|
-
|
|
|
1053
|
-
|
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
**
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
<
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
<
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
<
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
|
1134
|
-
|
|
|
1135
|
-
|
|
|
1136
|
-
|
|
1137
|
-
<a name="module_arrayHelpers
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
)
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
[
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
<
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
5
|
+
## Modules
|
|
6
|
+
|
|
7
|
+
<dl>
|
|
8
|
+
<dt><a href="#module_siFunciona">siFunciona</a></dt>
|
|
9
|
+
<dd><p>All the siFunciona system functions for stringing together functions and simplifying logic.</p>
|
|
10
|
+
</dd>
|
|
11
|
+
<dt><a href="#module_stringHelpers">stringHelpers</a></dt>
|
|
12
|
+
<dd><p>Manage how strings are manipulated with these utilities.</p>
|
|
13
|
+
</dd>
|
|
14
|
+
<dt><a href="#module_objectHelpers">objectHelpers</a></dt>
|
|
15
|
+
<dd><p>Simplify working with object by providing array-like parsing. Also, provides cloning and merging along with accessors that always have a return value for optimal nesting.</p>
|
|
16
|
+
</dd>
|
|
17
|
+
<dt><a href="#module_numberHelpers">numberHelpers</a></dt>
|
|
18
|
+
<dd><p>Some number comparators and random number generators.</p>
|
|
19
|
+
</dd>
|
|
20
|
+
<dt><a href="#module_functionHelpers">functionHelpers</a></dt>
|
|
21
|
+
<dd><p>Manage how functions are called with these utilities.</p>
|
|
22
|
+
</dd>
|
|
23
|
+
<dt><a href="#module_objectDescriptors">objectDescriptors</a></dt>
|
|
24
|
+
<dd><p>A "descriptor" is a flat, serializable snapshot of an object or array's shape: for each property, its type(s),
|
|
25
|
+
whether it's nullable, and - if the property's own value is itself an object/array - a reference to that nested
|
|
26
|
+
value's own descriptor elsewhere in the same list, rather than nesting descriptors inside descriptors. This flat,
|
|
27
|
+
reference-based structure is what lets these utilities walk deeply nested and even circular object graphs (an
|
|
28
|
+
object that contains itself, directly or indirectly) without infinite recursion, since a value that's already
|
|
29
|
+
been described is simply pointed to again instead of re-described.</p>
|
|
30
|
+
<p>Start with <a href="#module_objectDescriptors.describeObjectMap">describeObjectMap</a>, which takes any real object or array and produces
|
|
31
|
+
this flat list of descriptors for you - the other functions here (comparing, merging, cloning descriptors) are
|
|
32
|
+
building blocks used internally, or useful once you already have descriptors to work with directly.</p>
|
|
33
|
+
<p>The concrete use this module has earned its keep on: describing two objects and comparing the results tells
|
|
34
|
+
you whether they're the same shape and values even when they're different references entirely (see
|
|
35
|
+
<a href="#module_objectDescriptors.sameDescriptor">sameDescriptor</a>/<a href="#module_objectDescriptors.compareDescriptor">compareDescriptor</a>) - useful
|
|
36
|
+
anywhere you need to check that two objects genuinely match without caring whether they're literally the same
|
|
37
|
+
instance. A descriptor also doubles as a flat, structured summary of an object's shape, which can be handy for
|
|
38
|
+
discussion or assessment purposes (e.g. describing what an object looks like without dumping the whole thing).</p>
|
|
39
|
+
</dd>
|
|
40
|
+
<dt><a href="#module_arrayHelpers">arrayHelpers</a></dt>
|
|
41
|
+
<dd><p>Utilities for building, merging, deduplicating and comparing arrays, plus a basic FIFO queue (BasicQueue) for
|
|
42
|
+
use with functionHelpers' queueManager/queueTimeout.</p>
|
|
43
|
+
</dd>
|
|
44
|
+
</dl>
|
|
45
|
+
|
|
46
|
+
<a name="module_siFunciona"></a>
|
|
47
|
+
|
|
48
|
+
## siFunciona
|
|
49
|
+
All the siFunciona system functions for stringing together functions and simplifying logic.
|
|
50
|
+
|
|
51
|
+
**Version**: 1.0.0
|
|
52
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
53
|
+
<a name="module_stringHelpers"></a>
|
|
54
|
+
|
|
55
|
+
## stringHelpers
|
|
56
|
+
Manage how strings are manipulated with these utilities.
|
|
57
|
+
|
|
58
|
+
**Version**: 1.0.0
|
|
59
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
60
|
+
|
|
61
|
+
* [stringHelpers](#module_stringHelpers)
|
|
62
|
+
* [.words(str)](#module_stringHelpers.words) ⇒ <code>Array.<string></code>
|
|
63
|
+
* [.ucFirst(str)](#module_stringHelpers.ucFirst) ⇒ <code>string</code>
|
|
64
|
+
* [.titleCase(str)](#module_stringHelpers.titleCase) ⇒ <code>string</code>
|
|
65
|
+
* [.strBeforeLast(str, search)](#module_stringHelpers.strBeforeLast) ⇒ <code>string</code>
|
|
66
|
+
* [.strBefore(str, search)](#module_stringHelpers.strBefore) ⇒ <code>string</code>
|
|
67
|
+
* [.strAfterLast(str, search)](#module_stringHelpers.strAfterLast) ⇒ <code>string</code>
|
|
68
|
+
* [.strAfter(str, search)](#module_stringHelpers.strAfter) ⇒ <code>string</code>
|
|
69
|
+
* [.snakeCase(str)](#module_stringHelpers.snakeCase) ⇒ <code>string</code>
|
|
70
|
+
* [.regexEscape(str)](#module_stringHelpers.regexEscape) ⇒ <code>string</code>
|
|
71
|
+
* [.makeRelativePath(fromFile, toFile)](#module_stringHelpers.makeRelativePath) ⇒ <code>string</code>
|
|
72
|
+
* [.makeFilepath(root, [append])](#module_stringHelpers.makeFilepath) ⇒ <code>string</code>
|
|
73
|
+
* [.kabobCase(str)](#module_stringHelpers.kabobCase) ⇒ <code>string</code>
|
|
74
|
+
* [.camelCase(str)](#module_stringHelpers.camelCase) ⇒ <code>string</code>
|
|
75
|
+
|
|
76
|
+
<a name="module_stringHelpers.words"></a>
|
|
77
|
+
|
|
78
|
+
### stringHelpers.words(str) ⇒ <code>Array.<string></code>
|
|
79
|
+
Split a string into sets of numbers or letters - the shared tokenizer behind camelCase/kabobCase/snakeCase/
|
|
80
|
+
titleCase, so each can rebuild the string in its own casing style.
|
|
81
|
+
|
|
82
|
+
**Kind**: static method of [<code>stringHelpers</code>](#module_stringHelpers)
|
|
83
|
+
|
|
84
|
+
| Param | Type | Description |
|
|
85
|
+
| --- | --- | --- |
|
|
86
|
+
| str | <code>string</code> | The string to split. |
|
|
87
|
+
|
|
88
|
+
<a name="module_stringHelpers.ucFirst"></a>
|
|
89
|
+
|
|
90
|
+
### stringHelpers.ucFirst(str) ⇒ <code>string</code>
|
|
91
|
+
Given a string, make the first character uppercase and the rest lowercase.
|
|
92
|
+
|
|
93
|
+
**Kind**: static method of [<code>stringHelpers</code>](#module_stringHelpers)
|
|
94
|
+
|
|
95
|
+
| Param | Type | Description |
|
|
96
|
+
| --- | --- | --- |
|
|
97
|
+
| str | <code>string</code> | The string to convert. |
|
|
98
|
+
|
|
99
|
+
<a name="module_stringHelpers.titleCase"></a>
|
|
100
|
+
|
|
101
|
+
### stringHelpers.titleCase(str) ⇒ <code>string</code>
|
|
102
|
+
Given a string in kebab-case, snake_case, camelCase or 'Sentence case', convert to 'Title Case'.
|
|
103
|
+
|
|
104
|
+
**Kind**: static method of [<code>stringHelpers</code>](#module_stringHelpers)
|
|
105
|
+
|
|
106
|
+
| Param | Type | Description |
|
|
107
|
+
| --- | --- | --- |
|
|
108
|
+
| str | <code>string</code> | The string to convert. |
|
|
109
|
+
|
|
110
|
+
<a name="module_stringHelpers.strBeforeLast"></a>
|
|
111
|
+
|
|
112
|
+
### stringHelpers.strBeforeLast(str, search) ⇒ <code>string</code>
|
|
113
|
+
Retrieve the string part before the last search match.
|
|
114
|
+
|
|
115
|
+
**Kind**: static method of [<code>stringHelpers</code>](#module_stringHelpers)
|
|
116
|
+
**Returns**: <code>string</code> - The portion of `str` before the last occurrence of `search`, or `''` if not found.
|
|
117
|
+
|
|
118
|
+
| Param | Type | Description |
|
|
119
|
+
| --- | --- | --- |
|
|
120
|
+
| str | <code>string</code> | The string to search within. |
|
|
121
|
+
| search | <code>string</code> | The substring to search for. |
|
|
122
|
+
|
|
123
|
+
<a name="module_stringHelpers.strBefore"></a>
|
|
124
|
+
|
|
125
|
+
### stringHelpers.strBefore(str, search) ⇒ <code>string</code>
|
|
126
|
+
Retrieve the string part before the search match.
|
|
127
|
+
|
|
128
|
+
**Kind**: static method of [<code>stringHelpers</code>](#module_stringHelpers)
|
|
129
|
+
**Returns**: <code>string</code> - The portion of `str` before the first occurrence of `search`, or `''` if not found.
|
|
130
|
+
|
|
131
|
+
| Param | Type | Description |
|
|
132
|
+
| --- | --- | --- |
|
|
133
|
+
| str | <code>string</code> | The string to search within. |
|
|
134
|
+
| search | <code>string</code> | The substring to search for. |
|
|
135
|
+
|
|
136
|
+
<a name="module_stringHelpers.strAfterLast"></a>
|
|
137
|
+
|
|
138
|
+
### stringHelpers.strAfterLast(str, search) ⇒ <code>string</code>
|
|
139
|
+
Retrieve the string part after the last search match.
|
|
140
|
+
|
|
141
|
+
**Kind**: static method of [<code>stringHelpers</code>](#module_stringHelpers)
|
|
142
|
+
**Returns**: <code>string</code> - The portion of `str` after the last occurrence of `search`, or `''` if not found.
|
|
143
|
+
|
|
144
|
+
| Param | Type | Description |
|
|
145
|
+
| --- | --- | --- |
|
|
146
|
+
| str | <code>string</code> | The string to search within. |
|
|
147
|
+
| search | <code>string</code> | The substring to search for. |
|
|
148
|
+
|
|
149
|
+
<a name="module_stringHelpers.strAfter"></a>
|
|
150
|
+
|
|
151
|
+
### stringHelpers.strAfter(str, search) ⇒ <code>string</code>
|
|
152
|
+
Retrieve the string part after the search match.
|
|
153
|
+
|
|
154
|
+
**Kind**: static method of [<code>stringHelpers</code>](#module_stringHelpers)
|
|
155
|
+
**Returns**: <code>string</code> - The portion of `str` after the first occurrence of `search`, or `''` if not found.
|
|
156
|
+
|
|
157
|
+
| Param | Type | Description |
|
|
158
|
+
| --- | --- | --- |
|
|
159
|
+
| str | <code>string</code> | The string to search within. |
|
|
160
|
+
| search | <code>string</code> | The substring to search for. |
|
|
161
|
+
|
|
162
|
+
<a name="module_stringHelpers.snakeCase"></a>
|
|
163
|
+
|
|
164
|
+
### stringHelpers.snakeCase(str) ⇒ <code>string</code>
|
|
165
|
+
Given a string in kebab-case, camelCase or 'Sentence case', convert to snake_case.
|
|
166
|
+
|
|
167
|
+
**Kind**: static method of [<code>stringHelpers</code>](#module_stringHelpers)
|
|
168
|
+
|
|
169
|
+
| Param | Type | Description |
|
|
170
|
+
| --- | --- | --- |
|
|
171
|
+
| str | <code>string</code> | The string to convert. |
|
|
172
|
+
|
|
173
|
+
<a name="module_stringHelpers.regexEscape"></a>
|
|
174
|
+
|
|
175
|
+
### stringHelpers.regexEscape(str) ⇒ <code>string</code>
|
|
176
|
+
Take a string and escape the regex characters.
|
|
177
|
+
|
|
178
|
+
**Kind**: static method of [<code>stringHelpers</code>](#module_stringHelpers)
|
|
179
|
+
|
|
180
|
+
| Param | Type | Description |
|
|
181
|
+
| --- | --- | --- |
|
|
182
|
+
| str | <code>string</code> | The string to escape, so it can be used literally inside a `RegExp`. |
|
|
183
|
+
|
|
184
|
+
<a name="module_stringHelpers.makeRelativePath"></a>
|
|
185
|
+
|
|
186
|
+
### stringHelpers.makeRelativePath(fromFile, toFile) ⇒ <code>string</code>
|
|
187
|
+
Compare two file paths and simplify them to a relative path.
|
|
188
|
+
|
|
189
|
+
**Kind**: static method of [<code>stringHelpers</code>](#module_stringHelpers)
|
|
190
|
+
**Returns**: <code>string</code> - `toFile` expressed relative to `fromFile`.
|
|
191
|
+
|
|
192
|
+
| Param | Type | Description |
|
|
193
|
+
| --- | --- | --- |
|
|
194
|
+
| fromFile | <code>string</code> | The path of the file the resulting relative path will be used from. |
|
|
195
|
+
| toFile | <code>string</code> | The path of the file being referenced. |
|
|
196
|
+
|
|
197
|
+
<a name="module_stringHelpers.makeFilepath"></a>
|
|
198
|
+
|
|
199
|
+
### stringHelpers.makeFilepath(root, [append]) ⇒ <code>string</code>
|
|
200
|
+
Format the given path so that it does not have trailing slashes and also correctly appends a path.
|
|
201
|
+
|
|
202
|
+
**Kind**: static method of [<code>stringHelpers</code>](#module_stringHelpers)
|
|
203
|
+
|
|
204
|
+
| Param | Type | Default | Description |
|
|
205
|
+
| --- | --- | --- | --- |
|
|
206
|
+
| root | <code>string</code> | | The base path to start from. |
|
|
207
|
+
| [append] | <code>string</code> | <code>"''"</code> | A path to append to `root` - may itself use `./` or `../` segments. |
|
|
208
|
+
|
|
209
|
+
<a name="module_stringHelpers.kabobCase"></a>
|
|
210
|
+
|
|
211
|
+
### stringHelpers.kabobCase(str) ⇒ <code>string</code>
|
|
212
|
+
Given a string in snake_case, camelCase or 'Sentence case', convert to kabob-case.
|
|
213
|
+
|
|
214
|
+
**Kind**: static method of [<code>stringHelpers</code>](#module_stringHelpers)
|
|
215
|
+
|
|
216
|
+
| Param | Type | Description |
|
|
217
|
+
| --- | --- | --- |
|
|
218
|
+
| str | <code>string</code> | The string to convert. |
|
|
219
|
+
|
|
220
|
+
<a name="module_stringHelpers.camelCase"></a>
|
|
221
|
+
|
|
222
|
+
### stringHelpers.camelCase(str) ⇒ <code>string</code>
|
|
223
|
+
Given a string in kebab-case, snake_case or 'Sentence case', convert to camelCase.
|
|
224
|
+
|
|
225
|
+
**Kind**: static method of [<code>stringHelpers</code>](#module_stringHelpers)
|
|
226
|
+
|
|
227
|
+
| Param | Type | Description |
|
|
228
|
+
| --- | --- | --- |
|
|
229
|
+
| str | <code>string</code> | The string to convert. |
|
|
230
|
+
|
|
231
|
+
<a name="module_objectHelpers"></a>
|
|
232
|
+
|
|
233
|
+
## objectHelpers
|
|
234
|
+
Simplify working with object by providing array-like parsing. Also, provides cloning and merging along with accessors that always have a return value for optimal nesting.
|
|
235
|
+
|
|
236
|
+
**Version**: 1.0.0
|
|
237
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
238
|
+
|
|
239
|
+
* [objectHelpers](#module_objectHelpers)
|
|
240
|
+
* _static_
|
|
241
|
+
* [.mergeObjectsMutable](#module_objectHelpers.mergeObjectsMutable) ⇒ <code>\*</code>
|
|
242
|
+
* [.mergeObjects](#module_objectHelpers.mergeObjects) ⇒ <code>\*</code>
|
|
243
|
+
* [.setValue(key, value, item)](#module_objectHelpers.setValue) ⇒ <code>Object</code> \| <code>Array</code>
|
|
244
|
+
* [.setAndReturnValue(item, key, value)](#module_objectHelpers.setAndReturnValue) ⇒ <code>\*</code>
|
|
245
|
+
* [.reduceObject(obj, fn, [initialValue])](#module_objectHelpers.reduceObject) ⇒ <code>\*</code>
|
|
246
|
+
* [.objectValues(object, [includeInherited])](#module_objectHelpers.objectValues) ⇒ <code>Array</code>
|
|
247
|
+
* [.objectKeys(object, [includeInherited])](#module_objectHelpers.objectKeys) ⇒ <code>Array.<(string\|number)></code>
|
|
248
|
+
* [.mergeObjectsBase([options])](#module_objectHelpers.mergeObjectsBase) ⇒ <code>module:objectHelpers~mergeObjectsCallback</code> \| <code>mergeObjectsCallback</code>
|
|
249
|
+
* [.mapObject(obj, fn, [thisArg])](#module_objectHelpers.mapObject) ⇒ <code>Object</code> \| <code>Array</code>
|
|
250
|
+
* [.isObject(object)](#module_objectHelpers.isObject) ⇒ <code>boolean</code>
|
|
251
|
+
* [.isInstanceObject(object)](#module_objectHelpers.isInstanceObject) ⇒ <code>boolean</code>
|
|
252
|
+
* [.isCloneable(value)](#module_objectHelpers.isCloneable) ⇒ <code>boolean</code>
|
|
253
|
+
* [.filterObject(obj, fn, [thisArg])](#module_objectHelpers.filterObject) ⇒ <code>Object</code> \| <code>Array</code>
|
|
254
|
+
* [.emptyObject(item)](#module_objectHelpers.emptyObject) ⇒ <code>boolean</code>
|
|
255
|
+
* [.dotUnset(arrayObject, dotNotation)](#module_objectHelpers.dotUnset) ⇒ <code>Object</code>
|
|
256
|
+
* [.dotSet(arrayObject, dotNotation, value)](#module_objectHelpers.dotSet) ⇒ <code>Object</code>
|
|
257
|
+
* [.dotNotate(arrayObject, [retainObjects])](#module_objectHelpers.dotNotate) ⇒ <code>DotNotatedObject</code>
|
|
258
|
+
* [.dotGet(arrayObject, dotNotation, [defaultValue])](#module_objectHelpers.dotGet) ⇒ <code>\*</code>
|
|
259
|
+
* [.cloneObject(object, [options])](#module_objectHelpers.cloneObject) ⇒ <code>Object</code>
|
|
260
|
+
* _inner_
|
|
261
|
+
* [~handleRetainObjects([retainObjects])](#module_objectHelpers..handleRetainObjects) ⇒ <code>function</code>
|
|
262
|
+
* [~performDotNotate(arrayObject, didRetain, [prepend], [results])](#module_objectHelpers..performDotNotate) ⇒ <code>DotNotatedObject</code>
|
|
263
|
+
|
|
264
|
+
<a name="module_objectHelpers.mergeObjectsMutable"></a>
|
|
265
|
+
|
|
266
|
+
### objectHelpers.mergeObjectsMutable ⇒ <code>\*</code>
|
|
267
|
+
Uses mergeObjectsBase deep merge objects and arrays, merge by reference.
|
|
268
|
+
|
|
269
|
+
**Kind**: static constant of [<code>objectHelpers</code>](#module_objectHelpers)
|
|
270
|
+
**See**: [module:objectHelpers~mergeObjectsCallback](module:objectHelpers~mergeObjectsCallback)
|
|
271
|
+
|
|
272
|
+
| Param | Type | Description |
|
|
273
|
+
| --- | --- | --- |
|
|
274
|
+
| ...objects | <code>Object</code> | Provide a list of objects which will be merged starting from the end up into the first |
|
|
275
|
+
|
|
276
|
+
<a name="module_objectHelpers.mergeObjects"></a>
|
|
277
|
+
|
|
278
|
+
### objectHelpers.mergeObjects ⇒ <code>\*</code>
|
|
279
|
+
Uses mergeObjectsBase deep merge objects and arrays, merge by value.
|
|
280
|
+
|
|
281
|
+
**Kind**: static constant of [<code>objectHelpers</code>](#module_objectHelpers)
|
|
282
|
+
**See**: [module:objectHelpers~mergeObjectsCallback](module:objectHelpers~mergeObjectsCallback)
|
|
283
|
+
|
|
284
|
+
| Param | Type | Description |
|
|
285
|
+
| --- | --- | --- |
|
|
286
|
+
| ...objects | <code>Object</code> | Provide a list of objects which will be merged starting from the end up into the first |
|
|
287
|
+
|
|
288
|
+
<a name="module_objectHelpers.setValue"></a>
|
|
289
|
+
|
|
290
|
+
### objectHelpers.setValue(key, value, item) ⇒ <code>Object</code> \| <code>Array</code>
|
|
291
|
+
Set a value on an item, then return the item.
|
|
292
|
+
NOTE: Argument order designed for usage with pipe
|
|
293
|
+
|
|
294
|
+
**Kind**: static method of [<code>objectHelpers</code>](#module_objectHelpers)
|
|
295
|
+
|
|
296
|
+
| Param | Type | Description |
|
|
297
|
+
| --- | --- | --- |
|
|
298
|
+
| key | <code>string</code> \| <code>number</code> | The key on the item which will have its value set |
|
|
299
|
+
| value | <code>\*</code> | Any value to be applied to the key |
|
|
300
|
+
| item | <code>Object</code> \| <code>Array</code> | An object or array to be updated |
|
|
301
|
+
|
|
302
|
+
<a name="module_objectHelpers.setAndReturnValue"></a>
|
|
303
|
+
|
|
304
|
+
### objectHelpers.setAndReturnValue(item, key, value) ⇒ <code>\*</code>
|
|
305
|
+
Set a value on an item, then return the value
|
|
306
|
+
|
|
307
|
+
**Kind**: static method of [<code>objectHelpers</code>](#module_objectHelpers)
|
|
308
|
+
|
|
309
|
+
| Param | Type | Description |
|
|
310
|
+
| --- | --- | --- |
|
|
311
|
+
| item | <code>Object</code> \| <code>Array</code> | An object or array to be updated |
|
|
312
|
+
| key | <code>string</code> \| <code>number</code> | The key on the item which will have its value set |
|
|
313
|
+
| value | <code>\*</code> | Any value to be applied to the key |
|
|
314
|
+
|
|
315
|
+
<a name="module_objectHelpers.reduceObject"></a>
|
|
316
|
+
|
|
317
|
+
### objectHelpers.reduceObject(obj, fn, [initialValue]) ⇒ <code>\*</code>
|
|
318
|
+
This function is intended to replicate behaviour of the Array.reduce() function but for Objects.
|
|
319
|
+
If an array is passed in instead then it will perform standard reduce(). It is recommended to
|
|
320
|
+
always use the standard reduce() function when it is known that the object is actually an array.
|
|
321
|
+
|
|
322
|
+
**Kind**: static method of [<code>objectHelpers</code>](#module_objectHelpers)
|
|
323
|
+
|
|
324
|
+
| Param | Type | Description |
|
|
325
|
+
| --- | --- | --- |
|
|
326
|
+
| obj | <code>Object</code> \| <code>Array</code> | The Object (or Array) to be filtered |
|
|
327
|
+
| fn | <code>module:objectHelpers~reduceCallback</code> \| <code>function</code> \| <code>reduceCallback</code> | The function to be processed for each filtered property |
|
|
328
|
+
| [initialValue] | <code>Object</code> \| <code>Array</code> | Optional. Value to use as the first argument to the first call of the callback. If no initial value is supplied, the first element in the array will be used. Calling reduce on an empty array without an initial value is an error. |
|
|
329
|
+
|
|
330
|
+
<a name="module_objectHelpers.objectValues"></a>
|
|
331
|
+
|
|
332
|
+
### objectHelpers.objectValues(object, [includeInherited]) ⇒ <code>Array</code>
|
|
333
|
+
Get an array of values from any object or array. Will return empty array when invalid or there are no values.
|
|
334
|
+
Optional flag will include the inherited values from prototype chain when set.
|
|
335
|
+
|
|
336
|
+
**Kind**: static method of [<code>objectHelpers</code>](#module_objectHelpers)
|
|
337
|
+
|
|
338
|
+
| Param | Type | Default |
|
|
339
|
+
| --- | --- | --- |
|
|
340
|
+
| object | <code>Object</code> \| <code>Array</code> | |
|
|
341
|
+
| [includeInherited] | <code>boolean</code> | <code>false</code> |
|
|
342
|
+
|
|
343
|
+
<a name="module_objectHelpers.objectKeys"></a>
|
|
344
|
+
|
|
345
|
+
### objectHelpers.objectKeys(object, [includeInherited]) ⇒ <code>Array.<(string\|number)></code>
|
|
346
|
+
Get an array of keys from any object or array. Will return empty array when invalid or there are no keys.
|
|
347
|
+
Optional flag will include the inherited keys from prototype chain when set.
|
|
348
|
+
|
|
349
|
+
**Kind**: static method of [<code>objectHelpers</code>](#module_objectHelpers)
|
|
350
|
+
|
|
351
|
+
| Param | Type | Default |
|
|
352
|
+
| --- | --- | --- |
|
|
353
|
+
| object | <code>Object</code> \| <code>Array</code> | |
|
|
354
|
+
| [includeInherited] | <code>boolean</code> | <code>false</code> |
|
|
355
|
+
|
|
356
|
+
<a name="module_objectHelpers.mergeObjectsBase"></a>
|
|
357
|
+
|
|
358
|
+
### objectHelpers.mergeObjectsBase([options]) ⇒ <code>module:objectHelpers~mergeObjectsCallback</code> \| <code>mergeObjectsCallback</code>
|
|
359
|
+
Perform a deep merge of objects. This will return a function that will combine all objects and sub-objects.
|
|
360
|
+
Objects having the same attributes will overwrite from last object to first.
|
|
361
|
+
NOTE: Use the mapLimit and relevancyRange to resolve "too much recursion" when the object is large and is known to
|
|
362
|
+
have circular references. A high mapLimit may lead to heavy memory usage and slow performance.
|
|
363
|
+
|
|
364
|
+
**Kind**: static method of [<code>objectHelpers</code>](#module_objectHelpers)
|
|
365
|
+
|
|
366
|
+
| Param | Type | Default | Description |
|
|
367
|
+
| --- | --- | --- | --- |
|
|
368
|
+
| [options] | <code>Object</code> | <code>{}</code> | |
|
|
369
|
+
| [options.mapLimit] | <code>number</code> | <code>100</code> | Size of temporary reference array used in memory before assessing relevancy. |
|
|
370
|
+
| [options.depthLimit] | <code>number</code> | <code>-1</code> | Control how many nested levels deep will be used, -1 = no limit, >-1 = nth level limited. |
|
|
371
|
+
| [options.relevancyRange] | <code>number</code> | <code>1000</code> | Total reference map length subtract this range, any relevancy less than that amount at time of evaluation will be removed. |
|
|
372
|
+
| [options.map] | <code>Iterable</code> \| <code>array</code> | <code>[]</code> | A predetermined list of references gathered (to be passed to itself during recursion). |
|
|
373
|
+
| [options.useClone] | <code>boolean</code> | <code>false</code> | |
|
|
374
|
+
|
|
375
|
+
<a name="module_objectHelpers.mapObject"></a>
|
|
376
|
+
|
|
377
|
+
### objectHelpers.mapObject(obj, fn, [thisArg]) ⇒ <code>Object</code> \| <code>Array</code>
|
|
378
|
+
This function is intended to replicate behaviour of the Array.map() function but for Objects.
|
|
379
|
+
If an array is passed in instead then it will perform standard map(). It is recommended to
|
|
380
|
+
always use the standard map() function when it is known that the object is actually an array.
|
|
381
|
+
|
|
382
|
+
**Kind**: static method of [<code>objectHelpers</code>](#module_objectHelpers)
|
|
383
|
+
|
|
384
|
+
| Param | Type | Description |
|
|
385
|
+
| --- | --- | --- |
|
|
386
|
+
| obj | <code>Object</code> \| <code>Array</code> | The Object (or Array) to be mapped |
|
|
387
|
+
| fn | <code>module:objectHelpers~mapCallback</code> \| <code>function</code> | The function to be processed for each mapped property |
|
|
388
|
+
| [thisArg] | <code>Object</code> \| <code>Array</code> | Optional. Value to use as this when executing callback. |
|
|
389
|
+
|
|
390
|
+
<a name="module_objectHelpers.isObject"></a>
|
|
391
|
+
|
|
392
|
+
### objectHelpers.isObject(object) ⇒ <code>boolean</code>
|
|
393
|
+
Check if the provided thing is an object / array.
|
|
394
|
+
|
|
395
|
+
**Kind**: static method of [<code>objectHelpers</code>](#module_objectHelpers)
|
|
396
|
+
|
|
397
|
+
| Param | Type |
|
|
398
|
+
| --- | --- |
|
|
399
|
+
| object | <code>\*</code> |
|
|
400
|
+
|
|
401
|
+
<a name="module_objectHelpers.isInstanceObject"></a>
|
|
402
|
+
|
|
403
|
+
### objectHelpers.isInstanceObject(object) ⇒ <code>boolean</code>
|
|
404
|
+
Check if the current object has inherited properties.
|
|
405
|
+
|
|
406
|
+
**Kind**: static method of [<code>objectHelpers</code>](#module_objectHelpers)
|
|
407
|
+
|
|
408
|
+
| Param | Type |
|
|
409
|
+
| --- | --- |
|
|
410
|
+
| object | <code>Object</code> \| <code>Array</code> |
|
|
411
|
+
|
|
412
|
+
<a name="module_objectHelpers.isCloneable"></a>
|
|
413
|
+
|
|
414
|
+
### objectHelpers.isCloneable(value) ⇒ <code>boolean</code>
|
|
415
|
+
Determine if the value is a reference instance
|
|
416
|
+
|
|
417
|
+
**Kind**: static method of [<code>objectHelpers</code>](#module_objectHelpers)
|
|
418
|
+
|
|
419
|
+
| Param | Type |
|
|
420
|
+
| --- | --- |
|
|
421
|
+
| value | <code>Array</code> \| <code>Object</code> \| <code>\*</code> |
|
|
422
|
+
|
|
423
|
+
<a name="module_objectHelpers.filterObject"></a>
|
|
424
|
+
|
|
425
|
+
### objectHelpers.filterObject(obj, fn, [thisArg]) ⇒ <code>Object</code> \| <code>Array</code>
|
|
426
|
+
This function is intended to replicate behaviour of the Array.filter() function but for Objects.
|
|
427
|
+
If an array is passed in instead then it will perform standard filter(). It is recommended to
|
|
428
|
+
always use the standard filter() function when it is known that the object is actually an array.
|
|
429
|
+
|
|
430
|
+
**Kind**: static method of [<code>objectHelpers</code>](#module_objectHelpers)
|
|
431
|
+
|
|
432
|
+
| Param | Type | Description |
|
|
433
|
+
| --- | --- | --- |
|
|
434
|
+
| obj | <code>Object</code> \| <code>Array</code> | The Object (or Array) to be filtered |
|
|
435
|
+
| fn | <code>module:objectHelpers~filterCallback</code> \| <code>function</code> | The function to be processed for each filtered property |
|
|
436
|
+
| [thisArg] | <code>Object</code> \| <code>Array</code> | Optional. Value to use as this when executing callback. |
|
|
437
|
+
|
|
438
|
+
<a name="module_objectHelpers.emptyObject"></a>
|
|
439
|
+
|
|
440
|
+
### objectHelpers.emptyObject(item) ⇒ <code>boolean</code>
|
|
441
|
+
Helper function for testing if the item is an Object or Array that does not have any properties
|
|
442
|
+
|
|
443
|
+
**Kind**: static method of [<code>objectHelpers</code>](#module_objectHelpers)
|
|
444
|
+
|
|
445
|
+
| Param | Type | Description |
|
|
446
|
+
| --- | --- | --- |
|
|
447
|
+
| item | <code>Object</code> \| <code>Array</code> | Object or Array to test |
|
|
448
|
+
|
|
449
|
+
<a name="module_objectHelpers.dotUnset"></a>
|
|
450
|
+
|
|
451
|
+
### objectHelpers.dotUnset(arrayObject, dotNotation) ⇒ <code>Object</code>
|
|
452
|
+
Unset a nested property value an object.
|
|
453
|
+
|
|
454
|
+
**Kind**: static method of [<code>objectHelpers</code>](#module_objectHelpers)
|
|
455
|
+
**Returns**: <code>Object</code> - The modified object
|
|
456
|
+
|
|
457
|
+
| Param | Type | Description |
|
|
458
|
+
| --- | --- | --- |
|
|
459
|
+
| arrayObject | <code>Object</code> | The array or object to set the property on |
|
|
460
|
+
| dotNotation | <code>string</code> | The path for the property |
|
|
461
|
+
|
|
462
|
+
<a name="module_objectHelpers.dotSet"></a>
|
|
463
|
+
|
|
464
|
+
### objectHelpers.dotSet(arrayObject, dotNotation, value) ⇒ <code>Object</code>
|
|
465
|
+
Set a nested property value an object.
|
|
466
|
+
|
|
467
|
+
**Kind**: static method of [<code>objectHelpers</code>](#module_objectHelpers)
|
|
468
|
+
**Returns**: <code>Object</code> - The modified object
|
|
469
|
+
|
|
470
|
+
| Param | Type | Default | Description |
|
|
471
|
+
| --- | --- | --- | --- |
|
|
472
|
+
| arrayObject | <code>Object</code> | | The array or object to set the property on |
|
|
473
|
+
| dotNotation | <code>string</code> | | The path for the property |
|
|
474
|
+
| value | <code>\*</code> | <code></code> | The default value to return if the property is not found |
|
|
475
|
+
|
|
476
|
+
<a name="module_objectHelpers.dotNotate"></a>
|
|
477
|
+
|
|
478
|
+
### objectHelpers.dotNotate(arrayObject, [retainObjects]) ⇒ <code>DotNotatedObject</code>
|
|
479
|
+
Convert an array or object to a single dimensional associative array with dot notation.
|
|
480
|
+
|
|
481
|
+
**Kind**: static method of [<code>objectHelpers</code>](#module_objectHelpers)
|
|
482
|
+
**Returns**: <code>DotNotatedObject</code> - The dot-notated object
|
|
483
|
+
|
|
484
|
+
| Param | Type | Default | Description |
|
|
485
|
+
| --- | --- | --- | --- |
|
|
486
|
+
| arrayObject | <code>Object</code> | | The array or object to dot-notate |
|
|
487
|
+
| [retainObjects] | <code>Array.<DotNotationString></code> | <code>[]</code> | An array of keys to retain as objects |
|
|
488
|
+
|
|
489
|
+
<a name="module_objectHelpers.dotGet"></a>
|
|
490
|
+
|
|
491
|
+
### objectHelpers.dotGet(arrayObject, dotNotation, [defaultValue]) ⇒ <code>\*</code>
|
|
492
|
+
Get a nested property value from an object.
|
|
493
|
+
|
|
494
|
+
**Kind**: static method of [<code>objectHelpers</code>](#module_objectHelpers)
|
|
495
|
+
**Returns**: <code>\*</code> - The value of the property
|
|
496
|
+
|
|
497
|
+
| Param | Type | Default | Description |
|
|
498
|
+
| --- | --- | --- | --- |
|
|
499
|
+
| arrayObject | <code>Object</code> | | The array or object to get the property from |
|
|
500
|
+
| dotNotation | <code>string</code> | | The path to the property |
|
|
501
|
+
| [defaultValue] | <code>string</code> \| <code>null</code> | <code>null</code> | The default value to return if the property is not found |
|
|
502
|
+
|
|
503
|
+
<a name="module_objectHelpers.cloneObject"></a>
|
|
504
|
+
|
|
505
|
+
### objectHelpers.cloneObject(object, [options]) ⇒ <code>Object</code>
|
|
506
|
+
Clone objects for manipulation without data corruption, returns a copy of the provided object.
|
|
507
|
+
NOTE: Use the mapLimit and relevancyRange to resolve "too much recursion" when the object is large and is known to
|
|
508
|
+
have circular references. A high mapLimit may lead to heavy memory usage and slow performance.
|
|
509
|
+
|
|
510
|
+
**Kind**: static method of [<code>objectHelpers</code>](#module_objectHelpers)
|
|
511
|
+
|
|
512
|
+
| Param | Type | Default | Description |
|
|
513
|
+
| --- | --- | --- | --- |
|
|
514
|
+
| object | <code>Object</code> | | The original object that is being cloned |
|
|
515
|
+
| [options] | <code>Object</code> | <code>{}</code> | |
|
|
516
|
+
| [options.mapLimit] | <code>number</code> | <code>100</code> | Size of temporary reference array used in memory before assessing relevancy. |
|
|
517
|
+
| [options.depthLimit] | <code>number</code> | <code>-1</code> | Control how many nested levels deep will be used, -1 = no limit, >-1 = nth level limited. |
|
|
518
|
+
| [options.relevancyRange] | <code>number</code> | <code>1000</code> | Total reference map length subtract this range, any relevancy less than that amount at time of evaluation will be removed. |
|
|
519
|
+
|
|
520
|
+
<a name="module_objectHelpers..handleRetainObjects"></a>
|
|
521
|
+
|
|
522
|
+
### objectHelpers~handleRetainObjects([retainObjects]) ⇒ <code>function</code>
|
|
523
|
+
Convert an array of keys into a regex, return a function to test if incoming keys match.
|
|
524
|
+
|
|
525
|
+
**Kind**: inner method of [<code>objectHelpers</code>](#module_objectHelpers)
|
|
526
|
+
**Returns**: <code>function</code> - The dot-notated array
|
|
527
|
+
|
|
528
|
+
| Param | Type | Default | Description |
|
|
529
|
+
| --- | --- | --- | --- |
|
|
530
|
+
| [retainObjects] | <code>Array.<DotNotationString></code> | <code>[]</code> | An array of keys to retain as objects |
|
|
531
|
+
|
|
532
|
+
<a name="module_objectHelpers..performDotNotate"></a>
|
|
533
|
+
|
|
534
|
+
### objectHelpers~performDotNotate(arrayObject, didRetain, [prepend], [results]) ⇒ <code>DotNotatedObject</code>
|
|
535
|
+
The underlying logic function for converting arrays to dot-notation.
|
|
536
|
+
|
|
537
|
+
**Kind**: inner method of [<code>objectHelpers</code>](#module_objectHelpers)
|
|
538
|
+
**Returns**: <code>DotNotatedObject</code> - The dot-notated object
|
|
539
|
+
|
|
540
|
+
| Param | Type | Default | Description |
|
|
541
|
+
| --- | --- | --- | --- |
|
|
542
|
+
| arrayObject | <code>Object</code> | | The array or object to dot-notate |
|
|
543
|
+
| didRetain | <code>function</code> | | The test function to see if a key should be retained |
|
|
544
|
+
| [prepend] | <code>DotNotationString</code> | <code>''</code> | The path for the property being processed |
|
|
545
|
+
| [results] | <code>DotNotatedObject</code> | <code>{}</code> | The final array to return |
|
|
546
|
+
|
|
547
|
+
<a name="module_numberHelpers"></a>
|
|
548
|
+
|
|
549
|
+
## numberHelpers
|
|
550
|
+
Some number comparators and random number generators.
|
|
551
|
+
|
|
552
|
+
**Version**: 1.0.0
|
|
553
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
554
|
+
|
|
555
|
+
* [numberHelpers](#module_numberHelpers)
|
|
556
|
+
* [.simplestRatio(...numbers)](#module_numberHelpers.simplestRatio) ⇒ <code>Array.<number></code>
|
|
557
|
+
* [.randomNumber(range, [offset], [interval])](#module_numberHelpers.randomNumber) ⇒ <code>number</code>
|
|
558
|
+
* [.randomInteger(range, [offset], [interval])](#module_numberHelpers.randomInteger) ⇒ <code>number</code>
|
|
559
|
+
* [.lowestCommonDenominator(...numbers)](#module_numberHelpers.lowestCommonDenominator) ⇒ <code>number</code>
|
|
560
|
+
* [.leastCommonMultiple(num1, num2)](#module_numberHelpers.leastCommonMultiple) ⇒ <code>number</code>
|
|
561
|
+
* [.greatestCommonDivisor(num1, num2)](#module_numberHelpers.greatestCommonDivisor) ⇒ <code>number</code>
|
|
562
|
+
* [.compare(val1, val2)](#module_numberHelpers.compare) ⇒ <code>number</code>
|
|
563
|
+
* [.absoluteMin(num1, num2)](#module_numberHelpers.absoluteMin) ⇒ <code>number</code>
|
|
564
|
+
* [.absoluteMax(num1, num2)](#module_numberHelpers.absoluteMax) ⇒ <code>number</code>
|
|
565
|
+
|
|
566
|
+
<a name="module_numberHelpers.simplestRatio"></a>
|
|
567
|
+
|
|
568
|
+
### numberHelpers.simplestRatio(...numbers) ⇒ <code>Array.<number></code>
|
|
569
|
+
Reduce several numbers to their simplest form / ratio
|
|
570
|
+
|
|
571
|
+
**Kind**: static method of [<code>numberHelpers</code>](#module_numberHelpers)
|
|
572
|
+
|
|
573
|
+
| Param | Type | Description |
|
|
574
|
+
| --- | --- | --- |
|
|
575
|
+
| ...numbers | <code>number</code> | Array of numbers to simplify |
|
|
576
|
+
|
|
577
|
+
<a name="module_numberHelpers.randomNumber"></a>
|
|
578
|
+
|
|
579
|
+
### numberHelpers.randomNumber(range, [offset], [interval]) ⇒ <code>number</code>
|
|
580
|
+
Create a single random number within provided range. And with optional offset,
|
|
581
|
+
The distance between the result numbers can be adjusted with interval.
|
|
582
|
+
|
|
583
|
+
**Kind**: static method of [<code>numberHelpers</code>](#module_numberHelpers)
|
|
584
|
+
|
|
585
|
+
| Param | Type | Default | Description |
|
|
586
|
+
| --- | --- | --- | --- |
|
|
587
|
+
| range | <code>number</code> | | Choose the breadth of the random number (0-100 would be 100 for range) |
|
|
588
|
+
| [offset] | <code>number</code> | <code>0</code> | Choose the starting number (1-10 would be 1 for offset, 9 for range) |
|
|
589
|
+
| [interval] | <code>number</code> | <code>1</code> | Choose the distance between numbers (~5, ~10, ~15 would be 5 for interval, 1 for offset, 2 for range) |
|
|
590
|
+
|
|
591
|
+
<a name="module_numberHelpers.randomInteger"></a>
|
|
592
|
+
|
|
593
|
+
### numberHelpers.randomInteger(range, [offset], [interval]) ⇒ <code>number</code>
|
|
594
|
+
Create a single random integer within provide range. And with optional offset,
|
|
595
|
+
The distance between the result numbers can be adjusted with interval.
|
|
596
|
+
|
|
597
|
+
**Kind**: static method of [<code>numberHelpers</code>](#module_numberHelpers)
|
|
598
|
+
|
|
599
|
+
| Param | Type | Default | Description |
|
|
600
|
+
| --- | --- | --- | --- |
|
|
601
|
+
| range | <code>number</code> | | Choose the breadth of the random number (0-100 would be 100 for range) |
|
|
602
|
+
| [offset] | <code>number</code> | <code>0</code> | Choose the starting number (1-10 would be 1 for offset, 9 for range) |
|
|
603
|
+
| [interval] | <code>number</code> | <code>1</code> | Choose the distance between numbers (5, 10, 15 would be 5 for interval, 1 for offset, 2 for range) |
|
|
604
|
+
|
|
605
|
+
<a name="module_numberHelpers.lowestCommonDenominator"></a>
|
|
606
|
+
|
|
607
|
+
### numberHelpers.lowestCommonDenominator(...numbers) ⇒ <code>number</code>
|
|
608
|
+
Find the smallest number that all the given numbers divide into evenly, by reducing them pairwise with
|
|
609
|
+
leastCommonMultiple.
|
|
610
|
+
|
|
611
|
+
**Kind**: static method of [<code>numberHelpers</code>](#module_numberHelpers)
|
|
612
|
+
|
|
613
|
+
| Param | Type | Description |
|
|
614
|
+
| --- | --- | --- |
|
|
615
|
+
| ...numbers | <code>number</code> | Two or more numbers to find the lowest common denominator of. |
|
|
616
|
+
|
|
617
|
+
<a name="module_numberHelpers.leastCommonMultiple"></a>
|
|
618
|
+
|
|
619
|
+
### numberHelpers.leastCommonMultiple(num1, num2) ⇒ <code>number</code>
|
|
620
|
+
Helper for calculating the multiplier that would make each number relative to each other.
|
|
621
|
+
|
|
622
|
+
**Kind**: static method of [<code>numberHelpers</code>](#module_numberHelpers)
|
|
623
|
+
|
|
624
|
+
| Param | Type | Description |
|
|
625
|
+
| --- | --- | --- |
|
|
626
|
+
| num1 | <code>number</code> | A number to compare |
|
|
627
|
+
| num2 | <code>number</code> | Another number to be compared against |
|
|
628
|
+
|
|
629
|
+
<a name="module_numberHelpers.greatestCommonDivisor"></a>
|
|
630
|
+
|
|
631
|
+
### numberHelpers.greatestCommonDivisor(num1, num2) ⇒ <code>number</code>
|
|
632
|
+
Return the highest number that can be divided into both numbers.
|
|
633
|
+
|
|
634
|
+
**Kind**: static method of [<code>numberHelpers</code>](#module_numberHelpers)
|
|
635
|
+
|
|
636
|
+
| Param | Type | Description |
|
|
637
|
+
| --- | --- | --- |
|
|
638
|
+
| num1 | <code>number</code> | First number to assess |
|
|
639
|
+
| num2 | <code>number</code> | Second number to compare for common divisor |
|
|
640
|
+
|
|
641
|
+
<a name="module_numberHelpers.compare"></a>
|
|
642
|
+
|
|
643
|
+
### numberHelpers.compare(val1, val2) ⇒ <code>number</code>
|
|
644
|
+
Compare two numbers and return:
|
|
645
|
+
-1 to indicate val1 is less than val2
|
|
646
|
+
0 to indicate both values are the equal
|
|
647
|
+
1 to indicate val1 is greater than val2
|
|
648
|
+
|
|
649
|
+
**Kind**: static method of [<code>numberHelpers</code>](#module_numberHelpers)
|
|
650
|
+
|
|
651
|
+
| Param | Type | Description |
|
|
652
|
+
| --- | --- | --- |
|
|
653
|
+
| val1 | <code>number</code> | The first number to compare |
|
|
654
|
+
| val2 | <code>number</code> | The second number to compare |
|
|
655
|
+
|
|
656
|
+
<a name="module_numberHelpers.absoluteMin"></a>
|
|
657
|
+
|
|
658
|
+
### numberHelpers.absoluteMin(num1, num2) ⇒ <code>number</code>
|
|
659
|
+
Helper for returning the absolute min value
|
|
660
|
+
|
|
661
|
+
**Kind**: static method of [<code>numberHelpers</code>](#module_numberHelpers)
|
|
662
|
+
|
|
663
|
+
| Param | Type | Description |
|
|
664
|
+
| --- | --- | --- |
|
|
665
|
+
| num1 | <code>number</code> | A number to compare |
|
|
666
|
+
| num2 | <code>number</code> | Another number to be compared against |
|
|
667
|
+
|
|
668
|
+
<a name="module_numberHelpers.absoluteMax"></a>
|
|
669
|
+
|
|
670
|
+
### numberHelpers.absoluteMax(num1, num2) ⇒ <code>number</code>
|
|
671
|
+
Helper for returning the absolute max value
|
|
672
|
+
|
|
673
|
+
**Kind**: static method of [<code>numberHelpers</code>](#module_numberHelpers)
|
|
674
|
+
|
|
675
|
+
| Param | Type | Description |
|
|
676
|
+
| --- | --- | --- |
|
|
677
|
+
| num1 | <code>number</code> | A number to compare |
|
|
678
|
+
| num2 | <code>number</code> | Another number to be compared against |
|
|
679
|
+
|
|
680
|
+
<a name="module_functionHelpers"></a>
|
|
681
|
+
|
|
682
|
+
## functionHelpers
|
|
683
|
+
Manage how functions are called with these utilities.
|
|
684
|
+
|
|
685
|
+
**Version**: 1.0.0
|
|
686
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
687
|
+
|
|
688
|
+
* [functionHelpers](#module_functionHelpers)
|
|
689
|
+
* [.trace(label, [useClone])](#module_functionHelpers.trace) ⇒ <code>function</code>
|
|
690
|
+
* [.relevancyFilter(map, [options])](#module_functionHelpers.relevancyFilter) ⇒ <code>relevanceMap</code>
|
|
691
|
+
* [.queueTimeout([queueManagerHandle])](#module_functionHelpers.queueTimeout) ⇒ <code>module:functionHelpers~queueTimeoutHandle</code>
|
|
692
|
+
* [.queueManager([queue])](#module_functionHelpers.queueManager) ⇒ <code>module:functionHelpers~queueManagerHandle</code>
|
|
693
|
+
* [~makeQueuedRunnable(resolve, reject, fn, ...args)](#module_functionHelpers.queueManager..makeQueuedRunnable) ⇒ <code>queuedRunnable</code>
|
|
694
|
+
* [~postRun(result)](#module_functionHelpers.queueManager..postRun) ⇒ <code>\*</code>
|
|
695
|
+
* [~runNextItem()](#module_functionHelpers.queueManager..runNextItem) ⇒ <code>IteratorYieldResult</code> \| <code>null</code>
|
|
696
|
+
* [~pushAnother(fn, ...args)](#module_functionHelpers.queueManager..pushAnother) ⇒
|
|
697
|
+
* [.preloadParams(fn, params, [unassignedParam])](#module_functionHelpers.preloadParams) ⇒ <code>module:functionHelpers~callWithMissing</code>
|
|
698
|
+
* [.pipe(...fns)](#module_functionHelpers.pipe) ⇒ <code>\*</code>
|
|
699
|
+
* [.onBodyLoad(callback, [reset])](#module_functionHelpers.onBodyLoad) ⇒ <code>Array.<function()></code>
|
|
700
|
+
* [.makeBasicQueue([initialQueue])](#module_functionHelpers.makeBasicQueue) ⇒ <code>IsQueue</code>
|
|
701
|
+
* [.delay(time)](#module_functionHelpers.delay) ⇒ <code>module:functionHelpers~delayHandler</code>
|
|
702
|
+
* [.curry(fn)](#module_functionHelpers.curry) ⇒ <code>function</code> \| <code>\*</code>
|
|
703
|
+
* [.callWithParams(fn, params, [minimum])](#module_functionHelpers.callWithParams) ⇒ <code>\*</code>
|
|
704
|
+
|
|
705
|
+
<a name="module_functionHelpers.trace"></a>
|
|
706
|
+
|
|
707
|
+
### functionHelpers.trace(label, [useClone]) ⇒ <code>function</code>
|
|
708
|
+
Output the value with label to the console and return the value to not interrupt the code - useful for
|
|
709
|
+
inspecting a value mid-pipe/mid-chain without altering the result.
|
|
710
|
+
|
|
711
|
+
**Kind**: static method of [<code>functionHelpers</code>](#module_functionHelpers)
|
|
712
|
+
|
|
713
|
+
| Param | Type | Default | Description |
|
|
714
|
+
| --- | --- | --- | --- |
|
|
715
|
+
| label | <code>string</code> | | Pass an identifying label of the value being output. |
|
|
716
|
+
| [useClone] | <code>boolean</code> | <code>true</code> | Determines if the logged data should be a clone of the original to preserve its state at the time of logging (rather than a live reference that may show later mutations). |
|
|
717
|
+
|
|
718
|
+
<a name="module_functionHelpers.relevancyFilter"></a>
|
|
719
|
+
|
|
720
|
+
### functionHelpers.relevancyFilter(map, [options]) ⇒ <code>relevanceMap</code>
|
|
721
|
+
Remove elements out of relevance range and update the max relevance.
|
|
722
|
+
|
|
723
|
+
**Kind**: static method of [<code>functionHelpers</code>](#module_functionHelpers)
|
|
724
|
+
|
|
725
|
+
| Param | Type | Default | Description |
|
|
726
|
+
| --- | --- | --- | --- |
|
|
727
|
+
| map | <code>relevanceMap</code> | | |
|
|
728
|
+
| [options] | <code>Object</code> | <code>{}</code> | |
|
|
729
|
+
| [options.mapLimit] | <code>number</code> | <code>1000</code> | Only filter once the map exceeds this many entries. |
|
|
730
|
+
| [options.relevancyRange] | <code>number</code> | <code>100</code> | How many of the most-recent relevance values to keep. |
|
|
731
|
+
|
|
732
|
+
<a name="module_functionHelpers.queueTimeout"></a>
|
|
733
|
+
|
|
734
|
+
### functionHelpers.queueTimeout([queueManagerHandle]) ⇒ <code>module:functionHelpers~queueTimeoutHandle</code>
|
|
735
|
+
Manage functions to run sequentially with delays.
|
|
736
|
+
|
|
737
|
+
**Kind**: static method of [<code>functionHelpers</code>](#module_functionHelpers)
|
|
738
|
+
|
|
739
|
+
| Param | Type | Default |
|
|
740
|
+
| --- | --- | --- |
|
|
741
|
+
| [queueManagerHandle] | <code>module:functionHelpers~queueManagerHandle</code> | <code></code> |
|
|
742
|
+
|
|
743
|
+
<a name="module_functionHelpers.queueManager"></a>
|
|
744
|
+
|
|
745
|
+
### functionHelpers.queueManager([queue]) ⇒ <code>module:functionHelpers~queueManagerHandle</code>
|
|
746
|
+
Manage functions to run sequentially.
|
|
747
|
+
|
|
748
|
+
**Kind**: static method of [<code>functionHelpers</code>](#module_functionHelpers)
|
|
749
|
+
|
|
750
|
+
| Param | Type | Default | Description |
|
|
751
|
+
| --- | --- | --- | --- |
|
|
752
|
+
| [queue] | <code>IsQueue</code> \| <code>Array</code> | <code></code> | The queue to manage. Pass a plain array to have it converted into a [BasicQueue](#module_arrayHelpers.BasicQueue) automatically, or a custom queue implementing `IsQueue`; omit it (or pass `null`) to have one created for you. |
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
* [.queueManager([queue])](#module_functionHelpers.queueManager) ⇒ <code>module:functionHelpers~queueManagerHandle</code>
|
|
756
|
+
* [~makeQueuedRunnable(resolve, reject, fn, ...args)](#module_functionHelpers.queueManager..makeQueuedRunnable) ⇒ <code>queuedRunnable</code>
|
|
757
|
+
* [~postRun(result)](#module_functionHelpers.queueManager..postRun) ⇒ <code>\*</code>
|
|
758
|
+
* [~runNextItem()](#module_functionHelpers.queueManager..runNextItem) ⇒ <code>IteratorYieldResult</code> \| <code>null</code>
|
|
759
|
+
* [~pushAnother(fn, ...args)](#module_functionHelpers.queueManager..pushAnother) ⇒
|
|
760
|
+
|
|
761
|
+
<a name="module_functionHelpers.queueManager..makeQueuedRunnable"></a>
|
|
762
|
+
|
|
763
|
+
#### queueManager~makeQueuedRunnable(resolve, reject, fn, ...args) ⇒ <code>queuedRunnable</code>
|
|
764
|
+
Convert a function to a queueable object.
|
|
765
|
+
|
|
766
|
+
**Kind**: inner method of [<code>queueManager</code>](#module_functionHelpers.queueManager)
|
|
767
|
+
|
|
768
|
+
| Param | Type |
|
|
769
|
+
| --- | --- |
|
|
770
|
+
| resolve | <code>Promise.resolve</code> |
|
|
771
|
+
| reject | <code>Promise.reject</code> |
|
|
772
|
+
| fn | <code>function</code> |
|
|
773
|
+
| ...args | <code>\*</code> |
|
|
774
|
+
|
|
775
|
+
<a name="module_functionHelpers.queueManager..postRun"></a>
|
|
776
|
+
|
|
777
|
+
#### queueManager~postRun(result) ⇒ <code>\*</code>
|
|
778
|
+
After an item is run, THEN run this function to reset isRunning
|
|
779
|
+
|
|
780
|
+
**Kind**: inner method of [<code>queueManager</code>](#module_functionHelpers.queueManager)
|
|
781
|
+
|
|
782
|
+
| Param | Type |
|
|
783
|
+
| --- | --- |
|
|
784
|
+
| result | <code>\*</code> |
|
|
785
|
+
|
|
786
|
+
<a name="module_functionHelpers.queueManager..runNextItem"></a>
|
|
787
|
+
|
|
788
|
+
#### queueManager~runNextItem() ⇒ <code>IteratorYieldResult</code> \| <code>null</code>
|
|
789
|
+
When ready, runs the next queued runnable generator.
|
|
790
|
+
|
|
791
|
+
**Kind**: inner method of [<code>queueManager</code>](#module_functionHelpers.queueManager)
|
|
792
|
+
<a name="module_functionHelpers.queueManager..pushAnother"></a>
|
|
793
|
+
|
|
794
|
+
#### queueManager~pushAnother(fn, ...args) ⇒
|
|
795
|
+
Add a function into the queue to be run when ready.
|
|
796
|
+
|
|
797
|
+
**Kind**: inner method of [<code>queueManager</code>](#module_functionHelpers.queueManager)
|
|
798
|
+
**Returns**: Promise
|
|
799
|
+
|
|
800
|
+
| Param | Type | Description |
|
|
801
|
+
| --- | --- | --- |
|
|
802
|
+
| fn | <code>function</code> | The function to run when ready |
|
|
803
|
+
| ...args | <code>\*</code> | Optional arguments to apply when the function is ready to be run |
|
|
804
|
+
|
|
805
|
+
<a name="module_functionHelpers.preloadParams"></a>
|
|
806
|
+
|
|
807
|
+
### functionHelpers.preloadParams(fn, params, [unassignedParam]) ⇒ <code>module:functionHelpers~callWithMissing</code>
|
|
808
|
+
Provide an array of parameters to be used with a function, allow the function to be called later
|
|
809
|
+
with the missing parameter.
|
|
810
|
+
|
|
811
|
+
**Kind**: static method of [<code>functionHelpers</code>](#module_functionHelpers)
|
|
812
|
+
|
|
813
|
+
| Param | Type | Default | Description |
|
|
814
|
+
| --- | --- | --- | --- |
|
|
815
|
+
| fn | <code>function</code> | | The function to be called |
|
|
816
|
+
| params | <code>Array</code> | | The parameters to preload |
|
|
817
|
+
| [unassignedParam] | <code>number</code> | <code>0</code> | Position of missing parameter (zero indexed) |
|
|
818
|
+
|
|
819
|
+
<a name="module_functionHelpers.pipe"></a>
|
|
820
|
+
|
|
821
|
+
### functionHelpers.pipe(...fns) ⇒ <code>\*</code>
|
|
822
|
+
Take one or more function with a single parameter and return value.
|
|
823
|
+
Pass a parameter and the value will be transformed by each function then returned.
|
|
824
|
+
|
|
825
|
+
**Kind**: static method of [<code>functionHelpers</code>](#module_functionHelpers)
|
|
826
|
+
|
|
827
|
+
| Param | Type | Description |
|
|
828
|
+
| --- | --- | --- |
|
|
829
|
+
| ...fns | <code>function</code> | Takes a series of functions having the same parameter |
|
|
830
|
+
|
|
831
|
+
<a name="module_functionHelpers.onBodyLoad"></a>
|
|
832
|
+
|
|
833
|
+
### functionHelpers.onBodyLoad(callback, [reset]) ⇒ <code>Array.<function()></code>
|
|
834
|
+
Prepare functions to be called once the body is available.
|
|
835
|
+
|
|
836
|
+
**Kind**: static method of [<code>functionHelpers</code>](#module_functionHelpers)
|
|
837
|
+
|
|
838
|
+
| Param | Type | Default |
|
|
839
|
+
| --- | --- | --- |
|
|
840
|
+
| callback | <code>function</code> | |
|
|
841
|
+
| [reset] | <code>boolean</code> | <code>false</code> |
|
|
842
|
+
|
|
843
|
+
<a name="module_functionHelpers.makeBasicQueue"></a>
|
|
844
|
+
|
|
845
|
+
### functionHelpers.makeBasicQueue([initialQueue]) ⇒ <code>IsQueue</code>
|
|
846
|
+
Create an instance of a basic queue.
|
|
847
|
+
|
|
848
|
+
**Kind**: static method of [<code>functionHelpers</code>](#module_functionHelpers)
|
|
849
|
+
|
|
850
|
+
| Param | Type | Default | Description |
|
|
851
|
+
| --- | --- | --- | --- |
|
|
852
|
+
| [initialQueue] | <code>Array</code> | <code>[]</code> | Items to pre-populate the queue with, in order. |
|
|
853
|
+
|
|
854
|
+
<a name="module_functionHelpers.delay"></a>
|
|
855
|
+
|
|
856
|
+
### functionHelpers.delay(time) ⇒ <code>module:functionHelpers~delayHandler</code>
|
|
857
|
+
Provide a timeout which returns a promise.
|
|
858
|
+
|
|
859
|
+
**Kind**: static method of [<code>functionHelpers</code>](#module_functionHelpers)
|
|
860
|
+
|
|
861
|
+
| Param | Type | Default | Description |
|
|
862
|
+
| --- | --- | --- | --- |
|
|
863
|
+
| time | <code>number</code> | <code>0</code> | Delay in milliseconds |
|
|
864
|
+
|
|
865
|
+
<a name="module_functionHelpers.curry"></a>
|
|
866
|
+
|
|
867
|
+
### functionHelpers.curry(fn) ⇒ <code>function</code> \| <code>\*</code>
|
|
868
|
+
Return a curried version of the passed function.
|
|
869
|
+
The returned function expects the same number of arguments minus the ones provided.
|
|
870
|
+
fn is the name of the function being curried.
|
|
871
|
+
|
|
872
|
+
**Kind**: static method of [<code>functionHelpers</code>](#module_functionHelpers)
|
|
873
|
+
|
|
874
|
+
| Param | Type | Description |
|
|
875
|
+
| --- | --- | --- |
|
|
876
|
+
| fn | <code>function</code> | Receives a function to be curried |
|
|
877
|
+
|
|
878
|
+
<a name="module_functionHelpers.callWithParams"></a>
|
|
879
|
+
|
|
880
|
+
### functionHelpers.callWithParams(fn, params, [minimum]) ⇒ <code>\*</code>
|
|
881
|
+
Given a function, call with the correct number of parameters from an array of possible parameters.
|
|
882
|
+
|
|
883
|
+
**Kind**: static method of [<code>functionHelpers</code>](#module_functionHelpers)
|
|
884
|
+
|
|
885
|
+
| Param | Type | Default | Description |
|
|
886
|
+
| --- | --- | --- | --- |
|
|
887
|
+
| fn | <code>function</code> | | The function to be called |
|
|
888
|
+
| params | <code>Array</code> | | Array of possible function parameters |
|
|
889
|
+
| [minimum] | <code>number</code> | <code>2</code> | Minimum number of parameters to use in the function |
|
|
890
|
+
|
|
891
|
+
<a name="module_objectDescriptors"></a>
|
|
892
|
+
|
|
893
|
+
## objectDescriptors
|
|
894
|
+
A "descriptor" is a flat, serializable snapshot of an object or array's shape: for each property, its type(s),
|
|
895
|
+
whether it's nullable, and - if the property's own value is itself an object/array - a reference to that nested
|
|
896
|
+
value's own descriptor elsewhere in the same list, rather than nesting descriptors inside descriptors. This flat,
|
|
897
|
+
reference-based structure is what lets these utilities walk deeply nested and even circular object graphs (an
|
|
898
|
+
object that contains itself, directly or indirectly) without infinite recursion, since a value that's already
|
|
899
|
+
been described is simply pointed to again instead of re-described.
|
|
900
|
+
|
|
901
|
+
Start with [describeObjectMap](#module_objectDescriptors.describeObjectMap), which takes any real object or array and produces
|
|
902
|
+
this flat list of descriptors for you - the other functions here (comparing, merging, cloning descriptors) are
|
|
903
|
+
building blocks used internally, or useful once you already have descriptors to work with directly.
|
|
904
|
+
|
|
905
|
+
The concrete use this module has earned its keep on: describing two objects and comparing the results tells
|
|
906
|
+
you whether they're the same shape and values even when they're different references entirely (see
|
|
907
|
+
[sameDescriptor](#module_objectDescriptors.sameDescriptor)/[compareDescriptor](#module_objectDescriptors.compareDescriptor)) - useful
|
|
908
|
+
anywhere you need to check that two objects genuinely match without caring whether they're literally the same
|
|
909
|
+
instance. A descriptor also doubles as a flat, structured summary of an object's shape, which can be handy for
|
|
910
|
+
discussion or assessment purposes (e.g. describing what an object looks like without dumping the whole thing).
|
|
911
|
+
|
|
912
|
+
**Version**: 1.0.0
|
|
913
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
914
|
+
|
|
915
|
+
* [objectDescriptors](#module_objectDescriptors)
|
|
916
|
+
* [.mappedDescriptorMap](#module_objectDescriptors.mappedDescriptorMap) : <code>module:objectDescriptors~descriptorMap</code>
|
|
917
|
+
* [.descriptorMapSample](#module_objectDescriptors.descriptorMapSample) : <code>module:objectDescriptors~descriptorMap</code>
|
|
918
|
+
* [.descriptorDetailSample](#module_objectDescriptors.descriptorDetailSample) : <code>module:objectDescriptors~descriptorDetail</code>
|
|
919
|
+
* [.descriptorSample](#module_objectDescriptors.descriptorSample) : <code>module:objectDescriptors~descriptor</code>
|
|
920
|
+
* [.sameDescriptor(descriptor1, descriptor2)](#module_objectDescriptors.sameDescriptor) ⇒ <code>boolean</code>
|
|
921
|
+
* [.nextReference(descriptor, currentReference)](#module_objectDescriptors.nextReference) ⇒ <code>number</code> \| <code>undefined</code>
|
|
922
|
+
* [.describeObjectMap(object, [options])](#module_objectDescriptors.describeObjectMap) ⇒ <code>module:objectDescriptors~descriptorMap</code>
|
|
923
|
+
* [.describeObjectDetail(value, [key], [index])](#module_objectDescriptors.describeObjectDetail) ⇒ <code>module:objectDescriptors~descriptorDetail</code>
|
|
924
|
+
* [.describeObject(object)](#module_objectDescriptors.describeObject) ⇒ <code>module:objectDescriptors~descriptor</code>
|
|
925
|
+
* [.compareDescriptor(descriptor1, descriptor2)](#module_objectDescriptors.compareDescriptor) ⇒ <code>boolean</code>
|
|
926
|
+
* [.cloneDescriptorDetail(originalDetail)](#module_objectDescriptors.cloneDescriptorDetail) ⇒ <code>module:objectDescriptors~descriptorDetail</code>
|
|
927
|
+
* [.cloneDescriptor(originalMap)](#module_objectDescriptors.cloneDescriptor) ⇒ <code>module:objectDescriptors~descriptor</code>
|
|
928
|
+
* [.checkDescriptorComplete(descriptor)](#module_objectDescriptors.checkDescriptorComplete) ⇒ <code>module:objectDescriptors~descriptor</code>
|
|
929
|
+
* [.checkClearValues(descriptor, [keepValues])](#module_objectDescriptors.checkClearValues) ⇒ <code>module:objectDescriptors~descriptor</code>
|
|
930
|
+
* [.assignDescriptorDetail(originalDetail, ...details)](#module_objectDescriptors.assignDescriptorDetail) ⇒ <code>module:objectDescriptors~descriptorDetail</code>
|
|
931
|
+
* [.assignDescriptor(originalMap, ...descriptors)](#module_objectDescriptors.assignDescriptor) ⇒ <code>module:objectDescriptors~descriptor</code>
|
|
932
|
+
|
|
933
|
+
<a name="module_objectDescriptors.mappedDescriptorMap"></a>
|
|
934
|
+
|
|
935
|
+
### objectDescriptors.mappedDescriptorMap : <code>module:objectDescriptors~descriptorMap</code>
|
|
936
|
+
A worked example descriptorMap, produced by describing a `descriptor` value itself (i.e. describing the shape of
|
|
937
|
+
a descriptor) - useful as a realistic fixture showing what a multi-entry descriptorMap with actual references
|
|
938
|
+
looks like, since `descriptorSample`/`descriptorMapSample` alone only demonstrate a trivial single-entry case.
|
|
939
|
+
|
|
940
|
+
**Kind**: static constant of [<code>objectDescriptors</code>](#module_objectDescriptors)
|
|
941
|
+
<a name="module_objectDescriptors.descriptorMapSample"></a>
|
|
942
|
+
|
|
943
|
+
### objectDescriptors.descriptorMapSample : <code>module:objectDescriptors~descriptorMap</code>
|
|
944
|
+
**Kind**: static constant of [<code>objectDescriptors</code>](#module_objectDescriptors)
|
|
945
|
+
<a name="module_objectDescriptors.descriptorDetailSample"></a>
|
|
946
|
+
|
|
947
|
+
### objectDescriptors.descriptorDetailSample : <code>module:objectDescriptors~descriptorDetail</code>
|
|
948
|
+
**Kind**: static constant of [<code>objectDescriptors</code>](#module_objectDescriptors)
|
|
949
|
+
<a name="module_objectDescriptors.descriptorSample"></a>
|
|
950
|
+
|
|
951
|
+
### objectDescriptors.descriptorSample : <code>module:objectDescriptors~descriptor</code>
|
|
952
|
+
**Kind**: static constant of [<code>objectDescriptors</code>](#module_objectDescriptors)
|
|
953
|
+
<a name="module_objectDescriptors.sameDescriptor"></a>
|
|
954
|
+
|
|
955
|
+
### objectDescriptors.sameDescriptor(descriptor1, descriptor2) ⇒ <code>boolean</code>
|
|
956
|
+
Check if two descriptors describe the exact same underlying values (not just compatible types, like
|
|
957
|
+
[compareDescriptor](#module_objectDescriptors.compareDescriptor) does) - used to detect genuine circular references, where a
|
|
958
|
+
nested value's descriptor turns out to be identical to one of its own ancestors.
|
|
959
|
+
|
|
960
|
+
**Kind**: static method of [<code>objectDescriptors</code>](#module_objectDescriptors)
|
|
961
|
+
**Returns**: <code>boolean</code> - True if every detail's values match at the same position.
|
|
962
|
+
|
|
963
|
+
| Param | Type | Description |
|
|
964
|
+
| --- | --- | --- |
|
|
965
|
+
| descriptor1 | <code>module:objectDescriptors~descriptor</code> | The first descriptor to compare. |
|
|
966
|
+
| descriptor2 | <code>module:objectDescriptors~descriptor</code> | The second descriptor to compare. |
|
|
967
|
+
|
|
968
|
+
<a name="module_objectDescriptors.nextReference"></a>
|
|
969
|
+
|
|
970
|
+
### objectDescriptors.nextReference(descriptor, currentReference) ⇒ <code>number</code> \| <code>undefined</code>
|
|
971
|
+
Find the index (within `descriptor.details`) of the next referenced property - after `currentReference` - whose
|
|
972
|
+
own nested object/array still needs its descriptor built. Used to walk through a descriptor's references one at
|
|
973
|
+
a time while building out a descriptorMap.
|
|
974
|
+
|
|
975
|
+
**Kind**: static method of [<code>objectDescriptors</code>](#module_objectDescriptors)
|
|
976
|
+
**Returns**: <code>number</code> \| <code>undefined</code> - The next detail index to process, or `undefined` if none remain.
|
|
977
|
+
|
|
978
|
+
| Param | Type | Description |
|
|
979
|
+
| --- | --- | --- |
|
|
980
|
+
| descriptor | <code>module:objectDescriptors~descriptor</code> | The descriptor whose references to search. |
|
|
981
|
+
| currentReference | <code>number</code> | The `details` index already processed - search continues after this one. |
|
|
982
|
+
|
|
983
|
+
<a name="module_objectDescriptors.describeObjectMap"></a>
|
|
984
|
+
|
|
985
|
+
### objectDescriptors.describeObjectMap(object, [options]) ⇒ <code>module:objectDescriptors~descriptorMap</code>
|
|
986
|
+
Trace out the entire object including nested objects, producing a flat descriptorMap - see the
|
|
987
|
+
[objectDescriptors](#module_objectDescriptors) module description for what a descriptor represents and why it's flat. This is
|
|
988
|
+
the main entry point into this module: start here to describe a real object/array before comparing, merging, or
|
|
989
|
+
inspecting its structure with the other functions in this module.
|
|
990
|
+
|
|
991
|
+
**Kind**: static method of [<code>objectDescriptors</code>](#module_objectDescriptors)
|
|
992
|
+
|
|
993
|
+
| Param | Type | Default | Description |
|
|
994
|
+
| --- | --- | --- | --- |
|
|
995
|
+
| object | <code>Object</code> \| <code>Array</code> | | The real object or array to describe. |
|
|
996
|
+
| [options] | <code>Object</code> | <code>{}</code> | |
|
|
997
|
+
| [options.mapLimit] | <code>number</code> | <code>1000000000</code> | Stop describing further nested references once the map reaches this many descriptors - a safety limit for extremely large or deeply-referenced structures. |
|
|
998
|
+
| [options.depthLimit] | <code>number</code> | <code>-1</code> | How many levels of nested objects/arrays to describe; `-1` means no limit, `0` describes only the top level, etc. |
|
|
999
|
+
| [options.keepValues] | <code>boolean</code> | <code>false</code> | By default, each detail's actual values are cleared once its descriptor is complete (to save memory) - set true to keep them. |
|
|
1000
|
+
|
|
1001
|
+
**Example**
|
|
1002
|
+
```js
|
|
1003
|
+
describeObjectMap({ name: 'example', tags: ['a', 'b'] })
|
|
1004
|
+
// [
|
|
1005
|
+
// { index: 0, details: [...], length: 2, keys: ['name', 'tags'], references: [1], isArray: false, complete: true },
|
|
1006
|
+
// { index: 1, details: [...], length: 2, keys: [0], references: [], isArray: true, complete: true }
|
|
1007
|
+
// ]
|
|
1008
|
+
// descriptorMap[0] describes the top-level object; its 'tags' property is a reference (references: [1]) to
|
|
1009
|
+
// descriptorMap[1], which separately describes that nested array. descriptorMap[1]'s own `length` (2) reflects
|
|
1010
|
+
// the array's actual length, but `keys` has only one entry (0) since both elements share the same type
|
|
1011
|
+
// ('string') and are described together by a single, representative descriptorDetail.
|
|
1012
|
+
```
|
|
1013
|
+
<a name="module_objectDescriptors.describeObjectDetail"></a>
|
|
1014
|
+
|
|
1015
|
+
### objectDescriptors.describeObjectDetail(value, [key], [index]) ⇒ <code>module:objectDescriptors~descriptorDetail</code>
|
|
1016
|
+
Trace a single property's value and produce the descriptorDetail describing it (type, nullability, whether it
|
|
1017
|
+
references a nested object/array, etc.) - the per-property building block used by
|
|
1018
|
+
[describeObject](#module_objectDescriptors.describeObject).
|
|
1019
|
+
|
|
1020
|
+
**Kind**: static method of [<code>objectDescriptors</code>](#module_objectDescriptors)
|
|
1021
|
+
|
|
1022
|
+
| Param | Type | Default | Description |
|
|
1023
|
+
| --- | --- | --- | --- |
|
|
1024
|
+
| value | <code>\*</code> | | The property's value to describe. |
|
|
1025
|
+
| [key] | <code>string</code> \| <code>number</code> | <code>0</code> | The property name (or array index) this value belongs to. |
|
|
1026
|
+
| [index] | <code>number</code> | <code>0</code> | This detail's intended position within its parent descriptor's `details` array. |
|
|
1027
|
+
|
|
1028
|
+
<a name="module_objectDescriptors.describeObject"></a>
|
|
1029
|
+
|
|
1030
|
+
### objectDescriptors.describeObject(object) ⇒ <code>module:objectDescriptors~descriptor</code>
|
|
1031
|
+
Trace a single object or array (not its nested objects/arrays - see
|
|
1032
|
+
[describeObjectMap](#module_objectDescriptors.describeObjectMap) for that) and return the descriptor which defines its own
|
|
1033
|
+
structure and attributes.
|
|
1034
|
+
|
|
1035
|
+
**Kind**: static method of [<code>objectDescriptors</code>](#module_objectDescriptors)
|
|
1036
|
+
|
|
1037
|
+
| Param | Type | Description |
|
|
1038
|
+
| --- | --- | --- |
|
|
1039
|
+
| object | <code>Object</code> \| <code>Array</code> | The object or array to describe. |
|
|
1040
|
+
|
|
1041
|
+
<a name="module_objectDescriptors.compareDescriptor"></a>
|
|
1042
|
+
|
|
1043
|
+
### objectDescriptors.compareDescriptor(descriptor1, descriptor2) ⇒ <code>boolean</code>
|
|
1044
|
+
Check if two descriptors are the same or similar, in that the smaller one's keys are all present in the larger
|
|
1045
|
+
one and their types line up - used to detect when a newly-described value actually matches a descriptor already
|
|
1046
|
+
in the map, so it can be pointed at instead of creating a duplicate.
|
|
1047
|
+
|
|
1048
|
+
**Kind**: static method of [<code>objectDescriptors</code>](#module_objectDescriptors)
|
|
1049
|
+
**Returns**: <code>boolean</code> - True if the descriptors describe a compatible shape.
|
|
1050
|
+
|
|
1051
|
+
| Param | Type | Description |
|
|
1052
|
+
| --- | --- | --- |
|
|
1053
|
+
| descriptor1 | <code>module:objectDescriptors~descriptor</code> | The first descriptor to compare. |
|
|
1054
|
+
| descriptor2 | <code>module:objectDescriptors~descriptor</code> | The second descriptor to compare. |
|
|
1055
|
+
|
|
1056
|
+
<a name="module_objectDescriptors.cloneDescriptorDetail"></a>
|
|
1057
|
+
|
|
1058
|
+
### objectDescriptors.cloneDescriptorDetail(originalDetail) ⇒ <code>module:objectDescriptors~descriptorDetail</code>
|
|
1059
|
+
Get a new copy of an existing descriptor detail so that the original will not be mutated.
|
|
1060
|
+
|
|
1061
|
+
**Kind**: static method of [<code>objectDescriptors</code>](#module_objectDescriptors)
|
|
1062
|
+
**Returns**: <code>module:objectDescriptors~descriptorDetail</code> - A new, independent copy.
|
|
1063
|
+
|
|
1064
|
+
| Param | Type | Description |
|
|
1065
|
+
| --- | --- | --- |
|
|
1066
|
+
| originalDetail | <code>module:objectDescriptors~descriptorDetail</code> | The detail to copy. |
|
|
1067
|
+
|
|
1068
|
+
<a name="module_objectDescriptors.cloneDescriptor"></a>
|
|
1069
|
+
|
|
1070
|
+
### objectDescriptors.cloneDescriptor(originalMap) ⇒ <code>module:objectDescriptors~descriptor</code>
|
|
1071
|
+
Make a copy of an object descriptor so that the original will not be mutated.
|
|
1072
|
+
|
|
1073
|
+
**Kind**: static method of [<code>objectDescriptors</code>](#module_objectDescriptors)
|
|
1074
|
+
**Returns**: <code>module:objectDescriptors~descriptor</code> - A new, independent copy.
|
|
1075
|
+
|
|
1076
|
+
| Param | Type | Description |
|
|
1077
|
+
| --- | --- | --- |
|
|
1078
|
+
| originalMap | <code>module:objectDescriptors~descriptor</code> | The descriptor to copy. |
|
|
1079
|
+
|
|
1080
|
+
<a name="module_objectDescriptors.checkDescriptorComplete"></a>
|
|
1081
|
+
|
|
1082
|
+
### objectDescriptors.checkDescriptorComplete(descriptor) ⇒ <code>module:objectDescriptors~descriptor</code>
|
|
1083
|
+
Check if every property this descriptor references (i.e. every nested object/array it points to) has actually
|
|
1084
|
+
had its own descriptor built yet, and set the descriptor's `complete` flag to true if so.
|
|
1085
|
+
|
|
1086
|
+
**Kind**: static method of [<code>objectDescriptors</code>](#module_objectDescriptors)
|
|
1087
|
+
**Returns**: <code>module:objectDescriptors~descriptor</code> - The same descriptor, with `complete` updated.
|
|
1088
|
+
|
|
1089
|
+
| Param | Type | Description |
|
|
1090
|
+
| --- | --- | --- |
|
|
1091
|
+
| descriptor | <code>module:objectDescriptors~descriptor</code> | The descriptor to check. |
|
|
1092
|
+
|
|
1093
|
+
<a name="module_objectDescriptors.checkClearValues"></a>
|
|
1094
|
+
|
|
1095
|
+
### objectDescriptors.checkClearValues(descriptor, [keepValues]) ⇒ <code>module:objectDescriptors~descriptor</code>
|
|
1096
|
+
Once a descriptor is complete (all its references have been resolved), its details' actual `value` arrays are no
|
|
1097
|
+
longer needed to build the descriptor further - clear them to save memory, unless `keepValues` says otherwise.
|
|
1098
|
+
|
|
1099
|
+
**Kind**: static method of [<code>objectDescriptors</code>](#module_objectDescriptors)
|
|
1100
|
+
**Returns**: <code>module:objectDescriptors~descriptor</code> - The same descriptor, with `details[].value` cleared if applicable.
|
|
1101
|
+
|
|
1102
|
+
| Param | Type | Default | Description |
|
|
1103
|
+
| --- | --- | --- | --- |
|
|
1104
|
+
| descriptor | <code>module:objectDescriptors~descriptor</code> | | The descriptor to check. |
|
|
1105
|
+
| [keepValues] | <code>boolean</code> | <code>false</code> | Set true to keep the values even once the descriptor is complete. |
|
|
1106
|
+
|
|
1107
|
+
<a name="module_objectDescriptors.assignDescriptorDetail"></a>
|
|
1108
|
+
|
|
1109
|
+
### objectDescriptors.assignDescriptorDetail(originalDetail, ...details) ⇒ <code>module:objectDescriptors~descriptorDetail</code>
|
|
1110
|
+
Assign properties from other details onto an existing detail, widening it (e.g. combining `type`/`value` arrays,
|
|
1111
|
+
OR-ing boolean flags like `nullable`/`optional`) rather than overwriting it - the per-property counterpart to
|
|
1112
|
+
[assignDescriptor](#module_objectDescriptors.assignDescriptor).
|
|
1113
|
+
|
|
1114
|
+
**Kind**: static method of [<code>objectDescriptors</code>](#module_objectDescriptors)
|
|
1115
|
+
**Returns**: <code>module:objectDescriptors~descriptorDetail</code> - A new detail representing the merge of all of the above.
|
|
1116
|
+
|
|
1117
|
+
| Param | Type | Description |
|
|
1118
|
+
| --- | --- | --- |
|
|
1119
|
+
| originalDetail | <code>module:objectDescriptors~descriptorDetail</code> | The base detail to merge onto (not mutated - a clone is merged and returned). |
|
|
1120
|
+
| ...details | <code>module:objectDescriptors~descriptorDetail</code> | One or more further details to merge in. |
|
|
1121
|
+
|
|
1122
|
+
<a name="module_objectDescriptors.assignDescriptor"></a>
|
|
1123
|
+
|
|
1124
|
+
### objectDescriptors.assignDescriptor(originalMap, ...descriptors) ⇒ <code>module:objectDescriptors~descriptor</code>
|
|
1125
|
+
Apply one or more descriptors to an existing descriptor so that they represent a merged version of the descriptors.
|
|
1126
|
+
Used to widen a descriptor as more differently-shaped objects are described into it (e.g. array elements of
|
|
1127
|
+
different types), rather than replacing it outright.
|
|
1128
|
+
|
|
1129
|
+
**Kind**: static method of [<code>objectDescriptors</code>](#module_objectDescriptors)
|
|
1130
|
+
**Returns**: <code>module:objectDescriptors~descriptor</code> - A new descriptor representing the merge of all of the above.
|
|
1131
|
+
|
|
1132
|
+
| Param | Type | Description |
|
|
1133
|
+
| --- | --- | --- |
|
|
1134
|
+
| originalMap | <code>module:objectDescriptors~descriptor</code> | The base descriptor to merge onto (not mutated - a clone is merged and returned). |
|
|
1135
|
+
| ...descriptors | <code>module:objectDescriptors~descriptor</code> | One or more further descriptors to merge in. |
|
|
1136
|
+
|
|
1137
|
+
<a name="module_arrayHelpers"></a>
|
|
1138
|
+
|
|
1139
|
+
## arrayHelpers
|
|
1140
|
+
Utilities for building, merging, deduplicating and comparing arrays, plus a basic FIFO queue (BasicQueue) for
|
|
1141
|
+
use with functionHelpers' queueManager/queueTimeout.
|
|
1142
|
+
|
|
1143
|
+
**Version**: 1.0.0
|
|
1144
|
+
**Author**: Joshua Heagle <joshuaheagle@gmail.com>
|
|
1145
|
+
|
|
1146
|
+
* [arrayHelpers](#module_arrayHelpers)
|
|
1147
|
+
* [.BasicQueue](#module_arrayHelpers.BasicQueue)
|
|
1148
|
+
* [new BasicQueue([innerList])](#new_module_arrayHelpers.BasicQueue_new)
|
|
1149
|
+
* [.dequeue()](#module_arrayHelpers.BasicQueue+dequeue) ⇒ <code>queuedItem</code> \| <code>\*</code>
|
|
1150
|
+
* [.empty()](#module_arrayHelpers.BasicQueue+empty) ⇒ <code>boolean</code>
|
|
1151
|
+
* [.enqueue(data)](#module_arrayHelpers.BasicQueue+enqueue) ⇒ <code>BasicQueue</code>
|
|
1152
|
+
* [.peek()](#module_arrayHelpers.BasicQueue+peek) ⇒ <code>queuedItem</code> \| <code>\*</code>
|
|
1153
|
+
* [.size()](#module_arrayHelpers.BasicQueue+size) ⇒ <code>number</code>
|
|
1154
|
+
* [.uniqueArray(array)](#module_arrayHelpers.uniqueArray) ⇒ <code>Array</code>
|
|
1155
|
+
* [.mergeArrays(...arrays)](#module_arrayHelpers.mergeArrays) ⇒ <code>Array</code>
|
|
1156
|
+
* [.compareArrays(...arrays)](#module_arrayHelpers.compareArrays) ⇒ <code>Array.<module:arrayHelpers~compareArrayResult></code>
|
|
1157
|
+
* [.buildArrayOfReferences(item, length)](#module_arrayHelpers.buildArrayOfReferences) ⇒ <code>Array.<\*></code>
|
|
1158
|
+
* [.buildArray(item, length)](#module_arrayHelpers.buildArray) ⇒ <code>Array.<\*></code>
|
|
1159
|
+
* [.addUniqueToArray(item, array)](#module_arrayHelpers.addUniqueToArray) ⇒ <code>Array</code>
|
|
1160
|
+
|
|
1161
|
+
<a name="module_arrayHelpers.BasicQueue"></a>
|
|
1162
|
+
|
|
1163
|
+
### arrayHelpers.BasicQueue
|
|
1164
|
+
Class BasicQueue is a functional example of a queue to be used with queueManager.
|
|
1165
|
+
|
|
1166
|
+
**Kind**: static class of [<code>arrayHelpers</code>](#module_arrayHelpers)
|
|
1167
|
+
|
|
1168
|
+
* [.BasicQueue](#module_arrayHelpers.BasicQueue)
|
|
1169
|
+
* [new BasicQueue([innerList])](#new_module_arrayHelpers.BasicQueue_new)
|
|
1170
|
+
* [.dequeue()](#module_arrayHelpers.BasicQueue+dequeue) ⇒ <code>queuedItem</code> \| <code>\*</code>
|
|
1171
|
+
* [.empty()](#module_arrayHelpers.BasicQueue+empty) ⇒ <code>boolean</code>
|
|
1172
|
+
* [.enqueue(data)](#module_arrayHelpers.BasicQueue+enqueue) ⇒ <code>BasicQueue</code>
|
|
1173
|
+
* [.peek()](#module_arrayHelpers.BasicQueue+peek) ⇒ <code>queuedItem</code> \| <code>\*</code>
|
|
1174
|
+
* [.size()](#module_arrayHelpers.BasicQueue+size) ⇒ <code>number</code>
|
|
1175
|
+
|
|
1176
|
+
<a name="new_module_arrayHelpers.BasicQueue_new"></a>
|
|
1177
|
+
|
|
1178
|
+
#### new BasicQueue([innerList])
|
|
1179
|
+
|
|
1180
|
+
| Param | Type | Default | Description |
|
|
1181
|
+
| --- | --- | --- | --- |
|
|
1182
|
+
| [innerList] | <code>Array</code> | <code>[]</code> | Items to pre-populate the queue with, in order. |
|
|
1183
|
+
|
|
1184
|
+
<a name="module_arrayHelpers.BasicQueue+dequeue"></a>
|
|
1185
|
+
|
|
1186
|
+
#### basicQueue.dequeue() ⇒ <code>queuedItem</code> \| <code>\*</code>
|
|
1187
|
+
Remove and return the next item in the queue
|
|
1188
|
+
|
|
1189
|
+
**Kind**: instance method of [<code>BasicQueue</code>](#module_arrayHelpers.BasicQueue)
|
|
1190
|
+
<a name="module_arrayHelpers.BasicQueue+empty"></a>
|
|
1191
|
+
|
|
1192
|
+
#### basicQueue.empty() ⇒ <code>boolean</code>
|
|
1193
|
+
Check if the queue is empty
|
|
1194
|
+
|
|
1195
|
+
**Kind**: instance method of [<code>BasicQueue</code>](#module_arrayHelpers.BasicQueue)
|
|
1196
|
+
<a name="module_arrayHelpers.BasicQueue+enqueue"></a>
|
|
1197
|
+
|
|
1198
|
+
#### basicQueue.enqueue(data) ⇒ <code>BasicQueue</code>
|
|
1199
|
+
Add an item to the end of the queue
|
|
1200
|
+
|
|
1201
|
+
**Kind**: instance method of [<code>BasicQueue</code>](#module_arrayHelpers.BasicQueue)
|
|
1202
|
+
|
|
1203
|
+
| Param | Type |
|
|
1204
|
+
| --- | --- |
|
|
1205
|
+
| data | <code>queuedItem</code> \| <code>\*</code> |
|
|
1206
|
+
|
|
1207
|
+
<a name="module_arrayHelpers.BasicQueue+peek"></a>
|
|
1208
|
+
|
|
1209
|
+
#### basicQueue.peek() ⇒ <code>queuedItem</code> \| <code>\*</code>
|
|
1210
|
+
Retrieve the next item from the queue
|
|
1211
|
+
|
|
1212
|
+
**Kind**: instance method of [<code>BasicQueue</code>](#module_arrayHelpers.BasicQueue)
|
|
1213
|
+
<a name="module_arrayHelpers.BasicQueue+size"></a>
|
|
1214
|
+
|
|
1215
|
+
#### basicQueue.size() ⇒ <code>number</code>
|
|
1216
|
+
Get the quantity of items in the queue
|
|
1217
|
+
|
|
1218
|
+
**Kind**: instance method of [<code>BasicQueue</code>](#module_arrayHelpers.BasicQueue)
|
|
1219
|
+
<a name="module_arrayHelpers.uniqueArray"></a>
|
|
1220
|
+
|
|
1221
|
+
### arrayHelpers.uniqueArray(array) ⇒ <code>Array</code>
|
|
1222
|
+
Remove duplicate values from an array. uniqueArray
|
|
1223
|
+
|
|
1224
|
+
**Kind**: static method of [<code>arrayHelpers</code>](#module_arrayHelpers)
|
|
1225
|
+
|
|
1226
|
+
| Param | Type | Description |
|
|
1227
|
+
| --- | --- | --- |
|
|
1228
|
+
| array | <code>Array</code> | The array to make unique |
|
|
1229
|
+
|
|
1230
|
+
<a name="module_arrayHelpers.mergeArrays"></a>
|
|
1231
|
+
|
|
1232
|
+
### arrayHelpers.mergeArrays(...arrays) ⇒ <code>Array</code>
|
|
1233
|
+
Take multiple arrays and then filter all these into one unique array.
|
|
1234
|
+
|
|
1235
|
+
**Kind**: static method of [<code>arrayHelpers</code>](#module_arrayHelpers)
|
|
1236
|
+
|
|
1237
|
+
| Param | Type | Description |
|
|
1238
|
+
| --- | --- | --- |
|
|
1239
|
+
| ...arrays | <code>Array</code> | Provide multiple arrays to create one unique array |
|
|
1240
|
+
|
|
1241
|
+
<a name="module_arrayHelpers.compareArrays"></a>
|
|
1242
|
+
|
|
1243
|
+
### arrayHelpers.compareArrays(...arrays) ⇒ <code>Array.<module:arrayHelpers~compareArrayResult></code>
|
|
1244
|
+
Compare two Arrays and return the Object where the value for each property is as follows:
|
|
1245
|
+
-1 to indicate val1 is less than val2
|
|
1246
|
+
0 to indicate both values are the equal
|
|
1247
|
+
1 to indicate val1 is greater than val2
|
|
1248
|
+
The returned Object uses the element values as the property names
|
|
1249
|
+
This functions works by first creating a concatenated array of all unique values. Then for each unique values,
|
|
1250
|
+
convert to a string and use it as a new property name. Array filter each array checking if it has the unique value.
|
|
1251
|
+
Use the lengths of these filtered arrays to compare. So if the first array has the value and the second one doesn't
|
|
1252
|
+
the first length will be one or more and the second will be zero, if the both have the value then both will be one
|
|
1253
|
+
or more.
|
|
1254
|
+
|
|
1255
|
+
**Kind**: static method of [<code>arrayHelpers</code>](#module_arrayHelpers)
|
|
1256
|
+
|
|
1257
|
+
| Param | Type | Description |
|
|
1258
|
+
| --- | --- | --- |
|
|
1259
|
+
| ...arrays | <code>Array</code> | The arrays to compare |
|
|
1260
|
+
|
|
1261
|
+
**Example**
|
|
1262
|
+
```js
|
|
1263
|
+
// example of input and resulting output
|
|
1264
|
+
compareArrays(
|
|
1265
|
+
['match1', 'firstMismatch1', 'match2', 'firstMismatch2', 'badMatch1'],
|
|
1266
|
+
['match1', 'match2', 'secondMismatch1', 'badMatch1', 'badMatch1']
|
|
1267
|
+
)
|
|
1268
|
+
// unique array
|
|
1269
|
+
['match1', 'firstMismatch1', 'match2', 'firstMismatch2', 'badMatch1', 'secondMismatch1']
|
|
1270
|
+
// result object
|
|
1271
|
+
[
|
|
1272
|
+
{
|
|
1273
|
+
value: 'match1',
|
|
1274
|
+
keys: [[0], [0]],
|
|
1275
|
+
result: [0, 0]
|
|
1276
|
+
},
|
|
1277
|
+
{
|
|
1278
|
+
value: 'firstMismatch1',
|
|
1279
|
+
keys: [[1], []],
|
|
1280
|
+
result: [1, -1]
|
|
1281
|
+
},
|
|
1282
|
+
{
|
|
1283
|
+
value: 'match2',
|
|
1284
|
+
keys: [[2], [1]],
|
|
1285
|
+
result: [0, 0]
|
|
1286
|
+
},
|
|
1287
|
+
{
|
|
1288
|
+
value: 'firstMismatch2',
|
|
1289
|
+
keys: [[3], []],
|
|
1290
|
+
result: [1, -1]
|
|
1291
|
+
},
|
|
1292
|
+
{
|
|
1293
|
+
value: 'badMatch1',
|
|
1294
|
+
keys: [[4], [3, 4]],
|
|
1295
|
+
result: [0, 0]
|
|
1296
|
+
},
|
|
1297
|
+
{
|
|
1298
|
+
value: 'secondMismatch1',
|
|
1299
|
+
keys: [[], [2]],
|
|
1300
|
+
result: [-1, 1]
|
|
1301
|
+
}
|
|
1302
|
+
]
|
|
1303
|
+
```
|
|
1304
|
+
<a name="module_arrayHelpers.buildArrayOfReferences"></a>
|
|
1305
|
+
|
|
1306
|
+
### arrayHelpers.buildArrayOfReferences(item, length) ⇒ <code>Array.<\*></code>
|
|
1307
|
+
Leverage buildArrayBase to generate an array filled with references to the provided item.
|
|
1308
|
+
The length defines how long the array should be.
|
|
1309
|
+
|
|
1310
|
+
**Kind**: static method of [<code>arrayHelpers</code>](#module_arrayHelpers)
|
|
1311
|
+
|
|
1312
|
+
| Param | Type | Description |
|
|
1313
|
+
| --- | --- | --- |
|
|
1314
|
+
| item | <code>\*</code> | The item to be used for each array element |
|
|
1315
|
+
| length | <code>number</code> | The desired length of the array |
|
|
1316
|
+
|
|
1317
|
+
<a name="module_arrayHelpers.buildArray"></a>
|
|
1318
|
+
|
|
1319
|
+
### arrayHelpers.buildArray(item, length) ⇒ <code>Array.<\*></code>
|
|
1320
|
+
Leverage buildArrayBase to generate an array filled with a copy of the provided item.
|
|
1321
|
+
The length defines how long the array should be.
|
|
1322
|
+
|
|
1323
|
+
**Kind**: static method of [<code>arrayHelpers</code>](#module_arrayHelpers)
|
|
1324
|
+
|
|
1325
|
+
| Param | Type | Description |
|
|
1326
|
+
| --- | --- | --- |
|
|
1327
|
+
| item | <code>\*</code> | The item to be used for each array element |
|
|
1328
|
+
| length | <code>number</code> | The desired length of the array |
|
|
1329
|
+
|
|
1330
|
+
<a name="module_arrayHelpers.addUniqueToArray"></a>
|
|
1331
|
+
|
|
1332
|
+
### arrayHelpers.addUniqueToArray(item, array) ⇒ <code>Array</code>
|
|
1333
|
+
Having an array and a potential new array element, check if the element is in the array, if not append to array.
|
|
1334
|
+
|
|
1335
|
+
**Kind**: static method of [<code>arrayHelpers</code>](#module_arrayHelpers)
|
|
1336
|
+
|
|
1337
|
+
| Param | Type | Description |
|
|
1338
|
+
| --- | --- | --- |
|
|
1339
|
+
| item | <code>\*</code> | An potential array element, possibly a DomItem |
|
|
1340
|
+
| array | <code>Array</code> | An array where an element may be appended. |
|
|
1341
|
+
|