si-funciona 2.0.0 → 2.0.2
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/dist/helpers/arrays/addUniqueToArray.d.ts +11 -0
- package/dist/helpers/arrays/buildArray.d.ts +12 -0
- package/dist/helpers/arrays/buildArrayOfReferences.d.ts +12 -0
- package/dist/helpers/arrays/compareArrays.d.ts +98 -0
- package/dist/helpers/arrays/mergeArrays.d.ts +10 -0
- package/dist/helpers/arrays/uniqueArray.d.ts +10 -0
- package/dist/helpers/arrays.d.ts +18 -0
- package/dist/helpers/descriptors/assignDescriptor.d.ts +12 -0
- package/dist/helpers/descriptors/assignDescriptorDetail.d.ts +12 -0
- package/dist/helpers/descriptors/checkClearValues.d.ts +12 -0
- package/dist/helpers/descriptors/checkDescriptorComplete.d.ts +11 -0
- package/dist/helpers/descriptors/cloneDescriptor.d.ts +11 -0
- package/dist/helpers/descriptors/cloneDescriptorDetail.d.ts +11 -0
- package/dist/helpers/descriptors/compareDescriptor.d.ts +12 -0
- package/dist/helpers/descriptors/describeObject.d.ts +14 -0
- package/dist/helpers/descriptors/describeObjectDetail.d.ts +13 -0
- package/dist/helpers/descriptors/describeObjectMap.d.ts +21 -0
- package/dist/helpers/descriptors/nextReference.d.ts +12 -0
- package/dist/helpers/descriptors/sameDescriptor.d.ts +12 -0
- package/dist/helpers/descriptors/samples/descriptor.d.ts +27 -0
- package/dist/helpers/descriptors/samples/descriptorDetail.d.ts +34 -0
- package/dist/helpers/descriptors/samples/descriptorMap.d.ts +12 -0
- package/dist/helpers/descriptors/samples/mappedDescriptorMap.d.ts +7 -0
- package/dist/helpers/descriptors.d.ts +28 -0
- package/dist/helpers/functions/callWithParams.d.ts +12 -0
- package/dist/helpers/functions/curry.d.ts +12 -0
- package/dist/helpers/functions/delay.d.ts +22 -0
- package/dist/helpers/functions/onBodyLoad.d.ts +11 -0
- package/dist/helpers/functions/pipe.d.ts +11 -0
- package/dist/helpers/functions/preloadParams.d.ts +21 -0
- package/dist/helpers/functions/queueManager.d.ts +28 -0
- package/dist/helpers/functions/queueTimeout.d.ts +22 -0
- package/dist/helpers/functions/relevancyFilter.d.ts +36 -0
- package/dist/helpers/functions/trace.d.ts +13 -0
- package/dist/helpers/functions.d.ts +28 -0
- package/dist/helpers/numbers/absoluteMax.d.ts +11 -0
- package/dist/helpers/numbers/absoluteMin.d.ts +11 -0
- package/dist/helpers/numbers/compare.d.ts +14 -0
- package/dist/helpers/numbers/randomInteger.d.ts +14 -0
- package/dist/helpers/numbers/randomNumber.d.ts +14 -0
- package/dist/helpers/numbers.d.ts +17 -0
- package/dist/helpers/objects/cloneObject.d.ts +21 -0
- package/dist/helpers/objects/dotGet.d.ts +13 -0
- package/dist/helpers/objects/dotNotate.d.ts +29 -0
- package/dist/helpers/objects/dotSet.d.ts +13 -0
- package/dist/helpers/objects/dotUnset.d.ts +12 -0
- package/dist/helpers/objects/emptyObject.d.ts +10 -0
- package/dist/helpers/objects/filterObject.d.ts +28 -0
- package/dist/helpers/objects/isCloneable.d.ts +10 -0
- package/dist/helpers/objects/isInstanceObject.d.ts +10 -0
- package/dist/helpers/objects/isObject.d.ts +10 -0
- package/dist/helpers/objects/mapObject.d.ts +27 -0
- package/dist/helpers/objects/mergeObjects.d.ts +14 -0
- package/dist/helpers/objects/mergeObjectsBase.d.ts +37 -0
- package/dist/helpers/objects/mergeObjectsMutable.d.ts +14 -0
- package/dist/helpers/objects/objectKeys.d.ts +15 -0
- package/dist/helpers/objects/objectValues.d.ts +15 -0
- package/dist/helpers/objects/reduceObject.d.ts +32 -0
- package/dist/helpers/objects/setAndReturnValue.d.ts +15 -0
- package/dist/helpers/objects/setValue.d.ts +16 -0
- package/dist/helpers/objects.d.ts +100 -0
- package/dist/helpers/strings/camelCase.d.ts +10 -0
- package/dist/helpers/strings/kabobCase.d.ts +10 -0
- package/dist/helpers/strings/snakeCase.d.ts +10 -0
- package/dist/helpers/strings/strAfter.d.ts +11 -0
- package/dist/helpers/strings/strAfterLast.d.ts +11 -0
- package/dist/helpers/strings/strBefore.d.ts +11 -0
- package/dist/helpers/strings/strBeforeLast.d.ts +11 -0
- package/dist/helpers/strings/titleCase.d.ts +10 -0
- package/dist/helpers/strings/ucFirst.d.ts +10 -0
- package/dist/helpers/strings/words.d.ts +10 -0
- package/dist/helpers/strings.d.ts +22 -0
- package/dist/main.d.ts +9 -0
- package/package.json +5 -4
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
/**
|
|
3
|
+
* Having an array and a potential new array element, check if the element is in the array, if not append to array.
|
|
4
|
+
* @function
|
|
5
|
+
* @memberOf module:arrayHelpers
|
|
6
|
+
* @param {*} item - An potential array element, possibly a DomItem
|
|
7
|
+
* @param {Array} array - An array where an element may be appended.
|
|
8
|
+
* @returns {Array}
|
|
9
|
+
*/
|
|
10
|
+
declare const addUniqueToArray: (item: any, array: Array<any>) => Array<any>;
|
|
11
|
+
export default addUniqueToArray;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
/**
|
|
3
|
+
* Leverage buildArrayBase to generate an array filled with a copy of the provided item.
|
|
4
|
+
* The length defines how long the array should be.
|
|
5
|
+
* @function
|
|
6
|
+
* @memberOf module:arrayHelpers
|
|
7
|
+
* @param {*} item - The item to be used for each array element
|
|
8
|
+
* @param {number} length - The desired length of the array
|
|
9
|
+
* @returns {Array.<*>}
|
|
10
|
+
*/
|
|
11
|
+
declare const buildArray: (item: any, length: number) => Array<any>;
|
|
12
|
+
export default buildArray;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
/**
|
|
3
|
+
* Leverage buildArrayBase to generate an array filled with references to the provided item.
|
|
4
|
+
* The length defines how long the array should be.
|
|
5
|
+
* @function
|
|
6
|
+
* @memberOf module:arrayHelpers
|
|
7
|
+
* @param {*} item - The item to be used for each array element
|
|
8
|
+
* @param {number} length - The desired length of the array
|
|
9
|
+
* @returns {Array.<*>}
|
|
10
|
+
*/
|
|
11
|
+
declare const buildArrayOfReferences: (item: any, length: number) => Array<any>;
|
|
12
|
+
export default buildArrayOfReferences;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
/**
|
|
3
|
+
* Store the comparison result for an element that may exist in either of compared arrays.
|
|
4
|
+
* - value stores the element value from the arrays being compared
|
|
5
|
+
* - results has the comparison results where first index (0) is result for first compared array
|
|
6
|
+
* and the second index (1) will be the result for the second compared array
|
|
7
|
+
* @example
|
|
8
|
+
* // example of input and resulting output
|
|
9
|
+
*
|
|
10
|
+
* const arr1 = ['match1', 'firstMismatch1', 'match2', 'firstMismatch2', 'badMatch1']
|
|
11
|
+
* const arr2 = ['match1', 'match2', 'secondMismatch1', 'badMatch1', 'badMatch1']
|
|
12
|
+
*
|
|
13
|
+
* // Taking the first element in both, then the value: 'match1' exists in both arrays
|
|
14
|
+
* // compareArrayResult will be { value: 'match1', result: [0, 0] }
|
|
15
|
+
* // First index of 0 indicates this value in the first array exists in the second array
|
|
16
|
+
* // Second index of 0 indicates this value in the second array exists in the first array
|
|
17
|
+
*
|
|
18
|
+
* // Taking the second element in the first array, then the value: 'firstMismatch1' exists in only the first array
|
|
19
|
+
* // compareArrayResult will be { value: 'firstMismatch1', result: [1, -1] }
|
|
20
|
+
* // First index of 1 indicates this value in the first array might need to be added to the second array
|
|
21
|
+
* // Second index of -1 indicates this value only exists in the first array
|
|
22
|
+
*
|
|
23
|
+
* // Taking the third element in the second array, then the value: 'secondMismatch1' exists in only the second array
|
|
24
|
+
* // compareArrayResult will be { value: 'secondMismatch1', result: [-1, 1] }
|
|
25
|
+
* // First index of -1 indicates this value only exists in the second array
|
|
26
|
+
* // Second index of 1 indicates this value in the second array might need to be added to the first array
|
|
27
|
+
* @typedef {Object.<string, string|Array.<number>>} module:arrayHelpers~compareArrayResult
|
|
28
|
+
* @memberOf module:arrayHelpers
|
|
29
|
+
* @property {string} value - The element value being compared
|
|
30
|
+
* @property {Array.<Array.<string|number>>} keys - Keys in arrays associated with this value
|
|
31
|
+
* @property {Array.<number>} result - The results in the order of the compared arrays
|
|
32
|
+
*/
|
|
33
|
+
export type compareArrayResult = {
|
|
34
|
+
value: string;
|
|
35
|
+
keys: Array<Array<number | string>>;
|
|
36
|
+
result: Array<number>;
|
|
37
|
+
};
|
|
38
|
+
export type compareArrayResultMap = Array<compareArrayResult>;
|
|
39
|
+
/**
|
|
40
|
+
* Compare two Arrays and return the Object where the value for each property is as follows:
|
|
41
|
+
* -1 to indicate val1 is less than val2
|
|
42
|
+
* 0 to indicate both values are the equal
|
|
43
|
+
* 1 to indicate val1 is greater than val2
|
|
44
|
+
* The returned Object uses the element values as the property names
|
|
45
|
+
* This functions works by first creating a concatenated array of all unique values. Then for each unique values,
|
|
46
|
+
* convert to a string and use it as a new property name. Array filter each array checking if it has the unique value.
|
|
47
|
+
* Use the lengths of these filtered arrays to compare. So if the first array has the value and the second one doesn't
|
|
48
|
+
* 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
|
|
49
|
+
* or more.
|
|
50
|
+
* @example
|
|
51
|
+
* // example of input and resulting output
|
|
52
|
+
* compareArrays(
|
|
53
|
+
* ['match1', 'firstMismatch1', 'match2', 'firstMismatch2', 'badMatch1'],
|
|
54
|
+
* ['match1', 'match2', 'secondMismatch1', 'badMatch1', 'badMatch1']
|
|
55
|
+
* )
|
|
56
|
+
* // unique array
|
|
57
|
+
* ['match1', 'firstMismatch1', 'match2', 'firstMismatch2', 'badMatch1', 'secondMismatch1']
|
|
58
|
+
* // result object
|
|
59
|
+
* [
|
|
60
|
+
* {
|
|
61
|
+
* value: 'match1',
|
|
62
|
+
* keys: [[0], [0]],
|
|
63
|
+
* result: [0, 0]
|
|
64
|
+
* },
|
|
65
|
+
* {
|
|
66
|
+
* value: 'firstMismatch1',
|
|
67
|
+
* keys: [[1], []],
|
|
68
|
+
* result: [1, -1]
|
|
69
|
+
* },
|
|
70
|
+
* {
|
|
71
|
+
* value: 'match2',
|
|
72
|
+
* keys: [[2], [1]],
|
|
73
|
+
* result: [0, 0]
|
|
74
|
+
* },
|
|
75
|
+
* {
|
|
76
|
+
* value: 'firstMismatch2',
|
|
77
|
+
* keys: [[3], []],
|
|
78
|
+
* result: [1, -1]
|
|
79
|
+
* },
|
|
80
|
+
* {
|
|
81
|
+
* value: 'badMatch1',
|
|
82
|
+
* keys: [[4], [3, 4]],
|
|
83
|
+
* result: [0, 0]
|
|
84
|
+
* },
|
|
85
|
+
* {
|
|
86
|
+
* value: 'secondMismatch1',
|
|
87
|
+
* keys: [[], [2]],
|
|
88
|
+
* result: [-1, 1]
|
|
89
|
+
* }
|
|
90
|
+
* ]
|
|
91
|
+
*
|
|
92
|
+
* @function
|
|
93
|
+
* @memberOf module:arrayHelpers
|
|
94
|
+
* @param {...Array} arrays - The arrays to compare
|
|
95
|
+
* @returns {Array.<module:arrayHelpers~compareArrayResult>}
|
|
96
|
+
*/
|
|
97
|
+
declare const compareArrays: (...arrays: Array<Array<any>>) => compareArrayResultMap;
|
|
98
|
+
export default compareArrays;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
/**
|
|
3
|
+
* Take multiple arrays and then filter all these into one unique array.
|
|
4
|
+
* @function
|
|
5
|
+
* @memberOf module:arrayHelpers
|
|
6
|
+
* @param {...Array} arrays - Provide multiple arrays to create one unique array
|
|
7
|
+
* @returns {Array}
|
|
8
|
+
*/
|
|
9
|
+
declare const mergeArrays: (...arrays: Array<Array<any>>) => Array<any>;
|
|
10
|
+
export default mergeArrays;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
/**
|
|
3
|
+
* Remove duplicate values from an array.
|
|
4
|
+
* @function uniqueArray
|
|
5
|
+
* @memberOf module:arrayHelpers
|
|
6
|
+
* @param {Array} array - The array to make unique
|
|
7
|
+
* @returns {Array}
|
|
8
|
+
*/
|
|
9
|
+
declare const uniqueArray: (array: Array<any>) => Array<any>;
|
|
10
|
+
export default uniqueArray;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Some simple utility functions for generating arrays or performing work on arrays.
|
|
3
|
+
* @file
|
|
4
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
5
|
+
* @version 1.0.0
|
|
6
|
+
* @module arrayHelpers
|
|
7
|
+
* @memberOf module:siFunciona
|
|
8
|
+
*/
|
|
9
|
+
import 'core-js/stable';
|
|
10
|
+
declare const _default: {
|
|
11
|
+
addUniqueToArray: (item: any, array: any[]) => any[];
|
|
12
|
+
buildArray: (item: any, length: number) => any[];
|
|
13
|
+
buildArrayOfReferences: (item: any, length: number) => any[];
|
|
14
|
+
compareArrays: (...arrays: any[][]) => import("./arrays/compareArrays").compareArrayResultMap;
|
|
15
|
+
mergeArrays: (...arrays: any[][]) => any[];
|
|
16
|
+
uniqueArray: (array: any[]) => any[];
|
|
17
|
+
};
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
import { descriptor } from './samples/descriptor';
|
|
3
|
+
/**
|
|
4
|
+
* Apply one or more descriptors to an existing descriptor so that they represent a merged version of the descriptors.
|
|
5
|
+
* @function
|
|
6
|
+
* @memberOf module:objectDescriptors
|
|
7
|
+
* @param {module:objectDescriptors~descriptor} originalMap
|
|
8
|
+
* @param {...module:objectDescriptors~descriptor} descriptors
|
|
9
|
+
* @returns {module:objectDescriptors~descriptor}
|
|
10
|
+
*/
|
|
11
|
+
declare const assignDescriptor: (originalMap: descriptor, ...descriptors: Array<descriptor>) => descriptor;
|
|
12
|
+
export default assignDescriptor;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
import { descriptorDetail } from './samples/descriptorDetail';
|
|
3
|
+
/**
|
|
4
|
+
* Assign properties from other details onto an existing detail.
|
|
5
|
+
* @function
|
|
6
|
+
* @memberOf module:objectDescriptors
|
|
7
|
+
* @param {module:objectDescriptors~descriptorDetail} originalDetail
|
|
8
|
+
* @param {...module:objectDescriptors~descriptorDetail} details
|
|
9
|
+
* @returns {module:objectDescriptors~descriptorDetail}
|
|
10
|
+
*/
|
|
11
|
+
declare const assignDescriptorDetail: (originalDetail: descriptorDetail, ...details: Array<descriptorDetail>) => descriptorDetail;
|
|
12
|
+
export default assignDescriptorDetail;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
import { descriptor } from './samples/descriptor';
|
|
3
|
+
/**
|
|
4
|
+
* Check if we should clear the values on this descriptor
|
|
5
|
+
* @function
|
|
6
|
+
* @memberOf module:objectDescriptors
|
|
7
|
+
* @param {module:objectDescriptors~descriptor} descriptor
|
|
8
|
+
* @param {boolean} [keepValues=false]
|
|
9
|
+
* @returns {module:objectDescriptors~descriptor}
|
|
10
|
+
*/
|
|
11
|
+
declare const checkClearValues: (descriptor: descriptor, keepValues?: boolean) => descriptor;
|
|
12
|
+
export default checkClearValues;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
import { descriptor } from './samples/descriptor';
|
|
3
|
+
/**
|
|
4
|
+
* Check if the descriptors references have all been built and set complete to true if they have.
|
|
5
|
+
* @function
|
|
6
|
+
* @memberOf module:objectDescriptors
|
|
7
|
+
* @param {module:objectDescriptors~descriptor} descriptor
|
|
8
|
+
* @returns {module:objectDescriptors~descriptor}
|
|
9
|
+
*/
|
|
10
|
+
declare const checkDescriptorComplete: (descriptor: descriptor) => descriptor;
|
|
11
|
+
export default checkDescriptorComplete;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
import { descriptor } from './samples/descriptor';
|
|
3
|
+
/**
|
|
4
|
+
* Make a copy of an object descriptor so that the original will not be mutated.
|
|
5
|
+
* @function
|
|
6
|
+
* @memberOf module:objectDescriptors
|
|
7
|
+
* @param {module:objectDescriptors~descriptor} originalMap
|
|
8
|
+
* @returns {module:objectDescriptors~descriptor}
|
|
9
|
+
*/
|
|
10
|
+
declare const cloneDescriptor: (originalMap: descriptor) => descriptor;
|
|
11
|
+
export default cloneDescriptor;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
import { descriptorDetail } from './samples/descriptorDetail';
|
|
3
|
+
/**
|
|
4
|
+
* Get a new copy of an existing Descriptor Detail
|
|
5
|
+
* @function
|
|
6
|
+
* @memberOf module:objectDescriptors
|
|
7
|
+
* @param {module:objectDescriptors~descriptorDetail} originalDetail
|
|
8
|
+
* @returns {module:objectDescriptors~descriptorDetail}
|
|
9
|
+
*/
|
|
10
|
+
declare const cloneDescriptorDetail: (originalDetail: descriptorDetail) => descriptorDetail;
|
|
11
|
+
export default cloneDescriptorDetail;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
import { descriptor } from './samples/descriptor';
|
|
3
|
+
/**
|
|
4
|
+
* Check if two descriptors are the same or similar in that they have similar keys and the associated types are the same.
|
|
5
|
+
* @function
|
|
6
|
+
* @memberOf module:objectDescriptors
|
|
7
|
+
* @param {module:objectDescriptors~descriptor} descriptor1
|
|
8
|
+
* @param {module:objectDescriptors~descriptor} descriptor2
|
|
9
|
+
* @returns {boolean}
|
|
10
|
+
*/
|
|
11
|
+
declare const compareDescriptor: (descriptor1: descriptor, descriptor2: descriptor) => boolean;
|
|
12
|
+
export default compareDescriptor;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
import { descriptor } from './samples/descriptor';
|
|
3
|
+
export type describeableObject = Array<any> | {
|
|
4
|
+
[k: number | string]: any;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Trace an object and return the descriptor which defines the object's structure and attributes.
|
|
8
|
+
* @function
|
|
9
|
+
* @memberOf module:objectDescriptors
|
|
10
|
+
* @param {Object} object
|
|
11
|
+
* @returns {module:objectDescriptors~descriptor}
|
|
12
|
+
*/
|
|
13
|
+
declare const describeObject: (object: describeableObject) => descriptor;
|
|
14
|
+
export default describeObject;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
import { descriptorDetail } from './samples/descriptorDetail';
|
|
3
|
+
/**
|
|
4
|
+
* Trace an object's attribute and provide details about it.
|
|
5
|
+
* @function
|
|
6
|
+
* @memberOf module:objectDescriptors
|
|
7
|
+
* @param {*} value
|
|
8
|
+
* @param {string|number} [key=0]
|
|
9
|
+
* @param {number} [index=0]
|
|
10
|
+
* @returns {module:objectDescriptors~descriptorDetail}
|
|
11
|
+
*/
|
|
12
|
+
declare const describeObjectDetail: (value: any, key?: number | string, index?: number) => descriptorDetail;
|
|
13
|
+
export default describeObjectDetail;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
import { describeableObject } from './describeObject';
|
|
3
|
+
import { descriptorMap } from './samples/descriptorMap';
|
|
4
|
+
type describeObjectMapOptions = {
|
|
5
|
+
mapLimit?: number;
|
|
6
|
+
depthLimit?: number;
|
|
7
|
+
keepValues?: boolean;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Trace out the entire object including nested objects.
|
|
11
|
+
* @function
|
|
12
|
+
* @memberOf module:objectDescriptors
|
|
13
|
+
* @param {Object|Array} object
|
|
14
|
+
* @param {Object} [options={}]
|
|
15
|
+
* @param {number} [options.mapLimit=1000000000]
|
|
16
|
+
* @param {number} [options.depthLimit=-1]
|
|
17
|
+
* @param {boolean} [options.keepValues=false]
|
|
18
|
+
* @returns {module:objectDescriptors~descriptorMap}
|
|
19
|
+
*/
|
|
20
|
+
declare const describeObjectMap: (object: describeableObject, { mapLimit, depthLimit, keepValues }?: describeObjectMapOptions) => descriptorMap;
|
|
21
|
+
export default describeObjectMap;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
import { descriptor } from './samples/descriptor';
|
|
3
|
+
/**
|
|
4
|
+
* Find the index of the next module:objectDescriptors.descriptorDetail to build a resource for.
|
|
5
|
+
* @function
|
|
6
|
+
* @memberOf module:objectDescriptors
|
|
7
|
+
* @param {module:objectDescriptors~descriptor} descriptor
|
|
8
|
+
* @param {number} currentReference
|
|
9
|
+
* @returns {number|undefined}
|
|
10
|
+
*/
|
|
11
|
+
declare const nextReference: (descriptor: descriptor, currentReference: number) => number | undefined;
|
|
12
|
+
export default nextReference;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
import { descriptor } from './samples/descriptor';
|
|
3
|
+
/**
|
|
4
|
+
* Check if the two descriptors are the same.
|
|
5
|
+
* @function
|
|
6
|
+
* @memberOf module:objectDescriptors
|
|
7
|
+
* @param {module:objectDescriptors~descriptor} descriptor1
|
|
8
|
+
* @param {module:objectDescriptors~descriptor} descriptor2
|
|
9
|
+
* @returns {boolean}
|
|
10
|
+
*/
|
|
11
|
+
declare const sameDescriptor: (descriptor1: descriptor, descriptor2: descriptor) => boolean;
|
|
12
|
+
export default sameDescriptor;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { descriptorDetail } from './descriptorDetail';
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {Object} module:objectDescriptors~descriptor
|
|
4
|
+
* @memberOf module:objectDescriptors
|
|
5
|
+
* @property {number} index
|
|
6
|
+
* @property {Array.<module:objectDescriptors~descriptorDetail>} details
|
|
7
|
+
* @property {number} length
|
|
8
|
+
* @property {Array.<string|number>} keys
|
|
9
|
+
* @property {Array.<number>} references
|
|
10
|
+
* @property {boolean} isArray
|
|
11
|
+
* @property {boolean} complete
|
|
12
|
+
*/
|
|
13
|
+
export type descriptor = {
|
|
14
|
+
index: number;
|
|
15
|
+
details: Array<descriptorDetail>;
|
|
16
|
+
length: number;
|
|
17
|
+
keys: Array<number | string>;
|
|
18
|
+
references: Array<number>;
|
|
19
|
+
isArray: boolean;
|
|
20
|
+
complete: boolean;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* @type {module:objectDescriptors~descriptor}
|
|
24
|
+
* @memberOf module:objectDescriptors
|
|
25
|
+
*/
|
|
26
|
+
declare const descriptorSample: descriptor;
|
|
27
|
+
export default descriptorSample;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} module:objectDescriptors~descriptorDetail
|
|
3
|
+
* @memberOf module:objectDescriptors
|
|
4
|
+
* @property {number} index
|
|
5
|
+
* @property {string|number} key
|
|
6
|
+
* @property {Array.<string>} type
|
|
7
|
+
* @property {Array} value
|
|
8
|
+
* @property {boolean} nullable
|
|
9
|
+
* @property {boolean} optional
|
|
10
|
+
* @property {boolean} circular
|
|
11
|
+
* @property {boolean} isReference
|
|
12
|
+
* @property {boolean} isInstance
|
|
13
|
+
* @property {null|number} arrayReference
|
|
14
|
+
* @property {null|number} objectReference
|
|
15
|
+
*/
|
|
16
|
+
export type descriptorDetail = {
|
|
17
|
+
index: number;
|
|
18
|
+
key: number | string;
|
|
19
|
+
type: Array<string>;
|
|
20
|
+
value: Array<any>;
|
|
21
|
+
nullable: boolean;
|
|
22
|
+
optional: boolean;
|
|
23
|
+
circular: boolean;
|
|
24
|
+
isReference: boolean;
|
|
25
|
+
isInstance: boolean;
|
|
26
|
+
arrayReference: number | null;
|
|
27
|
+
objectReference: number | null;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* @type {module:objectDescriptors~descriptorDetail}
|
|
31
|
+
* @memberOf module:objectDescriptors
|
|
32
|
+
*/
|
|
33
|
+
declare const descriptorDetailSample: descriptorDetail;
|
|
34
|
+
export default descriptorDetailSample;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { descriptor } from './descriptor';
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {Array.<module:objectDescriptors~descriptor>} module:objectDescriptors~descriptorMap
|
|
4
|
+
* @memberOf module:objectDescriptors
|
|
5
|
+
*/
|
|
6
|
+
export type descriptorMap = Array<descriptor>;
|
|
7
|
+
/**
|
|
8
|
+
* @type {module:objectDescriptors~descriptorMap}
|
|
9
|
+
* @memberOf module:objectDescriptors
|
|
10
|
+
*/
|
|
11
|
+
declare const descriptorMapSample: descriptorMap;
|
|
12
|
+
export default descriptorMapSample;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a format to standardize every object into a specific template.
|
|
3
|
+
* @file
|
|
4
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
5
|
+
* @version 1.0.0
|
|
6
|
+
* @module objectDescriptors
|
|
7
|
+
* @memberOf module:siFunciona
|
|
8
|
+
*/
|
|
9
|
+
import 'core-js/stable';
|
|
10
|
+
declare const _default: {
|
|
11
|
+
assignDescriptor: (originalMap: import("./descriptors/samples/descriptor").descriptor, ...descriptors: import("./descriptors/samples/descriptor").descriptor[]) => import("./descriptors/samples/descriptor").descriptor;
|
|
12
|
+
assignDescriptorDetail: (originalDetail: import("./descriptors/samples/descriptorDetail").descriptorDetail, ...details: import("./descriptors/samples/descriptorDetail").descriptorDetail[]) => import("./descriptors/samples/descriptorDetail").descriptorDetail;
|
|
13
|
+
checkClearValues: (descriptor: import("./descriptors/samples/descriptor").descriptor, keepValues?: boolean) => import("./descriptors/samples/descriptor").descriptor;
|
|
14
|
+
checkDescriptorComplete: (descriptor: import("./descriptors/samples/descriptor").descriptor) => import("./descriptors/samples/descriptor").descriptor;
|
|
15
|
+
cloneDescriptor: (originalMap: import("./descriptors/samples/descriptor").descriptor) => import("./descriptors/samples/descriptor").descriptor;
|
|
16
|
+
cloneDescriptorDetail: (originalDetail: import("./descriptors/samples/descriptorDetail").descriptorDetail) => import("./descriptors/samples/descriptorDetail").descriptorDetail;
|
|
17
|
+
compareDescriptor: (descriptor1: import("./descriptors/samples/descriptor").descriptor, descriptor2: import("./descriptors/samples/descriptor").descriptor) => boolean;
|
|
18
|
+
describeObject: (object: import("./descriptors/describeObject").describeableObject) => import("./descriptors/samples/descriptor").descriptor;
|
|
19
|
+
describeObjectMap: (object: import("./descriptors/describeObject").describeableObject, { mapLimit, depthLimit, keepValues }?: {
|
|
20
|
+
mapLimit?: number;
|
|
21
|
+
depthLimit?: number;
|
|
22
|
+
keepValues?: boolean;
|
|
23
|
+
}) => import("./descriptors/samples/descriptorMap").descriptorMap;
|
|
24
|
+
describeObjectDetail: (value: any, key?: string | number, index?: number) => import("./descriptors/samples/descriptorDetail").descriptorDetail;
|
|
25
|
+
nextReference: (descriptor: import("./descriptors/samples/descriptor").descriptor, currentReference: number) => number;
|
|
26
|
+
sameDescriptor: (descriptor1: import("./descriptors/samples/descriptor").descriptor, descriptor2: import("./descriptors/samples/descriptor").descriptor) => boolean;
|
|
27
|
+
};
|
|
28
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
/**
|
|
3
|
+
* Given a function, call with the correct number of parameters from an array of possible parameters.
|
|
4
|
+
* @function
|
|
5
|
+
* @memberOf module:functionHelpers
|
|
6
|
+
* @param {Function} fn - The function to be called
|
|
7
|
+
* @param {Array} params - Array of possible function parameters
|
|
8
|
+
* @param {number} [minimum=2] - Minimum number of parameters to use in the function
|
|
9
|
+
* @returns {*}
|
|
10
|
+
*/
|
|
11
|
+
declare const callWithParams: (fn: Function, params?: Array<any>, minimum?: number) => any;
|
|
12
|
+
export default callWithParams;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
/**
|
|
3
|
+
* Return a curried version of the passed function.
|
|
4
|
+
* The returned function expects the same number of arguments minus the ones provided.
|
|
5
|
+
* fn is the name of the function being curried.
|
|
6
|
+
* @function
|
|
7
|
+
* @memberOf module:functionHelpers
|
|
8
|
+
* @param {Function} fn - Receives a function to be curried
|
|
9
|
+
* @returns {Function|*}
|
|
10
|
+
*/
|
|
11
|
+
declare const curry: (fn: Function) => Function | any;
|
|
12
|
+
export default curry;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
import 'regenerator-runtime/runtime';
|
|
3
|
+
/**
|
|
4
|
+
* Provide a way to cancel a request or attach a resolve event.
|
|
5
|
+
* @typedef {Object} module:functionHelpers~delayHandler
|
|
6
|
+
* @memberOf module:functionHelpers
|
|
7
|
+
* @property {Promise} resolver
|
|
8
|
+
* @property {Function} cancel
|
|
9
|
+
*/
|
|
10
|
+
type delayHandler = {
|
|
11
|
+
resolver: Promise<any>;
|
|
12
|
+
cancel: () => void;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Provide a timeout which returns a promise.
|
|
16
|
+
* @function
|
|
17
|
+
* @memberOf module:functionHelpers
|
|
18
|
+
* @param {number} time - Delay in milliseconds
|
|
19
|
+
* @returns {module:functionHelpers~delayHandler}
|
|
20
|
+
*/
|
|
21
|
+
declare const delay: (time?: number) => delayHandler;
|
|
22
|
+
export default delay;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
/**
|
|
3
|
+
* Prepare functions to be called once the body is available.
|
|
4
|
+
* @function
|
|
5
|
+
* @memberOf module:functionHelpers
|
|
6
|
+
* @param {Function} callback
|
|
7
|
+
* @param {boolean} [reset=false]
|
|
8
|
+
* @returns {Array.<Function>}
|
|
9
|
+
*/
|
|
10
|
+
declare const onBodyLoad: (callback: Function, reset?: boolean) => Array<Function>;
|
|
11
|
+
export default onBodyLoad;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
/**
|
|
3
|
+
* Take one or more function with a single parameter and return value.
|
|
4
|
+
* Pass a parameter and the value will be transformed by each function then returned.
|
|
5
|
+
* @function
|
|
6
|
+
* @memberOf module:functionHelpers
|
|
7
|
+
* @param {...Function} fns - Takes a series of functions having the same parameter
|
|
8
|
+
* @returns {*}
|
|
9
|
+
*/
|
|
10
|
+
declare const pipe: (...fns: Function[]) => any;
|
|
11
|
+
export default pipe;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
/**
|
|
3
|
+
* The return function which takes the missing parameter in order to call the preloaded function.
|
|
4
|
+
* @typedef {Function} module:functionHelpers~callWithMissing
|
|
5
|
+
* @memberOf module:functionHelpers
|
|
6
|
+
* @param {*} missing - The missing parameter to be applied
|
|
7
|
+
* @returns {*}
|
|
8
|
+
*/
|
|
9
|
+
type callWithMissing = (missing: any) => any;
|
|
10
|
+
/**
|
|
11
|
+
* Provide an array of parameters to be used with a function, allow the function to be called later
|
|
12
|
+
* with the missing parameter.
|
|
13
|
+
* @function
|
|
14
|
+
* @memberOf module:functionHelpers
|
|
15
|
+
* @param {Function} fn - The function to be called
|
|
16
|
+
* @param {Array} params - The parameters to preload
|
|
17
|
+
* @param {number} [unassignedParam=0] - Position of missing parameter (zero indexed)
|
|
18
|
+
* @returns {module:functionHelpers~callWithMissing}
|
|
19
|
+
*/
|
|
20
|
+
declare const preloadParams: (fn: Function, params?: Array<any>, unassignedParam?: number) => callWithMissing;
|
|
21
|
+
export default preloadParams;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
import 'regenerator-runtime/runtime';
|
|
3
|
+
/**
|
|
4
|
+
* Each time queue handle is called the passed function is added to the queue to be called when ready.
|
|
5
|
+
* @typedef {Function} module:functionHelpers~queueManagerHandle
|
|
6
|
+
* @memberOf module:functionHelpers
|
|
7
|
+
* @param {Function} fn - A function to enqueue
|
|
8
|
+
* @param {...*} args - Arguments to be passed to the function once it is ready
|
|
9
|
+
* @returns {Promise}
|
|
10
|
+
*/
|
|
11
|
+
export type queueManagerHandle = (fn: Function, ...args: any) => Promise<any>;
|
|
12
|
+
type callableLater = {
|
|
13
|
+
fn?: Function;
|
|
14
|
+
args?: Array<any>;
|
|
15
|
+
};
|
|
16
|
+
export type queuedItem = {
|
|
17
|
+
item: callableLater;
|
|
18
|
+
generator: Generator;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Manage functions to run sequentially.
|
|
22
|
+
* @function
|
|
23
|
+
* @memberOf module:functionHelpers
|
|
24
|
+
* @param {Iterable|array} [queue=[]] - The iterable that can be used to store queued functions
|
|
25
|
+
* @returns {module:functionHelpers~queueManagerHandle}
|
|
26
|
+
*/
|
|
27
|
+
declare const queueManager: (queue?: Array<queuedItem>) => queueManagerHandle;
|
|
28
|
+
export default queueManager;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
import 'regenerator-runtime/runtime';
|
|
3
|
+
import { queueManagerHandle } from './queueManager';
|
|
4
|
+
/**
|
|
5
|
+
* Run Timeout functions one after the otherin queue.
|
|
6
|
+
* @typedef {Function} module:functionHelpers~queueTimeoutHandle
|
|
7
|
+
* @memberOf module:functionHelpers
|
|
8
|
+
* @param {Function} fn - A callback function to be performed at some time in the future.
|
|
9
|
+
* @param {number} time - The time in milliseconds to delay.
|
|
10
|
+
* @param {...*} args - Arguments to be passed to the callback once it is implemented.
|
|
11
|
+
* @returns {Promise}
|
|
12
|
+
*/
|
|
13
|
+
type queueTimeoutHandle = (fn: Function, time: number, ...args: any) => Promise<any>;
|
|
14
|
+
/**
|
|
15
|
+
* Manage functions to run sequentially with delays.
|
|
16
|
+
* @function
|
|
17
|
+
* @memberOf module:functionHelpers
|
|
18
|
+
* @param {module:functionHelpers~queueManagerHandle} [queueManagerHandle=null]
|
|
19
|
+
* @returns {module:functionHelpers~queueTimeoutHandle}
|
|
20
|
+
*/
|
|
21
|
+
declare const queueTimeout: (queueManagerHandle?: queueManagerHandle) => queueTimeoutHandle;
|
|
22
|
+
export default queueTimeout;
|