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
@@ -13,26 +13,16 @@ require('core-js/stable')
13
13
  var _callWithParams = _interopRequireDefault(require('../functions/callWithParams'))
14
14
  var _objectKeys = _interopRequireDefault(require('./objectKeys'))
15
15
  function _interopRequireDefault (obj) { return obj && obj.__esModule ? obj : { default: obj } }
16
- /**
17
- * Function is a predicate, to test each property value of the object. Return true to keep the element, false
18
- * otherwise, taking three arguments
19
- * @callback module:objectHelpers~filterCallback
20
- * @memberOf module:objectHelpers
21
- * @param {*} currentProperty - The current property being processed in the object.
22
- * @param {string} [currentIndex] - The property name of the current property being processed in the object.
23
- * @param {Object|Array} [object] - The object filter was called upon.
24
- * @returns {boolean}
25
- */
26
- /**
27
- * This function is intended to replicate behaviour of the Array.filter() function but for Objects.
28
- * If an array is passed in instead then it will perform standard filter(). It is recommended to
29
- * always use the standard filter() function when it is known that the object is actually an array.
30
- * @function
31
- * @memberOf module:objectHelpers
32
- * @param {Object|Array} obj - The Object (or Array) to be filtered
33
- * @param {module:objectHelpers~filterCallback|Function} fn - The function to be processed for each filtered property
34
- * @param {Object|Array} [thisArg] - Optional. Value to use as this when executing callback.
35
- * @returns {Object|Array}
16
+ /**
17
+ * This function is intended to replicate behaviour of the Array.filter() function but for Objects.
18
+ * If an array is passed in instead then it will perform standard filter(). It is recommended to
19
+ * always use the standard filter() function when it is known that the object is actually an array.
20
+ * @function
21
+ * @memberOf module:objectHelpers
22
+ * @param {Object|Array} obj - The Object (or Array) to be filtered
23
+ * @param {module:objectHelpers~filterCallback|Function} fn - The function to be processed for each filtered property
24
+ * @param {Object|Array} [thisArg] - Optional. Value to use as this when executing callback.
25
+ * @returns {Object|Array}
36
26
  */
37
27
  const filterObject = function (obj, fn) {
38
28
  const thisArg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined
@@ -0,0 +1,10 @@
1
+ import 'core-js/stable';
2
+ /**
3
+ * Determine if the value is a reference instance
4
+ * @function
5
+ * @memberOf module:objectHelpers
6
+ * @param {Array|Object|*} value
7
+ * @returns {boolean}
8
+ */
9
+ declare const isCloneable: (value: Array<any> | Object | any) => boolean;
10
+ export default isCloneable;
@@ -7,12 +7,12 @@ exports.default = void 0
7
7
  require('core-js/stable')
8
8
  var _isInstanceObject = _interopRequireDefault(require('./isInstanceObject'))
9
9
  function _interopRequireDefault (obj) { return obj && obj.__esModule ? obj : { default: obj } }
10
- /**
11
- * Determine if the value is a reference instance
12
- * @function
13
- * @memberOf module:objectHelpers
14
- * @param {Array|Object|*} value
15
- * @returns {boolean}
10
+ /**
11
+ * Determine if the value is a reference instance
12
+ * @function
13
+ * @memberOf module:objectHelpers
14
+ * @param {Array|Object|*} value
15
+ * @returns {boolean}
16
16
  */
17
17
  const isCloneable = value => typeof value === 'object' && value !== null && !(0, _isInstanceObject.default)(value)
18
18
  var _default = isCloneable
@@ -0,0 +1,10 @@
1
+ import 'core-js/stable';
2
+ /**
3
+ * Check if the current object has inherited properties.
4
+ * @function
5
+ * @memberOf module:objectHelpers
6
+ * @param {Object|Array} object
7
+ * @returns {boolean}
8
+ */
9
+ declare const isInstanceObject: (object: Array<any> | Object) => boolean;
10
+ export default isInstanceObject;
@@ -8,12 +8,12 @@ require('core-js/stable')
8
8
  var _isObject = _interopRequireDefault(require('./isObject'))
9
9
  var _objectKeys = _interopRequireDefault(require('./objectKeys'))
10
10
  function _interopRequireDefault (obj) { return obj && obj.__esModule ? obj : { default: obj } }
11
- /**
12
- * Check if the current object has inherited properties.
13
- * @function
14
- * @memberOf module:objectHelpers
15
- * @param {Object|Array} object
16
- * @returns {boolean}
11
+ /**
12
+ * Check if the current object has inherited properties.
13
+ * @function
14
+ * @memberOf module:objectHelpers
15
+ * @param {Object|Array} object
16
+ * @returns {boolean}
17
17
  */
18
18
  const isInstanceObject = object => {
19
19
  if (typeof object !== 'function' && !(0, _isObject.default)(object)) {
@@ -0,0 +1,10 @@
1
+ import 'core-js/stable';
2
+ /**
3
+ * Check if the provided thing is an object / array.
4
+ * @function
5
+ * @memberOf module:objectHelpers
6
+ * @param {*} object
7
+ * @returns {boolean}
8
+ */
9
+ declare const isObject: (object: any) => boolean;
10
+ export default isObject;
@@ -5,12 +5,12 @@ Object.defineProperty(exports, '__esModule', {
5
5
  })
6
6
  exports.default = void 0
7
7
  require('core-js/stable')
8
- /**
9
- * Check if the provided thing is an object / array.
10
- * @function
11
- * @memberOf module:objectHelpers
12
- * @param {*} object
13
- * @returns {boolean}
8
+ /**
9
+ * Check if the provided thing is an object / array.
10
+ * @function
11
+ * @memberOf module:objectHelpers
12
+ * @param {*} object
13
+ * @returns {boolean}
14
14
  */
15
15
  const isObject = object => typeof object === 'object' && object !== null
16
16
  var _default = isObject
@@ -0,0 +1,27 @@
1
+ import 'core-js/stable';
2
+ type mappableItem = Array<any> | {
3
+ [k: number | string]: any;
4
+ };
5
+ /**
6
+ * Function that produces a property of the new Object, taking three arguments
7
+ * @callback module:objectHelpers~mapCallback
8
+ * @memberOf module:objectHelpers
9
+ * @param {*} currentProperty - The current property being processed in the object.
10
+ * @param {string} [currentIndex] - The property name of the current property being processed in the object.
11
+ * @param {Object|Array} [object] - The object map was called upon.
12
+ * @returns {*}
13
+ */
14
+ type mapCallback = (currentProperty: any, currentIndex: keyof mappableItem, object: mappableItem) => any;
15
+ /**
16
+ * This function is intended to replicate behaviour of the Array.map() function but for Objects.
17
+ * If an array is passed in instead then it will perform standard map(). It is recommended to
18
+ * always use the standard map() function when it is known that the object is actually an array.
19
+ * @function
20
+ * @memberOf module:objectHelpers
21
+ * @param {Object|Array} obj - The Object (or Array) to be mapped
22
+ * @param {module:objectHelpers~mapCallback|Function} fn - The function to be processed for each mapped property
23
+ * @param {Object|Array} [thisArg] - Optional. Value to use as this when executing callback.
24
+ * @returns {Object|Array}
25
+ */
26
+ declare const mapObject: (obj: mappableItem, fn: mapCallback, thisArg?: mappableItem) => mappableItem;
27
+ export default mapObject;
@@ -14,25 +14,16 @@ var _callWithParams = _interopRequireDefault(require('../functions/callWithParam
14
14
  var _objectKeys = _interopRequireDefault(require('./objectKeys'))
15
15
  var _setValue = _interopRequireDefault(require('./setValue'))
16
16
  function _interopRequireDefault (obj) { return obj && obj.__esModule ? obj : { default: obj } }
17
- /**
18
- * Function that produces a property of the new Object, taking three arguments
19
- * @callback module:objectHelpers~mapCallback
20
- * @memberOf module:objectHelpers
21
- * @param {*} currentProperty - The current property being processed in the object.
22
- * @param {string} [currentIndex] - The property name of the current property being processed in the object.
23
- * @param {Object|Array} [object] - The object map was called upon.
24
- * @returns {*}
25
- */
26
- /**
27
- * This function is intended to replicate behaviour of the Array.map() function but for Objects.
28
- * If an array is passed in instead then it will perform standard map(). It is recommended to
29
- * always use the standard map() function when it is known that the object is actually an array.
30
- * @function
31
- * @memberOf module:objectHelpers
32
- * @param {Object|Array} obj - The Object (or Array) to be mapped
33
- * @param {module:objectHelpers~mapCallback|Function} fn - The function to be processed for each mapped property
34
- * @param {Object|Array} [thisArg] - Optional. Value to use as this when executing callback.
35
- * @returns {Object|Array}
17
+ /**
18
+ * This function is intended to replicate behaviour of the Array.map() function but for Objects.
19
+ * If an array is passed in instead then it will perform standard map(). It is recommended to
20
+ * always use the standard map() function when it is known that the object is actually an array.
21
+ * @function
22
+ * @memberOf module:objectHelpers
23
+ * @param {Object|Array} obj - The Object (or Array) to be mapped
24
+ * @param {module:objectHelpers~mapCallback|Function} fn - The function to be processed for each mapped property
25
+ * @param {Object|Array} [thisArg] - Optional. Value to use as this when executing callback.
26
+ * @returns {Object|Array}
36
27
  */
37
28
  const mapObject = function (obj, fn) {
38
29
  const thisArg = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined
@@ -0,0 +1,14 @@
1
+ import 'core-js/stable';
2
+ /**
3
+ * Uses mergeObjectsBase deep merge objects and arrays, merge by value.
4
+ * @function
5
+ * @memberOf module:objectHelpers
6
+ * @see {@link module:objectHelpers~mergeObjectsCallback}
7
+ * @param {...Object} objects - Provide a list of objects which will be merged starting from the end up into the first
8
+ * @returns {*}
9
+ */
10
+ declare const mergeObjects: (...objects: Object[]) => any[] | {
11
+ [k: string]: any;
12
+ [k: number]: any;
13
+ };
14
+ export default mergeObjects;
@@ -7,13 +7,13 @@ exports.default = void 0
7
7
  require('core-js/stable')
8
8
  var _mergeObjectsBase = _interopRequireDefault(require('./mergeObjectsBase'))
9
9
  function _interopRequireDefault (obj) { return obj && obj.__esModule ? obj : { default: obj } }
10
- /**
11
- * Uses mergeObjectsBase deep merge objects and arrays, merge by value.
12
- * @function
13
- * @memberOf module:objectHelpers
14
- * @see {@link module:objectHelpers~mergeObjectsCallback}
15
- * @param {...Object} objects - Provide a list of objects which will be merged starting from the end up into the first
16
- * @returns {*}
10
+ /**
11
+ * Uses mergeObjectsBase deep merge objects and arrays, merge by value.
12
+ * @function
13
+ * @memberOf module:objectHelpers
14
+ * @see {@link module:objectHelpers~mergeObjectsCallback}
15
+ * @param {...Object} objects - Provide a list of objects which will be merged starting from the end up into the first
16
+ * @returns {*}
17
17
  */
18
18
  const mergeObjects = (0, _mergeObjectsBase.default)({
19
19
  useClone: true
@@ -0,0 +1,37 @@
1
+ import 'core-js/stable';
2
+ import { relevanceMap } from '../functions/relevancyFilter';
3
+ type mergeableItem = Array<any> | {
4
+ [k: number | string]: any;
5
+ };
6
+ /**
7
+ * Function that takes one or more objects and combines them into one.
8
+ * @typedef {Function} module:objectHelpers~mergeObjectsCallback
9
+ * @memberOf module:objectHelpers
10
+ * @param {...Object} objects - Provide a list of objects which will be merged starting from the end up into the first
11
+ * @returns {*}
12
+ */
13
+ type mergeObjectsCallback = (...objects: Array<Object>) => mergeableItem;
14
+ type mergeObjectsBaseOptions = {
15
+ mapLimit?: number;
16
+ depthLimit?: number;
17
+ relevancyRange?: number;
18
+ map?: relevanceMap;
19
+ useClone?: boolean;
20
+ };
21
+ /**
22
+ * Perform a deep merge of objects. This will return a function that will combine all objects and sub-objects.
23
+ * Objects having the same attributes will overwrite from last object to first.
24
+ * NOTE: Use the mapLimit and relevancyRange to resolve "too much recursion" when the object is large and is known to
25
+ * have circular references. A high mapLimit may lead to heavy memory usage and slow performance.
26
+ * @function
27
+ * @memberOf module:objectHelpers
28
+ * @param {Object} [options={}]
29
+ * @param {number} [options.mapLimit=100] - Size of temporary reference array used in memory before assessing relevancy.
30
+ * @param {number} [options.depthLimit=-1] - Control how many nested levels deep will be used, -1 = no limit, >-1 = nth level limited.
31
+ * @param {number} [options.relevancyRange=1000] - Total reference map length subtract this range, any relevancy less than that amount at time of evaluation will be removed.
32
+ * @param {Iterable|array} [options.map=[]] - A predetermined list of references gathered (to be passed to itself during recursion).
33
+ * @param {boolean} [options.useClone=false]
34
+ * @returns {module:objectHelpers~mergeObjectsCallback|mergeObjectsCallback}
35
+ */
36
+ declare const mergeObjectsBase: ({ mapLimit, depthLimit, relevancyRange, map, useClone, }?: mergeObjectsBaseOptions) => mergeObjectsCallback;
37
+ export default mergeObjectsBase;
@@ -12,32 +12,25 @@ require('core-js/modules/esnext.iterator.reduce.js')
12
12
  require('core-js/modules/esnext.async-iterator.find.js')
13
13
  require('core-js/modules/esnext.iterator.find.js')
14
14
  require('core-js/stable')
15
- var _isCloneable = _interopRequireDefault(require('./isCloneable.js'))
16
- var _reduceObject = _interopRequireDefault(require('./reduceObject.js'))
17
- var _relevancyFilter = _interopRequireDefault(require('../functions/relevancyFilter.js'))
18
- var _setValue = _interopRequireDefault(require('./setValue.js'))
15
+ var _isCloneable = _interopRequireDefault(require('./isCloneable'))
16
+ var _reduceObject = _interopRequireDefault(require('./reduceObject'))
17
+ var _relevancyFilter = _interopRequireDefault(require('../functions/relevancyFilter'))
18
+ var _setValue = _interopRequireDefault(require('./setValue'))
19
19
  function _interopRequireDefault (obj) { return obj && obj.__esModule ? obj : { default: obj } }
20
- /**
21
- * Function that takes one or more objects and combines them into one.
22
- * @typedef {Function} module:objectHelpers~mergeObjectsCallback
23
- * @memberOf module:objectHelpers
24
- * @param {...Object} objects - Provide a list of objects which will be merged starting from the end up into the first
25
- * @returns {*}
26
- */
27
- /**
28
- * Perform a deep merge of objects. This will return a function that will combine all objects and sub-objects.
29
- * Objects having the same attributes will overwrite from last object to first.
30
- * NOTE: Use the mapLimit and relevancyRange to resolve "too much recursion" when the object is large and is known to
31
- * have circular references. A high mapLimit may lead to heavy memory usage and slow performance.
32
- * @function
33
- * @memberOf module:objectHelpers
34
- * @param {Object} [options={}]
35
- * @param {number} [options.mapLimit=100] - Size of temporary reference array used in memory before assessing relevancy.
36
- * @param {number} [options.depthLimit=-1] - Control how many nested levels deep will be used, -1 = no limit, >-1 = nth level limited.
37
- * @param {number} [options.relevancyRange=1000] - Total reference map length subtract this range, any relevancy less than that amount at time of evaluation will be removed.
38
- * @param {Iterable|array} [options.map=[]] - A predetermined list of references gathered (to be passed to itself during recursion).
39
- * @param {boolean} [options.useClone=false]
40
- * @returns {module:objectHelpers~mergeObjectsCallback}
20
+ /**
21
+ * Perform a deep merge of objects. This will return a function that will combine all objects and sub-objects.
22
+ * Objects having the same attributes will overwrite from last object to first.
23
+ * NOTE: Use the mapLimit and relevancyRange to resolve "too much recursion" when the object is large and is known to
24
+ * have circular references. A high mapLimit may lead to heavy memory usage and slow performance.
25
+ * @function
26
+ * @memberOf module:objectHelpers
27
+ * @param {Object} [options={}]
28
+ * @param {number} [options.mapLimit=100] - Size of temporary reference array used in memory before assessing relevancy.
29
+ * @param {number} [options.depthLimit=-1] - Control how many nested levels deep will be used, -1 = no limit, >-1 = nth level limited.
30
+ * @param {number} [options.relevancyRange=1000] - Total reference map length subtract this range, any relevancy less than that amount at time of evaluation will be removed.
31
+ * @param {Iterable|array} [options.map=[]] - A predetermined list of references gathered (to be passed to itself during recursion).
32
+ * @param {boolean} [options.useClone=false]
33
+ * @returns {module:objectHelpers~mergeObjectsCallback|mergeObjectsCallback}
41
34
  */
42
35
  const mergeObjectsBase = function () {
43
36
  let {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("core-js/modules/esnext.async-iterator.map.js"),require("core-js/modules/esnext.iterator.map.js"),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/esnext.async-iterator.find.js"),require("core-js/modules/esnext.iterator.find.js"),require("core-js/stable");var _isCloneable=_interopRequireDefault(require("./isCloneable.js")),_reduceObject=_interopRequireDefault(require("./reduceObject.js")),_relevancyFilter=_interopRequireDefault(require("../functions/relevancyFilter.js")),_setValue=_interopRequireDefault(require("./setValue.js"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const mergeObjectsBase=function(){let{mapLimit:e=100,depthLimit:r=-1,relevancyRange:t=1e3,map:u=[],useClone:a=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(){for(var s=arguments.length,l=new Array(s),i=0;i<s;i++)l[i]=arguments[i];const n=a?Array.isArray(l[0])?[]:{}:l.shift();return l.length<1||0===r?n:l.reduce(((s,l)=>l?(u.push({source:l,object:s,relevance:u.length}),u=(0,_relevancyFilter.default)(u,{mapLimit:e,relevancyRange:t}),(0,_reduceObject.default)(l,((l,i,n)=>{if((0,_isCloneable.default)(i)){let o=s[n];const c=u.find((e=>e.source===i));if(c)return c.relevance=u.length+1,(0,_setValue.default)(n,c.object,l);if((0,_isCloneable.default)(o)&&o||(o=a?Array.isArray(i)?[]:{}:i),(0,_isCloneable.default)(o))return(0,_setValue.default)(n,mergeObjectsBase({mapLimit:e,depthLimit:r-1,relevancyRange:t,map:u,useClone:a})(o,i),l);u.push({source:i,object:o,relevance:u.length}),u=(0,_relevancyFilter.default)(u,{mapLimit:e,relevancyRange:t})}return(0,_setValue.default)(n,i,l)}),s)):s),n||{})}};var _default=mergeObjectsBase;exports.default=_default;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0,require("core-js/modules/esnext.async-iterator.map.js"),require("core-js/modules/esnext.iterator.map.js"),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/esnext.async-iterator.find.js"),require("core-js/modules/esnext.iterator.find.js"),require("core-js/stable");var _isCloneable=_interopRequireDefault(require("./isCloneable")),_reduceObject=_interopRequireDefault(require("./reduceObject")),_relevancyFilter=_interopRequireDefault(require("../functions/relevancyFilter")),_setValue=_interopRequireDefault(require("./setValue"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const mergeObjectsBase=function(){let{mapLimit:e=100,depthLimit:r=-1,relevancyRange:t=1e3,map:u=[],useClone:a=!1}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(){for(var s=arguments.length,l=new Array(s),i=0;i<s;i++)l[i]=arguments[i];const n=a?Array.isArray(l[0])?[]:{}:l.shift();return l.length<1||0===r?n:l.reduce(((s,l)=>l?(u.push({source:l,object:s,relevance:u.length}),u=(0,_relevancyFilter.default)(u,{mapLimit:e,relevancyRange:t}),(0,_reduceObject.default)(l,((l,i,n)=>{if((0,_isCloneable.default)(i)){let o=s[n];const c=u.find((e=>e.source===i));if(c)return c.relevance=u.length+1,(0,_setValue.default)(n,c.object,l);if((0,_isCloneable.default)(o)&&o||(o=a?Array.isArray(i)?[]:{}:i),(0,_isCloneable.default)(o))return(0,_setValue.default)(n,mergeObjectsBase({mapLimit:e,depthLimit:r-1,relevancyRange:t,map:u,useClone:a})(o,i),l);u.push({source:i,object:o,relevance:u.length}),u=(0,_relevancyFilter.default)(u,{mapLimit:e,relevancyRange:t})}return(0,_setValue.default)(n,i,l)}),s)):s),n||{})}};var _default=mergeObjectsBase;exports.default=_default;
@@ -0,0 +1,14 @@
1
+ import 'core-js/stable';
2
+ /**
3
+ * Uses mergeObjectsBase deep merge objects and arrays, merge by reference.
4
+ * @function
5
+ * @memberOf module:objectHelpers
6
+ * @see {@link module:objectHelpers~mergeObjectsCallback}
7
+ * @param {...Object} objects - Provide a list of objects which will be merged starting from the end up into the first
8
+ * @returns {*}
9
+ */
10
+ declare const mergeObjectsMutable: (...objects: Object[]) => any[] | {
11
+ [k: string]: any;
12
+ [k: number]: any;
13
+ };
14
+ export default mergeObjectsMutable;
@@ -7,13 +7,13 @@ exports.default = void 0
7
7
  require('core-js/stable')
8
8
  var _mergeObjectsBase = _interopRequireDefault(require('./mergeObjectsBase'))
9
9
  function _interopRequireDefault (obj) { return obj && obj.__esModule ? obj : { default: obj } }
10
- /**
11
- * Uses mergeObjectsBase deep merge objects and arrays, merge by reference.
12
- * @function
13
- * @memberOf module:objectHelpers
14
- * @see {@link module:objectHelpers~mergeObjectsCallback}
15
- * @param {...Object} objects - Provide a list of objects which will be merged starting from the end up into the first
16
- * @returns {*}
10
+ /**
11
+ * Uses mergeObjectsBase deep merge objects and arrays, merge by reference.
12
+ * @function
13
+ * @memberOf module:objectHelpers
14
+ * @see {@link module:objectHelpers~mergeObjectsCallback}
15
+ * @param {...Object} objects - Provide a list of objects which will be merged starting from the end up into the first
16
+ * @returns {*}
17
17
  */
18
18
  const mergeObjectsMutable = (0, _mergeObjectsBase.default)()
19
19
  var _default = mergeObjectsMutable
@@ -0,0 +1,15 @@
1
+ import 'core-js/stable';
2
+ type keyableItem = Array<any> | {
3
+ [k: number | string]: any;
4
+ };
5
+ /**
6
+ * Get an array of keys from any object or array. Will return empty array when invalid or there are no keys.
7
+ * Optional flag will include the inherited keys from prototype chain when set.
8
+ * @function
9
+ * @memberOf module:objectHelpers
10
+ * @param {Object|Array} object
11
+ * @param {boolean} [includeInherited=false]
12
+ * @returns {Array.<string|number>}
13
+ */
14
+ declare const objectKeys: (object: keyableItem, includeInherited?: boolean) => Array<any>;
15
+ export default objectKeys;
@@ -7,14 +7,14 @@ exports.default = void 0
7
7
  require('core-js/stable')
8
8
  var _isObject = _interopRequireDefault(require('./isObject'))
9
9
  function _interopRequireDefault (obj) { return obj && obj.__esModule ? obj : { default: obj } }
10
- /**
11
- * Get an array of keys from any object or array. Will return empty array when invalid or there are no keys.
12
- * Optional flag will include the inherited keys from prototype chain when set.
13
- * @function
14
- * @memberOf module:objectHelpers
15
- * @param {Object|Array} object
16
- * @param {boolean} [includeInherited=false]
17
- * @returns {Array.<string|number>}
10
+ /**
11
+ * Get an array of keys from any object or array. Will return empty array when invalid or there are no keys.
12
+ * Optional flag will include the inherited keys from prototype chain when set.
13
+ * @function
14
+ * @memberOf module:objectHelpers
15
+ * @param {Object|Array} object
16
+ * @param {boolean} [includeInherited=false]
17
+ * @returns {Array.<string|number>}
18
18
  */
19
19
  const objectKeys = function (object) {
20
20
  const includeInherited = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false
@@ -0,0 +1,15 @@
1
+ import 'core-js/stable';
2
+ type arrayObjectItem = Array<any> | {
3
+ [k: number | string]: any;
4
+ };
5
+ /**
6
+ * Get an array of values from any object or array. Will return empty array when invalid or there are no values.
7
+ * Optional flag will include the inherited values from prototype chain when set.
8
+ * @function
9
+ * @memberOf module:objectHelpers
10
+ * @param {Object|Array} object
11
+ * @param {boolean} [includeInherited=false]
12
+ * @returns {Array}
13
+ */
14
+ declare const objectValues: (object: arrayObjectItem, includeInherited?: boolean) => Array<any>;
15
+ export default objectValues;
@@ -9,14 +9,14 @@ require('core-js/modules/esnext.iterator.map.js')
9
9
  require('core-js/stable')
10
10
  var _objectKeys = _interopRequireDefault(require('./objectKeys'))
11
11
  function _interopRequireDefault (obj) { return obj && obj.__esModule ? obj : { default: obj } }
12
- /**
13
- * Get an array of values from any object or array. Will return empty array when invalid or there are no values.
14
- * Optional flag will include the inherited values from prototype chain when set.
15
- * @function
16
- * @memberOf module:objectHelpers
17
- * @param {Object|Array} object
18
- * @param {boolean} [includeInherited=false]
19
- * @returns {Array}
12
+ /**
13
+ * Get an array of values from any object or array. Will return empty array when invalid or there are no values.
14
+ * Optional flag will include the inherited values from prototype chain when set.
15
+ * @function
16
+ * @memberOf module:objectHelpers
17
+ * @param {Object|Array} object
18
+ * @param {boolean} [includeInherited=false]
19
+ * @returns {Array}
20
20
  */
21
21
  const objectValues = function (object) {
22
22
  const includeInherited = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false
@@ -0,0 +1,32 @@
1
+ import 'core-js/stable';
2
+ type reduceableItem = Array<any> | {
3
+ [k: number | string]: any;
4
+ };
5
+ /**
6
+ * Function to execute on each property in the object, taking four arguments
7
+ * @callback module:objectHelpers~reduceCallback
8
+ * @memberOf module:objectHelpers
9
+ * @param {*} [accumulator={}] - The accumulator accumulates the callback's return values; it is the accumulated
10
+ * value previously returned in the last invocation of the callback, or initialValue, if supplied (see below).
11
+ * @param {*} [currentProperty={}] - The current property being processed in the object.
12
+ * @param {string} [currentIndex=0] - The index of the current element being processed in the array. Starts at index
13
+ * 0, if an initialValue is provided, and at index 1 otherwise.
14
+ * @param {Object|Array} [object={}] - The object reduce was called upon.
15
+ * @returns {*}
16
+ */
17
+ type reduceCallback = (accumulator: any, currentProperty: any, currentIndex: keyof reduceableItem, object: reduceableItem) => any;
18
+ /**
19
+ * This function is intended to replicate behaviour of the Array.reduce() function but for Objects.
20
+ * If an array is passed in instead then it will perform standard reduce(). It is recommended to
21
+ * always use the standard reduce() function when it is known that the object is actually an array.
22
+ * @function
23
+ * @memberOf module:objectHelpers
24
+ * @param {Object|Array} obj - The Object (or Array) to be filtered
25
+ * @param {module:objectHelpers~reduceCallback|Function|reduceCallback} fn - The function to be processed for each filtered property
26
+ * @param {Object|Array} [initialValue] - Optional. Value to use as the first argument to the first call of the
27
+ * callback. If no initial value is supplied, the first element in the array will be used. Calling reduce on an empty
28
+ * array without an initial value is an error.
29
+ * @returns {*}
30
+ */
31
+ declare const reduceObject: (obj: reduceableItem, fn: reduceCallback, initialValue?: reduceableItem) => any;
32
+ export default reduceObject;
@@ -11,30 +11,18 @@ require('core-js/stable')
11
11
  var _callWithParams = _interopRequireDefault(require('../functions/callWithParams'))
12
12
  var _objectKeys = _interopRequireDefault(require('./objectKeys'))
13
13
  function _interopRequireDefault (obj) { return obj && obj.__esModule ? obj : { default: obj } }
14
- /**
15
- * Function to execute on each property in the object, taking four arguments
16
- * @callback module:objectHelpers~reduceCallback
17
- * @memberOf module:objectHelpers
18
- * @param {*} [accumulator={}] - The accumulator accumulates the callback's return values; it is the accumulated
19
- * value previously returned in the last invocation of the callback, or initialValue, if supplied (see below).
20
- * @param {*} [currentProperty={}] - The current property being processed in the object.
21
- * @param {string} [currentIndex=0] - The index of the current element being processed in the array. Starts at index
22
- * 0, if an initialValue is provided, and at index 1 otherwise.
23
- * @param {Object|Array} [object={}] - The object reduce was called upon.
24
- * @returns {*}
25
- */
26
- /**
27
- * This function is intended to replicate behaviour of the Array.reduce() function but for Objects.
28
- * If an array is passed in instead then it will perform standard reduce(). It is recommended to
29
- * always use the standard reduce() function when it is known that the object is actually an array.
30
- * @function
31
- * @memberOf module:objectHelpers
32
- * @param {Object|Array} obj - The Object (or Array) to be filtered
33
- * @param {module:objectHelpers~reduceCallback|Function} fn - The function to be processed for each filtered property
34
- * @param {Object|Array} [initialValue] - Optional. Value to use as the first argument to the first call of the
35
- * callback. If no initial value is supplied, the first element in the array will be used. Calling reduce on an empty
36
- * array without an initial value is an error.
37
- * @returns {Object|Array}
14
+ /**
15
+ * This function is intended to replicate behaviour of the Array.reduce() function but for Objects.
16
+ * If an array is passed in instead then it will perform standard reduce(). It is recommended to
17
+ * always use the standard reduce() function when it is known that the object is actually an array.
18
+ * @function
19
+ * @memberOf module:objectHelpers
20
+ * @param {Object|Array} obj - The Object (or Array) to be filtered
21
+ * @param {module:objectHelpers~reduceCallback|Function|reduceCallback} fn - The function to be processed for each filtered property
22
+ * @param {Object|Array} [initialValue] - Optional. Value to use as the first argument to the first call of the
23
+ * callback. If no initial value is supplied, the first element in the array will be used. Calling reduce on an empty
24
+ * array without an initial value is an error.
25
+ * @returns {*}
38
26
  */
39
27
  const reduceObject = function (obj, fn) {
40
28
  const initialValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : obj[(0, _objectKeys.default)(obj)[0]] || obj[0]
@@ -0,0 +1,15 @@
1
+ import 'core-js/stable';
2
+ type settableItem = Array<any> | {
3
+ [k: number | string]: any;
4
+ };
5
+ /**
6
+ * Set a value on an item, then return the value
7
+ * @function
8
+ * @memberOf module:objectHelpers
9
+ * @param {Object|Array} item - An object or array to be updated
10
+ * @param {string|number} key - The key on the item which will have its value set
11
+ * @param {*} value - Any value to be applied to the key
12
+ * @returns {*}
13
+ */
14
+ declare const setAndReturnValue: (item: settableItem, key: keyof settableItem, value: any) => any;
15
+ export default setAndReturnValue;
@@ -5,14 +5,14 @@ Object.defineProperty(exports, '__esModule', {
5
5
  })
6
6
  exports.default = void 0
7
7
  require('core-js/stable')
8
- /**
9
- * Set a value on an item, then return the value
10
- * @function
11
- * @memberOf module:objectHelpers
12
- * @param {Object|Array} item - An object or array to be updated
13
- * @param {string|number} key - The key on the item which will have its value set
14
- * @param {*} value - Any value to be applied to the key
15
- * @returns {*}
8
+ /**
9
+ * Set a value on an item, then return the value
10
+ * @function
11
+ * @memberOf module:objectHelpers
12
+ * @param {Object|Array} item - An object or array to be updated
13
+ * @param {string|number} key - The key on the item which will have its value set
14
+ * @param {*} value - Any value to be applied to the key
15
+ * @returns {*}
16
16
  */
17
17
  const setAndReturnValue = (item, key, value) => {
18
18
  item[key] = value
@@ -0,0 +1,16 @@
1
+ import 'core-js/stable';
2
+ type settableItem = Array<any> | {
3
+ [k: number | string]: any;
4
+ };
5
+ /**
6
+ * Set a value on an item, then return the item.
7
+ * NOTE: Argument order designed for usage with pipe
8
+ * @function
9
+ * @memberOf module:objectHelpers
10
+ * @param {string|number} key - The key on the item which will have its value set
11
+ * @param {*} value - Any value to be applied to the key
12
+ * @param {Object|Array} item - An object or array to be updated
13
+ * @returns {Object|Array}
14
+ */
15
+ declare const setValue: (key: number | string, value: any, item: settableItem) => settableItem;
16
+ export default setValue;
@@ -5,17 +5,18 @@ Object.defineProperty(exports, '__esModule', {
5
5
  })
6
6
  exports.default = void 0
7
7
  require('core-js/stable')
8
- /**
9
- * Set a value on an item, then return the item.
10
- * NOTE: Argument order designed for usage with pipe
11
- * @function
12
- * @memberOf module:objectHelpers
13
- * @param {string|number} key - The key on the item which will have its value set
14
- * @param {*} value - Any value to be applied to the key
15
- * @param {Object|Array} item - An object or array to be updated
16
- * @returns {Object|Array}
8
+ /**
9
+ * Set a value on an item, then return the item.
10
+ * NOTE: Argument order designed for usage with pipe
11
+ * @function
12
+ * @memberOf module:objectHelpers
13
+ * @param {string|number} key - The key on the item which will have its value set
14
+ * @param {*} value - Any value to be applied to the key
15
+ * @param {Object|Array} item - An object or array to be updated
16
+ * @returns {Object|Array}
17
17
  */
18
18
  const setValue = (key, value, item) => {
19
+ // @ts-ignore
19
20
  item[key] = value
20
21
  return item
21
22
  }