si-funciona 2.3.4 → 2.4.0
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 +10 -10
- package/dist/helpers/arrays/addUniqueToArray.js +17 -17
- package/dist/helpers/arrays/buildArray.d.ts +11 -11
- package/dist/helpers/arrays/buildArray.js +26 -26
- package/dist/helpers/arrays/buildArrayOfReferences.d.ts +11 -11
- package/dist/helpers/arrays/buildArrayOfReferences.js +23 -23
- package/dist/helpers/arrays/compareArrays.d.ts +97 -97
- package/dist/helpers/arrays/compareArrays.js +97 -97
- package/dist/helpers/arrays/mergeArrays.d.ts +9 -9
- package/dist/helpers/arrays/mergeArrays.js +22 -22
- package/dist/helpers/arrays/uniqueArray.d.ts +9 -9
- package/dist/helpers/arrays/uniqueArray.js +17 -17
- package/dist/helpers/descriptors/samples/descriptor.js +22 -22
- package/dist/helpers/descriptors/samples/descriptorDetail.js +24 -24
- package/dist/helpers/descriptors/samples/descriptorMap.js +14 -14
- package/dist/helpers/functions/callWithParams.d.ts +11 -11
- package/dist/helpers/functions/callWithParams.js +17 -17
- package/dist/helpers/functions/curry.d.ts +11 -11
- package/dist/helpers/functions/curry.js +17 -17
- package/dist/helpers/functions/delay.d.ts +21 -21
- package/dist/helpers/functions/delay.js +32 -32
- package/dist/helpers/functions/onBodyLoad.d.ts +10 -10
- package/dist/helpers/functions/onBodyLoad.js +74 -74
- package/dist/helpers/functions/pipe.d.ts +10 -10
- package/dist/helpers/functions/pipe.js +18 -18
- package/dist/helpers/functions/preloadParams.d.ts +20 -20
- package/dist/helpers/functions/preloadParams.js +21 -21
- package/dist/helpers/functions/queueTimeout.d.ts +21 -21
- package/dist/helpers/functions/queueTimeout.js +23 -23
- package/dist/helpers/functions.d.ts +29 -29
- package/dist/helpers/functions.js +40 -40
- package/dist/helpers/numbers/absoluteMax.d.ts +10 -10
- package/dist/helpers/numbers/absoluteMax.js +16 -16
- package/dist/helpers/numbers/absoluteMin.d.ts +10 -10
- package/dist/helpers/numbers/absoluteMin.js +16 -16
- package/dist/helpers/numbers/compare.d.ts +13 -13
- package/dist/helpers/numbers/compare.js +19 -19
- package/dist/helpers/numbers/greatestCommonDivisor.d.ts +10 -10
- package/dist/helpers/numbers/greatestCommonDivisor.js +16 -16
- package/dist/helpers/numbers/leastCommonMultiple.d.ts +10 -10
- package/dist/helpers/numbers/leastCommonMultiple.js +18 -18
- package/dist/helpers/numbers/randomInteger.d.ts +13 -13
- package/dist/helpers/numbers/randomInteger.js +19 -19
- package/dist/helpers/numbers/randomNumber.d.ts +13 -13
- package/dist/helpers/numbers/randomNumber.js +19 -19
- package/dist/helpers/numbers/simplestRatio.d.ts +9 -9
- package/dist/helpers/numbers/simplestRatio.js +29 -29
- package/dist/helpers/numbers.d.ts +21 -21
- package/dist/helpers/numbers.js +36 -36
- package/dist/helpers/objects/cloneObject.d.ts +20 -20
- package/dist/helpers/objects/cloneObject.js +32 -32
- package/dist/helpers/objects/dotGet.d.ts +12 -12
- package/dist/helpers/objects/dotGet.js +60 -60
- package/dist/helpers/objects/dotNotate.d.ts +28 -28
- package/dist/helpers/objects/dotNotate.js +80 -80
- package/dist/helpers/objects/dotSet.d.ts +12 -12
- package/dist/helpers/objects/dotSet.js +54 -54
- package/dist/helpers/objects/dotUnset.d.ts +11 -11
- package/dist/helpers/objects/dotUnset.js +53 -53
- package/dist/helpers/objects/emptyObject.d.ts +9 -9
- package/dist/helpers/objects/emptyObject.js +18 -18
- package/dist/helpers/objects/filterObject.d.ts +27 -27
- package/dist/helpers/objects/filterObject.js +32 -32
- package/dist/helpers/objects/isCloneable.d.ts +9 -9
- package/dist/helpers/objects/isCloneable.js +17 -17
- package/dist/helpers/objects/isInstanceObject.d.ts +9 -9
- package/dist/helpers/objects/isInstanceObject.js +27 -27
- package/dist/helpers/objects/isObject.d.ts +9 -9
- package/dist/helpers/objects/isObject.js +15 -15
- package/dist/helpers/objects/mapObject.d.ts +26 -26
- package/dist/helpers/objects/mapObject.js +26 -26
- package/dist/helpers/objects/mergeObjects.d.ts +13 -13
- package/dist/helpers/objects/mergeObjects.js +20 -20
- package/dist/helpers/objects/mergeObjectsBase.d.ts +36 -36
- package/dist/helpers/objects/mergeObjectsBase.js +92 -92
- package/dist/helpers/objects/mergeObjectsMutable.d.ts +13 -13
- package/dist/helpers/objects/mergeObjectsMutable.js +18 -18
- package/dist/helpers/objects/objectKeys.d.ts +14 -14
- package/dist/helpers/objects/objectKeys.js +40 -40
- package/dist/helpers/objects/objectValues.d.ts +14 -14
- package/dist/helpers/objects/objectValues.js +21 -21
- package/dist/helpers/objects/reduceObject.d.ts +31 -31
- package/dist/helpers/objects/reduceObject.js +26 -26
- package/dist/helpers/objects/setAndReturnValue.d.ts +14 -14
- package/dist/helpers/objects/setAndReturnValue.js +20 -20
- package/dist/helpers/objects/setValue.d.ts +15 -15
- package/dist/helpers/objects/setValue.js +22 -22
- package/dist/helpers/objects.d.ts +100 -100
- package/dist/helpers/objects.js +56 -56
- package/dist/helpers/strings.d.ts +25 -25
- package/dist/helpers/strings.js +44 -44
- package/dist/main.d.ts +9 -9
- package/dist/main.js +30 -30
- package/package.json +2 -5
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import 'core-js/stable';
|
|
2
|
-
export type dotNotateableItem = Array<any> | {
|
|
3
|
-
[k: string]: any;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* A string representing the full-path to a property in an object. Each depth of the path is separated by a period.
|
|
7
|
-
* @example 'a.b.c'
|
|
8
|
-
* @typedef {string} DotNotationString
|
|
9
|
-
* @memberOf module:objectHelpers
|
|
10
|
-
*/
|
|
11
|
-
export type dotNotationString = string;
|
|
12
|
-
/**
|
|
13
|
-
* An array or object where all properties have been flatted and keyed by a dot-notated string.
|
|
14
|
-
* @typedef {Object.<DotNotationString, *>} DotNotatedObject
|
|
15
|
-
* @memberOf module:objectHelpers
|
|
16
|
-
*/
|
|
17
|
-
type dotNotatedObject = {
|
|
18
|
-
[k: dotNotationString]: any;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Convert an array or object to a single dimensional associative array with dot notation.
|
|
22
|
-
* @memberOf module:objectHelpers
|
|
23
|
-
* @param {Object} arrayObject - The array or object to dot-notate
|
|
24
|
-
* @param {Array.<DotNotationString>} [retainObjects=[]] - An array of keys to retain as objects
|
|
25
|
-
* @returns {DotNotatedObject} The dot-notated object
|
|
26
|
-
*/
|
|
27
|
-
declare const dotNotate: (arrayObject: object, retainObjects?: Array<dotNotationString>) => dotNotatedObject;
|
|
28
|
-
export default dotNotate;
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
export type dotNotateableItem = Array<any> | {
|
|
3
|
+
[k: string]: any;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* A string representing the full-path to a property in an object. Each depth of the path is separated by a period.
|
|
7
|
+
* @example 'a.b.c'
|
|
8
|
+
* @typedef {string} DotNotationString
|
|
9
|
+
* @memberOf module:objectHelpers
|
|
10
|
+
*/
|
|
11
|
+
export type dotNotationString = string;
|
|
12
|
+
/**
|
|
13
|
+
* An array or object where all properties have been flatted and keyed by a dot-notated string.
|
|
14
|
+
* @typedef {Object.<DotNotationString, *>} DotNotatedObject
|
|
15
|
+
* @memberOf module:objectHelpers
|
|
16
|
+
*/
|
|
17
|
+
type dotNotatedObject = {
|
|
18
|
+
[k: dotNotationString]: any;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Convert an array or object to a single dimensional associative array with dot notation.
|
|
22
|
+
* @memberOf module:objectHelpers
|
|
23
|
+
* @param {Object} arrayObject - The array or object to dot-notate
|
|
24
|
+
* @param {Array.<DotNotationString>} [retainObjects=[]] - An array of keys to retain as objects
|
|
25
|
+
* @returns {DotNotatedObject} The dot-notated object
|
|
26
|
+
*/
|
|
27
|
+
declare const dotNotate: (arrayObject: object, retainObjects?: Array<dotNotationString>) => dotNotatedObject;
|
|
28
|
+
export default dotNotate;
|
|
29
29
|
//# sourceMappingURL=dotNotate.d.ts.map
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.default = void 0
|
|
7
|
-
require('core-js/modules/esnext.iterator.constructor.js')
|
|
8
|
-
require('core-js/modules/esnext.iterator.map.js')
|
|
9
|
-
require('core-js/stable')
|
|
10
|
-
var _isObject = _interopRequireDefault(require('./isObject'))
|
|
11
|
-
function _interopRequireDefault (e) { return e && e.__esModule ? e : { default: e } }
|
|
12
|
-
/**
|
|
13
|
-
* Convert an array of keys into a regex, return a function to test if incoming keys match.
|
|
14
|
-
* @inner
|
|
15
|
-
* @memberOf module:objectHelpers
|
|
16
|
-
* @param {Array.<DotNotationString>} [retainObjects=[]] - An array of keys to retain as objects
|
|
17
|
-
* @returns {Function} The dot-notated array
|
|
18
|
-
*/
|
|
19
|
-
const handleRetainObjects = (retainObjects = []) => {
|
|
20
|
-
if (!retainObjects.length) {
|
|
21
|
-
/**
|
|
22
|
-
* Bypass the test function if there are no retainObjects.
|
|
23
|
-
* @returns {false}
|
|
24
|
-
*/
|
|
25
|
-
return (currentKey, value, results) => false
|
|
26
|
-
}
|
|
27
|
-
retainObjects = retainObjects.map(key => key.replace('\.', '\\.'))
|
|
28
|
-
const retainRegex = new RegExp(`(${retainObjects.join('|')})$`)
|
|
29
|
-
/**
|
|
30
|
-
* Test if a key should be retained as an object.
|
|
31
|
-
* @param {string} currentKey - The key to test
|
|
32
|
-
* @param {*} value - The value of the key
|
|
33
|
-
* @param {Object} results - The results object to add to
|
|
34
|
-
* @returns {boolean}
|
|
35
|
-
*/
|
|
36
|
-
return (currentKey, value, results) => {
|
|
37
|
-
if (!currentKey.match(retainRegex)) {
|
|
38
|
-
return false
|
|
39
|
-
}
|
|
40
|
-
// @ts-ignore
|
|
41
|
-
results[currentKey] = value
|
|
42
|
-
return true
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* The underlying logic function for converting arrays to dot-notation.
|
|
47
|
-
* @inner
|
|
48
|
-
* @memberOf module:objectHelpers
|
|
49
|
-
* @param {Object} arrayObject - The array or object to dot-notate
|
|
50
|
-
* @param {Function} didRetain - The test function to see if a key should be retained
|
|
51
|
-
* @param {DotNotationString} [prepend=''] - The path for the property being processed
|
|
52
|
-
* @param {DotNotatedObject} [results={}] - The final array to return
|
|
53
|
-
* @returns {DotNotatedObject} The dot-notated object
|
|
54
|
-
*/
|
|
55
|
-
const performDotNotate = (arrayObject, didRetain, prepend = '', results = {}) => {
|
|
56
|
-
// @ts-ignore
|
|
57
|
-
for (const key in arrayObject) {
|
|
58
|
-
// @ts-ignore
|
|
59
|
-
const value = arrayObject[key]
|
|
60
|
-
const currentKey = `${prepend}${key}`
|
|
61
|
-
if (didRetain(currentKey, value, results)) {
|
|
62
|
-
continue
|
|
63
|
-
}
|
|
64
|
-
if ((0, _isObject.default)(value)) {
|
|
65
|
-
performDotNotate(value, didRetain, `${currentKey}.`, results)
|
|
66
|
-
continue
|
|
67
|
-
}
|
|
68
|
-
results[currentKey] = value
|
|
69
|
-
}
|
|
70
|
-
return results
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Convert an array or object to a single dimensional associative array with dot notation.
|
|
74
|
-
* @memberOf module:objectHelpers
|
|
75
|
-
* @param {Object} arrayObject - The array or object to dot-notate
|
|
76
|
-
* @param {Array.<DotNotationString>} [retainObjects=[]] - An array of keys to retain as objects
|
|
77
|
-
* @returns {DotNotatedObject} The dot-notated object
|
|
78
|
-
*/
|
|
79
|
-
const dotNotate = (arrayObject, retainObjects = []) => performDotNotate(arrayObject, handleRetainObjects(retainObjects))
|
|
80
|
-
var _default = exports.default = dotNotate
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.default = void 0
|
|
7
|
+
require('core-js/modules/esnext.iterator.constructor.js')
|
|
8
|
+
require('core-js/modules/esnext.iterator.map.js')
|
|
9
|
+
require('core-js/stable')
|
|
10
|
+
var _isObject = _interopRequireDefault(require('./isObject'))
|
|
11
|
+
function _interopRequireDefault (e) { return e && e.__esModule ? e : { default: e } }
|
|
12
|
+
/**
|
|
13
|
+
* Convert an array of keys into a regex, return a function to test if incoming keys match.
|
|
14
|
+
* @inner
|
|
15
|
+
* @memberOf module:objectHelpers
|
|
16
|
+
* @param {Array.<DotNotationString>} [retainObjects=[]] - An array of keys to retain as objects
|
|
17
|
+
* @returns {Function} The dot-notated array
|
|
18
|
+
*/
|
|
19
|
+
const handleRetainObjects = (retainObjects = []) => {
|
|
20
|
+
if (!retainObjects.length) {
|
|
21
|
+
/**
|
|
22
|
+
* Bypass the test function if there are no retainObjects.
|
|
23
|
+
* @returns {false}
|
|
24
|
+
*/
|
|
25
|
+
return (currentKey, value, results) => false
|
|
26
|
+
}
|
|
27
|
+
retainObjects = retainObjects.map(key => key.replace('\.', '\\.'))
|
|
28
|
+
const retainRegex = new RegExp(`(${retainObjects.join('|')})$`)
|
|
29
|
+
/**
|
|
30
|
+
* Test if a key should be retained as an object.
|
|
31
|
+
* @param {string} currentKey - The key to test
|
|
32
|
+
* @param {*} value - The value of the key
|
|
33
|
+
* @param {Object} results - The results object to add to
|
|
34
|
+
* @returns {boolean}
|
|
35
|
+
*/
|
|
36
|
+
return (currentKey, value, results) => {
|
|
37
|
+
if (!currentKey.match(retainRegex)) {
|
|
38
|
+
return false
|
|
39
|
+
}
|
|
40
|
+
// @ts-ignore
|
|
41
|
+
results[currentKey] = value
|
|
42
|
+
return true
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The underlying logic function for converting arrays to dot-notation.
|
|
47
|
+
* @inner
|
|
48
|
+
* @memberOf module:objectHelpers
|
|
49
|
+
* @param {Object} arrayObject - The array or object to dot-notate
|
|
50
|
+
* @param {Function} didRetain - The test function to see if a key should be retained
|
|
51
|
+
* @param {DotNotationString} [prepend=''] - The path for the property being processed
|
|
52
|
+
* @param {DotNotatedObject} [results={}] - The final array to return
|
|
53
|
+
* @returns {DotNotatedObject} The dot-notated object
|
|
54
|
+
*/
|
|
55
|
+
const performDotNotate = (arrayObject, didRetain, prepend = '', results = {}) => {
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
for (const key in arrayObject) {
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
const value = arrayObject[key]
|
|
60
|
+
const currentKey = `${prepend}${key}`
|
|
61
|
+
if (didRetain(currentKey, value, results)) {
|
|
62
|
+
continue
|
|
63
|
+
}
|
|
64
|
+
if ((0, _isObject.default)(value)) {
|
|
65
|
+
performDotNotate(value, didRetain, `${currentKey}.`, results)
|
|
66
|
+
continue
|
|
67
|
+
}
|
|
68
|
+
results[currentKey] = value
|
|
69
|
+
}
|
|
70
|
+
return results
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Convert an array or object to a single dimensional associative array with dot notation.
|
|
74
|
+
* @memberOf module:objectHelpers
|
|
75
|
+
* @param {Object} arrayObject - The array or object to dot-notate
|
|
76
|
+
* @param {Array.<DotNotationString>} [retainObjects=[]] - An array of keys to retain as objects
|
|
77
|
+
* @returns {DotNotatedObject} The dot-notated object
|
|
78
|
+
*/
|
|
79
|
+
const dotNotate = (arrayObject, retainObjects = []) => performDotNotate(arrayObject, handleRetainObjects(retainObjects))
|
|
80
|
+
var _default = exports.default = dotNotate
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import 'core-js/stable';
|
|
2
|
-
import { dotNotateableItem, dotNotationString } from './dotNotate';
|
|
3
|
-
/**
|
|
4
|
-
* Set a nested property value an object.
|
|
5
|
-
* @memberOf module:objectHelpers
|
|
6
|
-
* @param {Object} arrayObject - The array or object to set the property on
|
|
7
|
-
* @param {string} dotNotation - The path for the property
|
|
8
|
-
* @param {*} value - The default value to return if the property is not found
|
|
9
|
-
* @returns {Object} The modified object
|
|
10
|
-
*/
|
|
11
|
-
declare const dotSet: (arrayObject: dotNotateableItem, dotNotation: dotNotationString, value?: any) => dotNotateableItem;
|
|
12
|
-
export default dotSet;
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
import { dotNotateableItem, dotNotationString } from './dotNotate';
|
|
3
|
+
/**
|
|
4
|
+
* Set a nested property value an object.
|
|
5
|
+
* @memberOf module:objectHelpers
|
|
6
|
+
* @param {Object} arrayObject - The array or object to set the property on
|
|
7
|
+
* @param {string} dotNotation - The path for the property
|
|
8
|
+
* @param {*} value - The default value to return if the property is not found
|
|
9
|
+
* @returns {Object} The modified object
|
|
10
|
+
*/
|
|
11
|
+
declare const dotSet: (arrayObject: dotNotateableItem, dotNotation: dotNotationString, value?: any) => dotNotateableItem;
|
|
12
|
+
export default dotSet;
|
|
13
13
|
//# sourceMappingURL=dotSet.d.ts.map
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.default = void 0
|
|
7
|
-
require('core-js/stable')
|
|
8
|
-
var _isObject = _interopRequireDefault(require('./isObject'))
|
|
9
|
-
var _strAfter = _interopRequireDefault(require('../strings/strAfter'))
|
|
10
|
-
var _strBefore = _interopRequireDefault(require('../strings/strBefore'))
|
|
11
|
-
function _interopRequireDefault (e) { return e && e.__esModule ? e : { default: e } }
|
|
12
|
-
/**
|
|
13
|
-
* Set a nested property value an object.
|
|
14
|
-
* @memberOf module:objectHelpers
|
|
15
|
-
* @param {Object} arrayObject - The array or object to set the property on
|
|
16
|
-
* @param {string} dotNotation - The path for the property
|
|
17
|
-
* @param {*} value - The default value to return if the property is not found
|
|
18
|
-
* @returns {Object} The modified object
|
|
19
|
-
*/
|
|
20
|
-
const dotSet = (arrayObject, dotNotation, value = null) => {
|
|
21
|
-
var _a
|
|
22
|
-
let key = (0, _strBefore.default)(dotNotation, '.')
|
|
23
|
-
const lastKey = !key
|
|
24
|
-
if (lastKey) {
|
|
25
|
-
key = dotNotation
|
|
26
|
-
}
|
|
27
|
-
if (key === '*') {
|
|
28
|
-
for (const wildKey in arrayObject) {
|
|
29
|
-
if (lastKey) {
|
|
30
|
-
// @ts-ignore
|
|
31
|
-
arrayObject[wildKey] = value
|
|
32
|
-
continue
|
|
33
|
-
}
|
|
34
|
-
// @ts-ignore
|
|
35
|
-
if (!(0, _isObject.default)(arrayObject[wildKey])) {
|
|
36
|
-
continue
|
|
37
|
-
}
|
|
38
|
-
// @ts-ignore
|
|
39
|
-
dotSet(arrayObject[wildKey], (0, _strAfter.default)(dotNotation, '.'), value)
|
|
40
|
-
}
|
|
41
|
-
return arrayObject
|
|
42
|
-
}
|
|
43
|
-
if (lastKey) {
|
|
44
|
-
// @ts-ignore
|
|
45
|
-
arrayObject[dotNotation] = value
|
|
46
|
-
return arrayObject
|
|
47
|
-
}
|
|
48
|
-
// @ts-ignore
|
|
49
|
-
const next = (_a = arrayObject[key]) !== null && _a !== void 0 ? _a : []
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
arrayObject[key] = dotSet(next, (0, _strAfter.default)(dotNotation, '.'), value)
|
|
52
|
-
return arrayObject
|
|
53
|
-
}
|
|
54
|
-
var _default = exports.default = dotSet
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.default = void 0
|
|
7
|
+
require('core-js/stable')
|
|
8
|
+
var _isObject = _interopRequireDefault(require('./isObject'))
|
|
9
|
+
var _strAfter = _interopRequireDefault(require('../strings/strAfter'))
|
|
10
|
+
var _strBefore = _interopRequireDefault(require('../strings/strBefore'))
|
|
11
|
+
function _interopRequireDefault (e) { return e && e.__esModule ? e : { default: e } }
|
|
12
|
+
/**
|
|
13
|
+
* Set a nested property value an object.
|
|
14
|
+
* @memberOf module:objectHelpers
|
|
15
|
+
* @param {Object} arrayObject - The array or object to set the property on
|
|
16
|
+
* @param {string} dotNotation - The path for the property
|
|
17
|
+
* @param {*} value - The default value to return if the property is not found
|
|
18
|
+
* @returns {Object} The modified object
|
|
19
|
+
*/
|
|
20
|
+
const dotSet = (arrayObject, dotNotation, value = null) => {
|
|
21
|
+
var _a
|
|
22
|
+
let key = (0, _strBefore.default)(dotNotation, '.')
|
|
23
|
+
const lastKey = !key
|
|
24
|
+
if (lastKey) {
|
|
25
|
+
key = dotNotation
|
|
26
|
+
}
|
|
27
|
+
if (key === '*') {
|
|
28
|
+
for (const wildKey in arrayObject) {
|
|
29
|
+
if (lastKey) {
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
arrayObject[wildKey] = value
|
|
32
|
+
continue
|
|
33
|
+
}
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
if (!(0, _isObject.default)(arrayObject[wildKey])) {
|
|
36
|
+
continue
|
|
37
|
+
}
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
dotSet(arrayObject[wildKey], (0, _strAfter.default)(dotNotation, '.'), value)
|
|
40
|
+
}
|
|
41
|
+
return arrayObject
|
|
42
|
+
}
|
|
43
|
+
if (lastKey) {
|
|
44
|
+
// @ts-ignore
|
|
45
|
+
arrayObject[dotNotation] = value
|
|
46
|
+
return arrayObject
|
|
47
|
+
}
|
|
48
|
+
// @ts-ignore
|
|
49
|
+
const next = (_a = arrayObject[key]) !== null && _a !== void 0 ? _a : []
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
arrayObject[key] = dotSet(next, (0, _strAfter.default)(dotNotation, '.'), value)
|
|
52
|
+
return arrayObject
|
|
53
|
+
}
|
|
54
|
+
var _default = exports.default = dotSet
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import 'core-js/stable';
|
|
2
|
-
import { dotNotateableItem, dotNotationString } from './dotNotate';
|
|
3
|
-
/**
|
|
4
|
-
* Unset a nested property value an object.
|
|
5
|
-
* @memberOf module:objectHelpers
|
|
6
|
-
* @param {Object} arrayObject - The array or object to set the property on
|
|
7
|
-
* @param {string} dotNotation - The path for the property
|
|
8
|
-
* @returns {Object} The modified object
|
|
9
|
-
*/
|
|
10
|
-
declare const dotUnset: (arrayObject: dotNotateableItem, dotNotation: dotNotationString) => dotNotateableItem;
|
|
11
|
-
export default dotUnset;
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
import { dotNotateableItem, dotNotationString } from './dotNotate';
|
|
3
|
+
/**
|
|
4
|
+
* Unset a nested property value an object.
|
|
5
|
+
* @memberOf module:objectHelpers
|
|
6
|
+
* @param {Object} arrayObject - The array or object to set the property on
|
|
7
|
+
* @param {string} dotNotation - The path for the property
|
|
8
|
+
* @returns {Object} The modified object
|
|
9
|
+
*/
|
|
10
|
+
declare const dotUnset: (arrayObject: dotNotateableItem, dotNotation: dotNotationString) => dotNotateableItem;
|
|
11
|
+
export default dotUnset;
|
|
12
12
|
//# sourceMappingURL=dotUnset.d.ts.map
|
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.default = void 0
|
|
7
|
-
require('core-js/stable')
|
|
8
|
-
var _isObject = _interopRequireDefault(require('./isObject'))
|
|
9
|
-
var _strAfter = _interopRequireDefault(require('../strings/strAfter'))
|
|
10
|
-
var _strBefore = _interopRequireDefault(require('../strings/strBefore'))
|
|
11
|
-
function _interopRequireDefault (e) { return e && e.__esModule ? e : { default: e } }
|
|
12
|
-
/**
|
|
13
|
-
* Unset a nested property value an object.
|
|
14
|
-
* @memberOf module:objectHelpers
|
|
15
|
-
* @param {Object} arrayObject - The array or object to set the property on
|
|
16
|
-
* @param {string} dotNotation - The path for the property
|
|
17
|
-
* @returns {Object} The modified object
|
|
18
|
-
*/
|
|
19
|
-
const dotUnset = (arrayObject, dotNotation) => {
|
|
20
|
-
var _a
|
|
21
|
-
let key = (0, _strBefore.default)(dotNotation, '.')
|
|
22
|
-
const lastKey = !key
|
|
23
|
-
if (lastKey) {
|
|
24
|
-
key = dotNotation
|
|
25
|
-
}
|
|
26
|
-
if (key === '*') {
|
|
27
|
-
for (const wildKey in arrayObject) {
|
|
28
|
-
if (lastKey) {
|
|
29
|
-
// @ts-ignore
|
|
30
|
-
delete arrayObject[wildKey]
|
|
31
|
-
continue
|
|
32
|
-
}
|
|
33
|
-
// @ts-ignore
|
|
34
|
-
if (!(0, _isObject.default)(arrayObject[wildKey])) {
|
|
35
|
-
continue
|
|
36
|
-
}
|
|
37
|
-
// @ts-ignore
|
|
38
|
-
dotUnset(arrayObject[wildKey], (0, _strAfter.default)(dotNotation, '.'))
|
|
39
|
-
}
|
|
40
|
-
return arrayObject
|
|
41
|
-
}
|
|
42
|
-
if (lastKey) {
|
|
43
|
-
// @ts-ignore
|
|
44
|
-
delete arrayObject[dotNotation]
|
|
45
|
-
return arrayObject
|
|
46
|
-
}
|
|
47
|
-
// @ts-ignore
|
|
48
|
-
const next = (_a = arrayObject[key]) !== null && _a !== void 0 ? _a : []
|
|
49
|
-
// @ts-ignore
|
|
50
|
-
arrayObject[key] = dotUnset(next, (0, _strAfter.default)(dotNotation, '.'))
|
|
51
|
-
return arrayObject
|
|
52
|
-
}
|
|
53
|
-
var _default = exports.default = dotUnset
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.default = void 0
|
|
7
|
+
require('core-js/stable')
|
|
8
|
+
var _isObject = _interopRequireDefault(require('./isObject'))
|
|
9
|
+
var _strAfter = _interopRequireDefault(require('../strings/strAfter'))
|
|
10
|
+
var _strBefore = _interopRequireDefault(require('../strings/strBefore'))
|
|
11
|
+
function _interopRequireDefault (e) { return e && e.__esModule ? e : { default: e } }
|
|
12
|
+
/**
|
|
13
|
+
* Unset a nested property value an object.
|
|
14
|
+
* @memberOf module:objectHelpers
|
|
15
|
+
* @param {Object} arrayObject - The array or object to set the property on
|
|
16
|
+
* @param {string} dotNotation - The path for the property
|
|
17
|
+
* @returns {Object} The modified object
|
|
18
|
+
*/
|
|
19
|
+
const dotUnset = (arrayObject, dotNotation) => {
|
|
20
|
+
var _a
|
|
21
|
+
let key = (0, _strBefore.default)(dotNotation, '.')
|
|
22
|
+
const lastKey = !key
|
|
23
|
+
if (lastKey) {
|
|
24
|
+
key = dotNotation
|
|
25
|
+
}
|
|
26
|
+
if (key === '*') {
|
|
27
|
+
for (const wildKey in arrayObject) {
|
|
28
|
+
if (lastKey) {
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
delete arrayObject[wildKey]
|
|
31
|
+
continue
|
|
32
|
+
}
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
if (!(0, _isObject.default)(arrayObject[wildKey])) {
|
|
35
|
+
continue
|
|
36
|
+
}
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
dotUnset(arrayObject[wildKey], (0, _strAfter.default)(dotNotation, '.'))
|
|
39
|
+
}
|
|
40
|
+
return arrayObject
|
|
41
|
+
}
|
|
42
|
+
if (lastKey) {
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
delete arrayObject[dotNotation]
|
|
45
|
+
return arrayObject
|
|
46
|
+
}
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
const next = (_a = arrayObject[key]) !== null && _a !== void 0 ? _a : []
|
|
49
|
+
// @ts-ignore
|
|
50
|
+
arrayObject[key] = dotUnset(next, (0, _strAfter.default)(dotNotation, '.'))
|
|
51
|
+
return arrayObject
|
|
52
|
+
}
|
|
53
|
+
var _default = exports.default = dotUnset
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import 'core-js/stable';
|
|
2
|
-
/**
|
|
3
|
-
* Helper function for testing if the item is an Object or Array that does not have any properties
|
|
4
|
-
* @memberOf module:objectHelpers
|
|
5
|
-
* @param {Object|Array} item - Object or Array to test
|
|
6
|
-
* @returns {boolean}
|
|
7
|
-
*/
|
|
8
|
-
declare const emptyObject: (item: Array<any> | Object) => boolean;
|
|
9
|
-
export default emptyObject;
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
/**
|
|
3
|
+
* Helper function for testing if the item is an Object or Array that does not have any properties
|
|
4
|
+
* @memberOf module:objectHelpers
|
|
5
|
+
* @param {Object|Array} item - Object or Array to test
|
|
6
|
+
* @returns {boolean}
|
|
7
|
+
*/
|
|
8
|
+
declare const emptyObject: (item: Array<any> | Object) => boolean;
|
|
9
|
+
export default emptyObject;
|
|
10
10
|
//# sourceMappingURL=emptyObject.d.ts.map
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.default = void 0
|
|
7
|
-
require('core-js/stable')
|
|
8
|
-
var _isObject = _interopRequireDefault(require('./isObject'))
|
|
9
|
-
var _objectKeys = _interopRequireDefault(require('./objectKeys'))
|
|
10
|
-
function _interopRequireDefault (e) { return e && e.__esModule ? e : { default: e } }
|
|
11
|
-
/**
|
|
12
|
-
* Helper function for testing if the item is an Object or Array that does not have any properties
|
|
13
|
-
* @memberOf module:objectHelpers
|
|
14
|
-
* @param {Object|Array} item - Object or Array to test
|
|
15
|
-
* @returns {boolean}
|
|
16
|
-
*/
|
|
17
|
-
const emptyObject = item => (typeof item === 'function' || (0, _isObject.default)(item)) && !(0, _objectKeys.default)(item).length
|
|
18
|
-
var _default = exports.default = emptyObject
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.default = void 0
|
|
7
|
+
require('core-js/stable')
|
|
8
|
+
var _isObject = _interopRequireDefault(require('./isObject'))
|
|
9
|
+
var _objectKeys = _interopRequireDefault(require('./objectKeys'))
|
|
10
|
+
function _interopRequireDefault (e) { return e && e.__esModule ? e : { default: e } }
|
|
11
|
+
/**
|
|
12
|
+
* Helper function for testing if the item is an Object or Array that does not have any properties
|
|
13
|
+
* @memberOf module:objectHelpers
|
|
14
|
+
* @param {Object|Array} item - Object or Array to test
|
|
15
|
+
* @returns {boolean}
|
|
16
|
+
*/
|
|
17
|
+
const emptyObject = item => (typeof item === 'function' || (0, _isObject.default)(item)) && !(0, _objectKeys.default)(item).length
|
|
18
|
+
var _default = exports.default = emptyObject
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import 'core-js/stable';
|
|
2
|
-
type filterableItem = Array<any> | {
|
|
3
|
-
[k: number | string]: any;
|
|
4
|
-
};
|
|
5
|
-
/**
|
|
6
|
-
* Function is a predicate, to test each property value of the object. Return true to keep the element, false
|
|
7
|
-
* otherwise, taking three arguments
|
|
8
|
-
* @callback module:objectHelpers~filterCallback
|
|
9
|
-
* @memberOf module:objectHelpers
|
|
10
|
-
* @param {*} currentProperty - The current property being processed in the object.
|
|
11
|
-
* @param {string} [currentIndex] - The property name of the current property being processed in the object.
|
|
12
|
-
* @param {Object|Array} [object] - The object filter was called upon.
|
|
13
|
-
* @returns {boolean}
|
|
14
|
-
*/
|
|
15
|
-
type filterCallback = (currentProperty: any, currentIndex: keyof filterableItem, object: filterableItem) => boolean;
|
|
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
|
-
* @memberOf module:objectHelpers
|
|
21
|
-
* @param {Object|Array} obj - The Object (or Array) to be filtered
|
|
22
|
-
* @param {module:objectHelpers~filterCallback|Function} fn - The function to be processed for each filtered property
|
|
23
|
-
* @param {Object|Array} [thisArg] - Optional. Value to use as this when executing callback.
|
|
24
|
-
* @returns {Object|Array}
|
|
25
|
-
*/
|
|
26
|
-
declare const filterObject: (obj: filterableItem, fn: filterCallback, thisArg?: filterableItem) => filterableItem;
|
|
27
|
-
export default filterObject;
|
|
1
|
+
import 'core-js/stable';
|
|
2
|
+
type filterableItem = Array<any> | {
|
|
3
|
+
[k: number | string]: any;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Function is a predicate, to test each property value of the object. Return true to keep the element, false
|
|
7
|
+
* otherwise, taking three arguments
|
|
8
|
+
* @callback module:objectHelpers~filterCallback
|
|
9
|
+
* @memberOf module:objectHelpers
|
|
10
|
+
* @param {*} currentProperty - The current property being processed in the object.
|
|
11
|
+
* @param {string} [currentIndex] - The property name of the current property being processed in the object.
|
|
12
|
+
* @param {Object|Array} [object] - The object filter was called upon.
|
|
13
|
+
* @returns {boolean}
|
|
14
|
+
*/
|
|
15
|
+
type filterCallback = (currentProperty: any, currentIndex: keyof filterableItem, object: filterableItem) => boolean;
|
|
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
|
+
* @memberOf module:objectHelpers
|
|
21
|
+
* @param {Object|Array} obj - The Object (or Array) to be filtered
|
|
22
|
+
* @param {module:objectHelpers~filterCallback|Function} fn - The function to be processed for each filtered property
|
|
23
|
+
* @param {Object|Array} [thisArg] - Optional. Value to use as this when executing callback.
|
|
24
|
+
* @returns {Object|Array}
|
|
25
|
+
*/
|
|
26
|
+
declare const filterObject: (obj: filterableItem, fn: filterCallback, thisArg?: filterableItem) => filterableItem;
|
|
27
|
+
export default filterObject;
|
|
28
28
|
//# sourceMappingURL=filterObject.d.ts.map
|