si-funciona 1.2.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/README.md +234 -327
  2. package/browser/siFunciona.js +735 -747
  3. package/browser/siFunciona.min.js +1 -1
  4. package/dist/helpers/arrays/addUniqueToArray.d.ts +11 -0
  5. package/dist/helpers/arrays/addUniqueToArray.js +7 -7
  6. package/dist/helpers/arrays/buildArray.d.ts +12 -0
  7. package/dist/helpers/arrays/buildArray.js +8 -8
  8. package/dist/helpers/arrays/buildArrayOfReferences.d.ts +12 -0
  9. package/dist/helpers/arrays/buildArrayOfReferences.js +8 -8
  10. package/dist/helpers/arrays/compareArrays.d.ts +98 -0
  11. package/dist/helpers/arrays/compareArrays.js +57 -88
  12. package/dist/helpers/arrays/mergeArrays.d.ts +10 -0
  13. package/dist/helpers/arrays/mergeArrays.js +6 -6
  14. package/dist/helpers/arrays/uniqueArray.d.ts +10 -0
  15. package/dist/helpers/arrays/uniqueArray.js +6 -6
  16. package/dist/helpers/arrays.d.ts +18 -0
  17. package/dist/helpers/arrays.js +13 -13
  18. package/dist/helpers/arrays.min.js +1 -1
  19. package/dist/helpers/descriptors/assignDescriptor.d.ts +12 -0
  20. package/dist/helpers/descriptors/assignDescriptor.js +9 -9
  21. package/dist/helpers/descriptors/assignDescriptor.min.js +1 -1
  22. package/dist/helpers/descriptors/assignDescriptorDetail.d.ts +12 -0
  23. package/dist/helpers/descriptors/assignDescriptorDetail.js +7 -7
  24. package/dist/helpers/descriptors/checkClearValues.d.ts +12 -0
  25. package/dist/helpers/descriptors/checkClearValues.js +7 -7
  26. package/dist/helpers/descriptors/checkDescriptorComplete.d.ts +11 -0
  27. package/dist/helpers/descriptors/checkDescriptorComplete.js +6 -6
  28. package/dist/helpers/descriptors/cloneDescriptor.d.ts +11 -0
  29. package/dist/helpers/descriptors/cloneDescriptor.js +13 -6
  30. package/dist/helpers/descriptors/cloneDescriptorDetail.d.ts +11 -0
  31. package/dist/helpers/descriptors/cloneDescriptorDetail.js +7 -6
  32. package/dist/helpers/descriptors/compareDescriptor.d.ts +12 -0
  33. package/dist/helpers/descriptors/compareDescriptor.js +7 -7
  34. package/dist/helpers/descriptors/describeObject.d.ts +14 -0
  35. package/dist/helpers/descriptors/describeObject.js +7 -6
  36. package/dist/helpers/descriptors/describeObjectDetail.d.ts +13 -0
  37. package/dist/helpers/descriptors/describeObjectDetail.js +8 -8
  38. package/dist/helpers/descriptors/describeObjectMap.d.ts +21 -0
  39. package/dist/helpers/descriptors/describeObjectMap.js +13 -14
  40. package/dist/helpers/descriptors/describeObjectMap.min.js +1 -1
  41. package/dist/helpers/descriptors/nextReference.d.ts +12 -0
  42. package/dist/helpers/descriptors/nextReference.js +7 -7
  43. package/dist/helpers/descriptors/sameDescriptor.d.ts +12 -0
  44. package/dist/helpers/descriptors/sameDescriptor.js +7 -7
  45. package/dist/helpers/descriptors/samples/descriptor.d.ts +27 -0
  46. package/dist/helpers/descriptors/samples/descriptor.js +3 -14
  47. package/dist/helpers/descriptors/samples/descriptorDetail.d.ts +34 -0
  48. package/dist/helpers/descriptors/samples/descriptorDetail.js +3 -19
  49. package/dist/helpers/descriptors/samples/descriptorMap.d.ts +12 -0
  50. package/dist/helpers/descriptors/samples/descriptorMap.js +3 -7
  51. package/dist/helpers/descriptors/samples/mappedDescriptorMap.d.ts +7 -0
  52. package/dist/helpers/descriptors/samples/mappedDescriptorMap.js +3 -3
  53. package/dist/helpers/descriptors.d.ts +28 -0
  54. package/dist/helpers/descriptors.js +19 -19
  55. package/dist/helpers/descriptors.min.js +1 -1
  56. package/dist/helpers/functions/callWithParams.d.ts +12 -0
  57. package/dist/helpers/functions/callWithParams.js +8 -8
  58. package/dist/helpers/functions/curry.d.ts +12 -0
  59. package/dist/helpers/functions/curry.js +8 -8
  60. package/dist/helpers/functions/delay.d.ts +22 -0
  61. package/dist/helpers/functions/delay.js +6 -13
  62. package/dist/helpers/functions/onBodyLoad.d.ts +11 -0
  63. package/dist/helpers/functions/onBodyLoad.js +36 -10
  64. package/dist/helpers/functions/onBodyLoad.min.js +1 -1
  65. package/dist/helpers/functions/pipe.d.ts +11 -0
  66. package/dist/helpers/functions/pipe.js +7 -7
  67. package/dist/helpers/functions/preloadParams.d.ts +21 -0
  68. package/dist/helpers/functions/preloadParams.js +9 -16
  69. package/dist/helpers/functions/queueManager.d.ts +28 -0
  70. package/dist/helpers/functions/queueManager.js +6 -14
  71. package/dist/helpers/functions/queueTimeout.d.ts +22 -0
  72. package/dist/helpers/functions/queueTimeout.js +6 -15
  73. package/dist/helpers/functions/relevancyFilter.d.ts +36 -0
  74. package/dist/helpers/functions/relevancyFilter.js +0 -12
  75. package/dist/helpers/functions/trace.d.ts +13 -0
  76. package/dist/helpers/functions/trace.js +7 -7
  77. package/dist/helpers/functions.d.ts +28 -0
  78. package/dist/helpers/functions.js +17 -17
  79. package/dist/helpers/functions.min.js +1 -1
  80. package/dist/helpers/numbers/absoluteMax.d.ts +11 -0
  81. package/dist/helpers/numbers/absoluteMax.js +7 -7
  82. package/dist/helpers/numbers/absoluteMin.d.ts +11 -0
  83. package/dist/helpers/numbers/absoluteMin.js +7 -7
  84. package/dist/helpers/numbers/compare.d.ts +14 -0
  85. package/dist/helpers/numbers/compare.js +10 -10
  86. package/dist/helpers/numbers/randomInteger.d.ts +14 -0
  87. package/dist/helpers/numbers/randomInteger.js +10 -10
  88. package/dist/helpers/numbers/randomNumber.d.ts +14 -0
  89. package/dist/helpers/numbers/randomNumber.js +10 -10
  90. package/dist/helpers/numbers.d.ts +17 -0
  91. package/dist/helpers/numbers.js +12 -12
  92. package/dist/helpers/numbers.min.js +1 -1
  93. package/dist/helpers/objects/cloneObject.d.ts +21 -0
  94. package/dist/helpers/objects/cloneObject.js +12 -12
  95. package/dist/helpers/objects/dotGet.d.ts +13 -0
  96. package/dist/helpers/objects/dotGet.js +8 -2
  97. package/dist/helpers/objects/dotGet.min.js +1 -1
  98. package/dist/helpers/objects/dotNotate.d.ts +29 -0
  99. package/dist/helpers/objects/dotNotate.js +6 -16
  100. package/dist/helpers/objects/dotNotate.min.js +1 -1
  101. package/dist/helpers/objects/dotSet.d.ts +13 -0
  102. package/dist/helpers/objects/dotSet.js +8 -2
  103. package/dist/helpers/objects/dotSet.min.js +1 -1
  104. package/dist/helpers/objects/dotUnset.d.ts +12 -0
  105. package/dist/helpers/objects/dotUnset.js +8 -2
  106. package/dist/helpers/objects/emptyObject.d.ts +10 -0
  107. package/dist/helpers/objects/emptyObject.js +6 -6
  108. package/dist/helpers/objects/filterObject.d.ts +28 -0
  109. package/dist/helpers/objects/filterObject.js +10 -20
  110. package/dist/helpers/objects/isCloneable.d.ts +10 -0
  111. package/dist/helpers/objects/isCloneable.js +6 -6
  112. package/dist/helpers/objects/isInstanceObject.d.ts +10 -0
  113. package/dist/helpers/objects/isInstanceObject.js +6 -6
  114. package/dist/helpers/objects/isObject.d.ts +10 -0
  115. package/dist/helpers/objects/isObject.js +6 -6
  116. package/dist/helpers/objects/mapObject.d.ts +27 -0
  117. package/dist/helpers/objects/mapObject.js +10 -19
  118. package/dist/helpers/objects/mergeObjects.d.ts +14 -0
  119. package/dist/helpers/objects/mergeObjects.js +7 -7
  120. package/dist/helpers/objects/mergeObjectsBase.d.ts +37 -0
  121. package/dist/helpers/objects/mergeObjectsBase.js +18 -25
  122. package/dist/helpers/objects/mergeObjectsBase.min.js +1 -1
  123. package/dist/helpers/objects/mergeObjectsMutable.d.ts +14 -0
  124. package/dist/helpers/objects/mergeObjectsMutable.js +7 -7
  125. package/dist/helpers/objects/objectKeys.d.ts +15 -0
  126. package/dist/helpers/objects/objectKeys.js +8 -8
  127. package/dist/helpers/objects/objectValues.d.ts +15 -0
  128. package/dist/helpers/objects/objectValues.js +8 -8
  129. package/dist/helpers/objects/reduceObject.d.ts +32 -0
  130. package/dist/helpers/objects/reduceObject.js +12 -24
  131. package/dist/helpers/objects/setAndReturnValue.d.ts +15 -0
  132. package/dist/helpers/objects/setAndReturnValue.js +8 -8
  133. package/dist/helpers/objects/setValue.d.ts +16 -0
  134. package/dist/helpers/objects/setValue.js +10 -9
  135. package/dist/helpers/objects.d.ts +100 -0
  136. package/dist/helpers/objects.js +26 -26
  137. package/dist/helpers/objects.min.js +1 -1
  138. package/dist/helpers/strings/camelCase.d.ts +10 -0
  139. package/dist/helpers/strings/camelCase.js +8 -8
  140. package/dist/helpers/strings/camelCase.min.js +1 -1
  141. package/dist/helpers/strings/kabobCase.d.ts +10 -0
  142. package/dist/helpers/strings/kabobCase.js +7 -7
  143. package/dist/helpers/strings/kabobCase.min.js +1 -1
  144. package/dist/helpers/strings/snakeCase.d.ts +10 -0
  145. package/dist/helpers/strings/snakeCase.js +7 -7
  146. package/dist/helpers/strings/snakeCase.min.js +1 -1
  147. package/dist/helpers/strings/strAfter.d.ts +11 -0
  148. package/dist/helpers/strings/strAfter.js +8 -0
  149. package/dist/helpers/strings/strAfterLast.d.ts +11 -0
  150. package/dist/helpers/strings/strAfterLast.js +8 -0
  151. package/dist/helpers/strings/strBefore.d.ts +11 -0
  152. package/dist/helpers/strings/strBefore.js +8 -0
  153. package/dist/helpers/strings/strBeforeLast.d.ts +11 -0
  154. package/dist/helpers/strings/strBeforeLast.js +8 -0
  155. package/dist/helpers/strings/titleCase.d.ts +10 -0
  156. package/dist/helpers/strings/titleCase.js +8 -8
  157. package/dist/helpers/strings/titleCase.min.js +1 -1
  158. package/dist/helpers/strings/ucFirst.d.ts +10 -0
  159. package/dist/helpers/strings/ucFirst.js +6 -6
  160. package/dist/helpers/strings/words.d.ts +10 -0
  161. package/dist/helpers/strings/words.js +6 -6
  162. package/dist/helpers/strings.d.ts +22 -0
  163. package/dist/helpers/strings.js +17 -17
  164. package/dist/helpers/strings.min.js +1 -1
  165. package/dist/main.d.ts +9 -0
  166. package/dist/main.js +19 -14
  167. package/dist/main.min.js +1 -1
  168. package/package.json +5 -3
@@ -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;
@@ -5,13 +5,13 @@ Object.defineProperty(exports, '__esModule', {
5
5
  })
6
6
  exports.default = void 0
7
7
  require('core-js/stable')
8
- /**
9
- * Having an array and a potential new array element, check if the element is in the array, if not append to array.
10
- * @function
11
- * @memberOf module:arrayHelpers
12
- * @param {*} item - An potential array element, possibly a DomItem
13
- * @param {Array} array - An array where an element may be appended.
14
- * @returns {Array|Buffer|*|string}
8
+ /**
9
+ * Having an array and a potential new array element, check if the element is in the array, if not append to array.
10
+ * @function
11
+ * @memberOf module:arrayHelpers
12
+ * @param {*} item - An potential array element, possibly a DomItem
13
+ * @param {Array} array - An array where an element may be appended.
14
+ * @returns {Array}
15
15
  */
16
16
  const addUniqueToArray = (item, array) => !array.includes(item) ? array.concat([item]) : array
17
17
  var _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;
@@ -7,14 +7,14 @@ exports.default = void 0
7
7
  require('core-js/stable')
8
8
  var _cloneObject = _interopRequireDefault(require('../objects/cloneObject'))
9
9
  function _interopRequireDefault (obj) { return obj && obj.__esModule ? obj : { default: obj } }
10
- /**
11
- * Leverage buildArrayBase to generate an array filled with a copy of the provided item.
12
- * The length defines how long the array should be.
13
- * @function
14
- * @memberOf module:arrayHelpers
15
- * @param {*} item - The item to be used for each array element
16
- * @param {number} length - The desired length of the array
17
- * @returns {Array.<*>}
10
+ /**
11
+ * Leverage buildArrayBase to generate an array filled with a copy of the provided item.
12
+ * The length defines how long the array should be.
13
+ * @function
14
+ * @memberOf module:arrayHelpers
15
+ * @param {*} item - The item to be used for each array element
16
+ * @param {number} length - The desired length of the array
17
+ * @returns {Array.<*>}
18
18
  */
19
19
  const buildArray = (item, length) => {
20
20
  const arr = []
@@ -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;
@@ -5,14 +5,14 @@ Object.defineProperty(exports, '__esModule', {
5
5
  })
6
6
  exports.default = void 0
7
7
  require('core-js/stable')
8
- /**
9
- * Leverage buildArrayBase to generate an array filled with references to the provided item.
10
- * The length defines how long the array should be.
11
- * @function
12
- * @memberOf module:arrayHelpers
13
- * @param {*} item - The item to be used for each array element
14
- * @param {number} length - The desired length of the array
15
- * @returns {Array.<*>}
8
+ /**
9
+ * Leverage buildArrayBase to generate an array filled with references to the provided item.
10
+ * The length defines how long the array should be.
11
+ * @function
12
+ * @memberOf module:arrayHelpers
13
+ * @param {*} item - The item to be used for each array element
14
+ * @param {number} length - The desired length of the array
15
+ * @returns {Array.<*>}
16
16
  */
17
17
  const buildArrayOfReferences = (item, length) => {
18
18
  const arr = []
@@ -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;
@@ -17,94 +17,63 @@ var _isObject = _interopRequireDefault(require('../objects/isObject'))
17
17
  var _mergeArrays = _interopRequireDefault(require('./mergeArrays'))
18
18
  var _objectKeys = _interopRequireDefault(require('../objects/objectKeys'))
19
19
  function _interopRequireDefault (obj) { return obj && obj.__esModule ? obj : { default: obj } }
20
- /**
21
- * Store the comparison result for an element that may exist in either of compared arrays.
22
- * - value stores the element value from the arrays being compared
23
- * - results has the comparison results where first index (0) is result for first compared array
24
- * and the second index (1) will be the result for the second compared array
25
- * @example
26
- * // example of input and resulting output
27
- *
28
- * const arr1 = ['match1', 'firstMismatch1', 'match2', 'firstMismatch2', 'badMatch1']
29
- * const arr2 = ['match1', 'match2', 'secondMismatch1', 'badMatch1', 'badMatch1']
30
- *
31
- * // Taking the first element in both, then the value: 'match1' exists in both arrays
32
- * // compareArrayResult will be { value: 'match1', result: [0, 0] }
33
- * // First index of 0 indicates this value in the first array exists in the second array
34
- * // Second index of 0 indicates this value in the second array exists in the first array
35
- *
36
- * // Taking the second element in the first array, then the value: 'firstMismatch1' exists in only the first array
37
- * // compareArrayResult will be { value: 'firstMismatch1', result: [1, -1] }
38
- * // First index of 1 indicates this value in the first array might need to be added to the second array
39
- * // Second index of -1 indicates this value only exists in the first array
40
- *
41
- * // Taking the third element in the second array, then the value: 'secondMismatch1' exists in only the second array
42
- * // compareArrayResult will be { value: 'secondMismatch1', result: [-1, 1] }
43
- * // First index of -1 indicates this value only exists in the second array
44
- * // Second index of 1 indicates this value in the second array might need to be added to the first array
45
- * @typedef {Object.<string, string|Array.<number>>} module:arrayHelpers~compareArrayResult
46
- * @memberOf module:arrayHelpers
47
- * @property {string} value - The element value being compared
48
- * @property {Array.<Array.<string|number>>} keys - Keys in arrays associated with this value
49
- * @property {Array.<number>} result - The results in the order of the compared arrays
50
- */
51
- /**
52
- * Compare two Arrays and return the Object where the value for each property is as follows:
53
- * -1 to indicate val1 is less than val2
54
- * 0 to indicate both values are the equal
55
- * 1 to indicate val1 is greater than val2
56
- * The returned Object uses the element values as the property names
57
- * This functions works by first creating a concatenated array of all unique values. Then for each unique values,
58
- * convert to a string and use it as a new property name. Array filter each array checking if it has the unique value.
59
- * Use the lengths of these filtered arrays to compare. So if the first array has the value and the second one doesn't
60
- * 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
61
- * or more.
62
- * @example
63
- * // example of input and resulting output
64
- * compareArrays(
65
- * ['match1', 'firstMismatch1', 'match2', 'firstMismatch2', 'badMatch1'],
66
- * ['match1', 'match2', 'secondMismatch1', 'badMatch1', 'badMatch1']
67
- * )
68
- * // unique array
69
- * ['match1', 'firstMismatch1', 'match2', 'firstMismatch2', 'badMatch1', 'secondMismatch1']
70
- * // result object
71
- * [
72
- * {
73
- * value: 'match1',
74
- * keys: [[0], [0]],
75
- * result: [0, 0]
76
- * },
77
- * {
78
- * value: 'firstMismatch1',
79
- * keys: [[1], []],
80
- * result: [1, -1]
81
- * },
82
- * {
83
- * value: 'match2',
84
- * keys: [[2], [1]],
85
- * result: [0, 0]
86
- * },
87
- * {
88
- * value: 'firstMismatch2',
89
- * keys: [[3], []],
90
- * result: [1, -1]
91
- * },
92
- * {
93
- * value: 'badMatch1',
94
- * keys: [[4], [3, 4]],
95
- * result: [0, 0]
96
- * },
97
- * {
98
- * value: 'secondMismatch1',
99
- * keys: [[], [2]],
100
- * result: [-1, 1]
101
- * }
102
- * ]
103
- *
104
- * @function
105
- * @memberOf module:arrayHelpers
106
- * @param {...Array} arrays - The arrays to compare
107
- * @returns {Array.<module:arrayHelpers~compareArrayResult>}
20
+ /**
21
+ * Compare two Arrays and return the Object where the value for each property is as follows:
22
+ * -1 to indicate val1 is less than val2
23
+ * 0 to indicate both values are the equal
24
+ * 1 to indicate val1 is greater than val2
25
+ * The returned Object uses the element values as the property names
26
+ * This functions works by first creating a concatenated array of all unique values. Then for each unique values,
27
+ * convert to a string and use it as a new property name. Array filter each array checking if it has the unique value.
28
+ * Use the lengths of these filtered arrays to compare. So if the first array has the value and the second one doesn't
29
+ * 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
30
+ * or more.
31
+ * @example
32
+ * // example of input and resulting output
33
+ * compareArrays(
34
+ * ['match1', 'firstMismatch1', 'match2', 'firstMismatch2', 'badMatch1'],
35
+ * ['match1', 'match2', 'secondMismatch1', 'badMatch1', 'badMatch1']
36
+ * )
37
+ * // unique array
38
+ * ['match1', 'firstMismatch1', 'match2', 'firstMismatch2', 'badMatch1', 'secondMismatch1']
39
+ * // result object
40
+ * [
41
+ * {
42
+ * value: 'match1',
43
+ * keys: [[0], [0]],
44
+ * result: [0, 0]
45
+ * },
46
+ * {
47
+ * value: 'firstMismatch1',
48
+ * keys: [[1], []],
49
+ * result: [1, -1]
50
+ * },
51
+ * {
52
+ * value: 'match2',
53
+ * keys: [[2], [1]],
54
+ * result: [0, 0]
55
+ * },
56
+ * {
57
+ * value: 'firstMismatch2',
58
+ * keys: [[3], []],
59
+ * result: [1, -1]
60
+ * },
61
+ * {
62
+ * value: 'badMatch1',
63
+ * keys: [[4], [3, 4]],
64
+ * result: [0, 0]
65
+ * },
66
+ * {
67
+ * value: 'secondMismatch1',
68
+ * keys: [[], [2]],
69
+ * result: [-1, 1]
70
+ * }
71
+ * ]
72
+ *
73
+ * @function
74
+ * @memberOf module:arrayHelpers
75
+ * @param {...Array} arrays - The arrays to compare
76
+ * @returns {Array.<module:arrayHelpers~compareArrayResult>}
108
77
  */
109
78
  const compareArrays = function () {
110
79
  for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -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;
@@ -15,12 +15,12 @@ require('core-js/modules/esnext.iterator.filter.js')
15
15
  require('core-js/stable')
16
16
  var _uniqueArray = _interopRequireDefault(require('./uniqueArray'))
17
17
  function _interopRequireDefault (obj) { return obj && obj.__esModule ? obj : { default: obj } }
18
- /**
19
- * Take multiple arrays and then filter all these into one unique array.
20
- * @function
21
- * @memberOf module:arrayHelpers
22
- * @param {...Array} arrays - Provide multiple arrays to create one unique array
23
- * @returns {Array}
18
+ /**
19
+ * Take multiple arrays and then filter all these into one unique array.
20
+ * @function
21
+ * @memberOf module:arrayHelpers
22
+ * @param {...Array} arrays - Provide multiple arrays to create one unique array
23
+ * @returns {Array}
24
24
  */
25
25
  const mergeArrays = function () {
26
26
  for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) {
@@ -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;
@@ -8,12 +8,12 @@ require('core-js/modules/esnext.async-iterator.filter.js')
8
8
  require('core-js/modules/esnext.iterator.constructor.js')
9
9
  require('core-js/modules/esnext.iterator.filter.js')
10
10
  require('core-js/stable')
11
- /**
12
- * Remove duplicate values from an array.
13
- * @function uniqueArray
14
- * @memberOf module:arrayHelpers
15
- * @param {Array} array - The array to make unique
16
- * @returns {Array}
11
+ /**
12
+ * Remove duplicate values from an array.
13
+ * @function uniqueArray
14
+ * @memberOf module:arrayHelpers
15
+ * @param {Array} array - The array to make unique
16
+ * @returns {Array}
17
17
  */
18
18
  const uniqueArray = array => array.filter((item, index) => array.indexOf(item) === index)
19
19
  var _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;
@@ -5,20 +5,20 @@ Object.defineProperty(exports, '__esModule', {
5
5
  })
6
6
  exports.default = void 0
7
7
  require('core-js/stable')
8
- var _addUniqueToArray = _interopRequireDefault(require('./arrays/addUniqueToArray.js'))
9
- var _buildArray = _interopRequireDefault(require('./arrays/buildArray.js'))
10
- var _buildArrayOfReferences = _interopRequireDefault(require('./arrays/buildArrayOfReferences.js'))
11
- var _compareArrays = _interopRequireDefault(require('./arrays/compareArrays.js'))
12
- var _mergeArrays = _interopRequireDefault(require('./arrays/mergeArrays.js'))
13
- var _uniqueArray = _interopRequireDefault(require('./arrays/uniqueArray.js'))
8
+ var _addUniqueToArray = _interopRequireDefault(require('./arrays/addUniqueToArray'))
9
+ var _buildArray = _interopRequireDefault(require('./arrays/buildArray'))
10
+ var _buildArrayOfReferences = _interopRequireDefault(require('./arrays/buildArrayOfReferences'))
11
+ var _compareArrays = _interopRequireDefault(require('./arrays/compareArrays'))
12
+ var _mergeArrays = _interopRequireDefault(require('./arrays/mergeArrays'))
13
+ var _uniqueArray = _interopRequireDefault(require('./arrays/uniqueArray'))
14
14
  function _interopRequireDefault (obj) { return obj && obj.__esModule ? obj : { default: obj } }
15
- /**
16
- * Some simple utility functions for generating arrays or performing work on arrays.
17
- * @file
18
- * @author Joshua Heagle <joshuaheagle@gmail.com>
19
- * @version 1.0.0
20
- * @module arrayHelpers
21
- * @memberOf module:siFunciona
15
+ /**
16
+ * Some simple utility functions for generating arrays or performing work on arrays.
17
+ * @file
18
+ * @author Joshua Heagle <joshuaheagle@gmail.com>
19
+ * @version 1.0.0
20
+ * @module arrayHelpers
21
+ * @memberOf module:siFunciona
22
22
  */
23
23
  var _default = {
24
24
  addUniqueToArray: _addUniqueToArray.default,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("core-js/stable");var _addUniqueToArray=_interopRequireDefault(require("./arrays/addUniqueToArray.js")),_buildArray=_interopRequireDefault(require("./arrays/buildArray.js")),_buildArrayOfReferences=_interopRequireDefault(require("./arrays/buildArrayOfReferences.js")),_compareArrays=_interopRequireDefault(require("./arrays/compareArrays.js")),_mergeArrays=_interopRequireDefault(require("./arrays/mergeArrays.js")),_uniqueArray=_interopRequireDefault(require("./arrays/uniqueArray.js"));function _interopRequireDefault(r){return r&&r.__esModule?r:{default:r}}var _default={addUniqueToArray:_addUniqueToArray.default,buildArray:_buildArray.default,buildArrayOfReferences:_buildArrayOfReferences.default,compareArrays:_compareArrays.default,mergeArrays:_mergeArrays.default,uniqueArray:_uniqueArray.default};exports.default=_default;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("core-js/stable");var _addUniqueToArray=_interopRequireDefault(require("./arrays/addUniqueToArray")),_buildArray=_interopRequireDefault(require("./arrays/buildArray")),_buildArrayOfReferences=_interopRequireDefault(require("./arrays/buildArrayOfReferences")),_compareArrays=_interopRequireDefault(require("./arrays/compareArrays")),_mergeArrays=_interopRequireDefault(require("./arrays/mergeArrays")),_uniqueArray=_interopRequireDefault(require("./arrays/uniqueArray"));function _interopRequireDefault(r){return r&&r.__esModule?r:{default:r}}var _default={addUniqueToArray:_addUniqueToArray.default,buildArray:_buildArray.default,buildArrayOfReferences:_buildArrayOfReferences.default,compareArrays:_compareArrays.default,mergeArrays:_mergeArrays.default,uniqueArray:_uniqueArray.default};exports.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;
@@ -24,13 +24,13 @@ var _cloneDescriptor = _interopRequireDefault(require('./cloneDescriptor'))
24
24
  var _compareArrays = _interopRequireDefault(require('../arrays/compareArrays'))
25
25
  var _uniqueArray = _interopRequireDefault(require('../arrays/uniqueArray'))
26
26
  function _interopRequireDefault (obj) { return obj && obj.__esModule ? obj : { default: obj } }
27
- /**
28
- * Apply one or more descriptors to an existing descriptor so that they represent a merged version of the descriptors.
29
- * @function
30
- * @memberOf module:objectDescriptors
31
- * @param {module:objectDescriptors~descriptor} originalMap
32
- * @param {...module:objectDescriptors~descriptor} descriptors
33
- * @returns {module:objectDescriptors~descriptor}
27
+ /**
28
+ * Apply one or more descriptors to an existing descriptor so that they represent a merged version of the descriptors.
29
+ * @function
30
+ * @memberOf module:objectDescriptors
31
+ * @param {module:objectDescriptors~descriptor} originalMap
32
+ * @param {...module:objectDescriptors~descriptor} descriptors
33
+ * @returns {module:objectDescriptors~descriptor}
34
34
  */
35
35
  const assignDescriptor = function (originalMap) {
36
36
  for (var _len = arguments.length, descriptors = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
@@ -45,12 +45,12 @@ const assignDescriptor = function (originalMap) {
45
45
  assignedDescriptor.details[existingDetail.index] = (0, _assignDescriptorDetail.default)(existingDetail, newDetail)
46
46
  return assignedDescriptor
47
47
  }
48
- const useDetail = diff[0] > 0 ? existingDetail : newDetail
48
+ const useDetail = diff.result[0] > 0 ? existingDetail : newDetail
49
49
  if (!useDetail) {
50
50
  assignedDescriptor.details[existingDetail.index].optional = true
51
51
  return assignedDescriptor
52
52
  }
53
- const useIndex = diff[0] > 0 ? useDetail.index : assignedDescriptor.length
53
+ const useIndex = diff.result[0] > 0 ? useDetail.index : assignedDescriptor.length
54
54
  assignedDescriptor.details[useIndex] = Object.assign({}, useDetail, {
55
55
  index: useIndex,
56
56
  optional: true
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("core-js/modules/esnext.async-iterator.reduce.js"),require("core-js/modules/esnext.iterator.constructor.js"),require("core-js/modules/esnext.iterator.reduce.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/esnext.async-iterator.for-each.js"),require("core-js/modules/esnext.iterator.for-each.js"),require("core-js/modules/esnext.async-iterator.find.js"),require("core-js/modules/esnext.iterator.find.js"),require("core-js/modules/esnext.async-iterator.every.js"),require("core-js/modules/esnext.iterator.every.js"),require("core-js/modules/esnext.async-iterator.map.js"),require("core-js/modules/esnext.iterator.map.js"),require("core-js/modules/esnext.async-iterator.filter.js"),require("core-js/modules/esnext.iterator.filter.js"),require("core-js/stable");var _assignDescriptorDetail=_interopRequireDefault(require("./assignDescriptorDetail")),_cloneDescriptor=_interopRequireDefault(require("./cloneDescriptor")),_compareArrays=_interopRequireDefault(require("../arrays/compareArrays")),_uniqueArray=_interopRequireDefault(require("../arrays/uniqueArray"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const assignDescriptor=function(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),s=1;s<r;s++)t[s-1]=arguments[s];return t.reduce(((e,r)=>((0,_compareArrays.default)(e.keys,r.keys).forEach((t=>{const s=e.details.find((e=>e.key===t.value)),i=r.details.find((e=>e.key===t.value));if(t.result.every((e=>0===e)))return e.details[s.index]=(0,_assignDescriptorDetail.default)(s,i),e;const o=t[0]>0?s:i;if(!o)return e.details[s.index].optional=!0,e;const a=t[0]>0?o.index:e.length;return e.details[a]=Object.assign({},o,{index:a,optional:!0}),e.length=e.length<e.details.length?e.details.length:e.length,e})),e.keys=(0,_uniqueArray.default)(e.details.map((e=>e.key))),e.references=(0,_uniqueArray.default)(e.details.filter((e=>e.isReference)).map((e=>e.index))),e.isArray=e.length?e.details.every((e=>"number"==typeof e.key)):e.isArray,e.complete=!e.references.length||e.complete||r.complete,e)),(0,_cloneDescriptor.default)(e))};var _default=assignDescriptor;exports.default=_default;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("core-js/modules/esnext.async-iterator.reduce.js"),require("core-js/modules/esnext.iterator.constructor.js"),require("core-js/modules/esnext.iterator.reduce.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/esnext.async-iterator.for-each.js"),require("core-js/modules/esnext.iterator.for-each.js"),require("core-js/modules/esnext.async-iterator.find.js"),require("core-js/modules/esnext.iterator.find.js"),require("core-js/modules/esnext.async-iterator.every.js"),require("core-js/modules/esnext.iterator.every.js"),require("core-js/modules/esnext.async-iterator.map.js"),require("core-js/modules/esnext.iterator.map.js"),require("core-js/modules/esnext.async-iterator.filter.js"),require("core-js/modules/esnext.iterator.filter.js"),require("core-js/stable");var _assignDescriptorDetail=_interopRequireDefault(require("./assignDescriptorDetail")),_cloneDescriptor=_interopRequireDefault(require("./cloneDescriptor")),_compareArrays=_interopRequireDefault(require("../arrays/compareArrays")),_uniqueArray=_interopRequireDefault(require("../arrays/uniqueArray"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const assignDescriptor=function(e){for(var r=arguments.length,t=new Array(r>1?r-1:0),s=1;s<r;s++)t[s-1]=arguments[s];return t.reduce(((e,r)=>((0,_compareArrays.default)(e.keys,r.keys).forEach((t=>{const s=e.details.find((e=>e.key===t.value)),i=r.details.find((e=>e.key===t.value));if(t.result.every((e=>0===e)))return e.details[s.index]=(0,_assignDescriptorDetail.default)(s,i),e;const o=t.result[0]>0?s:i;if(!o)return e.details[s.index].optional=!0,e;const a=t.result[0]>0?o.index:e.length;return e.details[a]=Object.assign({},o,{index:a,optional:!0}),e.length=e.length<e.details.length?e.details.length:e.length,e})),e.keys=(0,_uniqueArray.default)(e.details.map((e=>e.key))),e.references=(0,_uniqueArray.default)(e.details.filter((e=>e.isReference)).map((e=>e.index))),e.isArray=e.length?e.details.every((e=>"number"==typeof e.key)):e.isArray,e.complete=!e.references.length||e.complete||r.complete,e)),(0,_cloneDescriptor.default)(e))};var _default=assignDescriptor;exports.default=_default;
@@ -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;
@@ -14,13 +14,13 @@ require('core-js/stable')
14
14
  var _cloneDescriptorDetail = _interopRequireDefault(require('./cloneDescriptorDetail'))
15
15
  var _uniqueArray = _interopRequireDefault(require('../arrays/uniqueArray'))
16
16
  function _interopRequireDefault (obj) { return obj && obj.__esModule ? obj : { default: obj } }
17
- /**
18
- * Assign properties from other details onto an existing detail.
19
- * @function
20
- * @memberOf module:objectDescriptors
21
- * @param {module:objectDescriptors~descriptorDetail} originalDetail
22
- * @param {...module:objectDescriptors~descriptorDetail} details
23
- * @returns {module:objectDescriptors~descriptorDetail}
17
+ /**
18
+ * Assign properties from other details onto an existing detail.
19
+ * @function
20
+ * @memberOf module:objectDescriptors
21
+ * @param {module:objectDescriptors~descriptorDetail} originalDetail
22
+ * @param {...module:objectDescriptors~descriptorDetail} details
23
+ * @returns {module:objectDescriptors~descriptorDetail}
24
24
  */
25
25
  const assignDescriptorDetail = function (originalDetail) {
26
26
  for (var _len = arguments.length, details = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
@@ -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;
@@ -9,13 +9,13 @@ require('core-js/modules/esnext.iterator.map.js')
9
9
  require('core-js/stable')
10
10
  var _setValue = _interopRequireDefault(require('../objects/setValue'))
11
11
  function _interopRequireDefault (obj) { return obj && obj.__esModule ? obj : { default: obj } }
12
- /**
13
- * Check if we should clear the values on this descriptor
14
- * @function
15
- * @memberOf module:objectDescriptors
16
- * @param {module:objectDescriptors~descriptor} descriptor
17
- * @param {boolean} [keepValues=false]
18
- * @returns {module:objectDescriptors~descriptor}
12
+ /**
13
+ * Check if we should clear the values on this descriptor
14
+ * @function
15
+ * @memberOf module:objectDescriptors
16
+ * @param {module:objectDescriptors~descriptor} descriptor
17
+ * @param {boolean} [keepValues=false]
18
+ * @returns {module:objectDescriptors~descriptor}
19
19
  */
20
20
  const checkClearValues = function (descriptor) {
21
21
  const keepValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false
@@ -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;