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