Comparing version 2.2.0 to 2.2.1
@@ -8,2 +8,25 @@ 'use strict'; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
***************************************************************************** */ | ||
function __spreadArrays() { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
} | ||
// external dependencies | ||
@@ -429,5 +452,4 @@ var O = Object; | ||
// utils | ||
var isArray$1 = Array.isArray; | ||
var slice = Function.prototype.bind.call(Function.prototype.bind, Array.prototype.slice); | ||
var slice = Function.prototype.bind.call(Function.prototype.call, Array.prototype.slice); | ||
function createCall(isWithHandler) { | ||
@@ -442,3 +464,3 @@ if (isWithHandler) { | ||
if (isEmptyPath(path)) { | ||
return callIfFunction(fn.apply(void 0, [object].concat(extraArgs)), context, parameters); | ||
return callIfFunction(fn.apply(void 0, __spreadArrays([object], extraArgs)), context, parameters); | ||
} | ||
@@ -449,3 +471,3 @@ var value = getValueAtPath(path, object); | ||
} | ||
var result = fn.apply(void 0, [value].concat(extraArgs)); | ||
var result = fn.apply(void 0, __spreadArrays([value], extraArgs)); | ||
return callIfFunction(result, context, parameters); | ||
@@ -468,6 +490,6 @@ }; | ||
if (isEmptyPath(path)) { | ||
return fn.apply(void 0, [object].concat(extraArgs)); | ||
return fn.apply(void 0, __spreadArrays([object], extraArgs)); | ||
} | ||
var value = getValueAtPath(path, object); | ||
return value === void 0 ? value : fn.apply(void 0, [value].concat(extraArgs)); | ||
return value === void 0 ? value : fn.apply(void 0, __spreadArrays([value], extraArgs)); | ||
}; | ||
@@ -487,6 +509,6 @@ } | ||
if (isEmptyPath(path)) { | ||
return fn.apply(void 0, [object].concat(extraArgs)); | ||
return fn.apply(void 0, __spreadArrays([object], extraArgs)); | ||
} | ||
var value = getValueAtPath(path, object); | ||
return value === void 0 ? noMatchValue : fn.apply(void 0, [value].concat(extraArgs)); | ||
return value === void 0 ? noMatchValue : fn.apply(void 0, __spreadArrays([value], extraArgs)); | ||
}; | ||
@@ -506,6 +528,6 @@ } | ||
if (isEmptyPath(path)) { | ||
return !!fn.apply(void 0, [object].concat(extraArgs)); | ||
return !!fn.apply(void 0, __spreadArrays([object], extraArgs)); | ||
} | ||
var value = getValueAtPath(path, object); | ||
return value !== void 0 && !!fn.apply(void 0, [value].concat(extraArgs)); | ||
return value !== void 0 && !!fn.apply(void 0, __spreadArrays([value], extraArgs)); | ||
}; | ||
@@ -525,5 +547,5 @@ } | ||
if (isEmptyPath(path)) { | ||
return isSameValueZero(fn.apply(void 0, [object].concat(extraArgs)), value); | ||
return isSameValueZero(fn.apply(void 0, __spreadArrays([object], extraArgs)), value); | ||
} | ||
return isSameValueZero(fn.apply(void 0, [getValueAtPath(path, object)].concat(extraArgs)), value); | ||
return isSameValueZero(fn.apply(void 0, __spreadArrays([getValueAtPath(path, object)], extraArgs)), value); | ||
}; | ||
@@ -544,6 +566,6 @@ } | ||
if (!isCloneable(object)) { | ||
return fn.apply(void 0, [object].concat(extraArgs)); | ||
return fn.apply(void 0, __spreadArrays([object], extraArgs)); | ||
} | ||
if (isEmptyPath(path)) { | ||
var objectToMerge = fn.apply(void 0, [object].concat(extraArgs)); | ||
var objectToMerge = fn.apply(void 0, __spreadArrays([object], extraArgs)); | ||
return objectToMerge ? getMergedObject(object, objectToMerge, isDeep) : object; | ||
@@ -553,3 +575,3 @@ } | ||
var result = getDeepClone(path, object, function (ref, key) { | ||
var objectToMerge = fn.apply(void 0, [ref[key]].concat(extraArgs)); | ||
var objectToMerge = fn.apply(void 0, __spreadArrays([ref[key]], extraArgs)); | ||
if (objectToMerge) { | ||
@@ -589,6 +611,6 @@ ref[key] = getMergedObject(ref[key], objectToMerge, isDeep); | ||
var emptyObject = getNewEmptyObject(object); | ||
return fn.apply(void 0, [emptyObject].concat(extraArgs)) ? emptyObject : object; | ||
return fn.apply(void 0, __spreadArrays([emptyObject], extraArgs)) ? emptyObject : object; | ||
} | ||
var value = getValueAtPath(path, object); | ||
return value !== void 0 && fn.apply(void 0, [value].concat(extraArgs)) | ||
return value !== void 0 && fn.apply(void 0, __spreadArrays([value], extraArgs)) | ||
? getDeepClone(path, object, function (ref, key) { | ||
@@ -629,4 +651,4 @@ if (isArray$1(ref)) { | ||
return isEmptyPath(path) | ||
? fn.apply(void 0, [object].concat(extraArgs)) : getDeepClone(path, object, function (ref, key) { | ||
ref[key] = fn.apply(void 0, [ref[key]].concat(extraArgs)); | ||
? fn.apply(void 0, __spreadArrays([object], extraArgs)) : getDeepClone(path, object, function (ref, key) { | ||
ref[key] = fn.apply(void 0, __spreadArrays([ref[key]], extraArgs)); | ||
}); | ||
@@ -680,6 +702,6 @@ }; | ||
Object.defineProperty(exports, '__', { | ||
enumerable: true, | ||
get: function () { | ||
return curriable.__; | ||
} | ||
enumerable: true, | ||
get: function () { | ||
return curriable.__; | ||
} | ||
}); | ||
@@ -686,0 +708,0 @@ exports.add = add; |
@@ -5,2 +5,25 @@ import { curry } from 'curriable'; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
***************************************************************************** */ | ||
function __spreadArrays() { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
} | ||
// external dependencies | ||
@@ -426,5 +449,4 @@ var O = Object; | ||
// utils | ||
var isArray$1 = Array.isArray; | ||
var slice = Function.prototype.bind.call(Function.prototype.bind, Array.prototype.slice); | ||
var slice = Function.prototype.bind.call(Function.prototype.call, Array.prototype.slice); | ||
function createCall(isWithHandler) { | ||
@@ -439,3 +461,3 @@ if (isWithHandler) { | ||
if (isEmptyPath(path)) { | ||
return callIfFunction(fn.apply(void 0, [object].concat(extraArgs)), context, parameters); | ||
return callIfFunction(fn.apply(void 0, __spreadArrays([object], extraArgs)), context, parameters); | ||
} | ||
@@ -446,3 +468,3 @@ var value = getValueAtPath(path, object); | ||
} | ||
var result = fn.apply(void 0, [value].concat(extraArgs)); | ||
var result = fn.apply(void 0, __spreadArrays([value], extraArgs)); | ||
return callIfFunction(result, context, parameters); | ||
@@ -465,6 +487,6 @@ }; | ||
if (isEmptyPath(path)) { | ||
return fn.apply(void 0, [object].concat(extraArgs)); | ||
return fn.apply(void 0, __spreadArrays([object], extraArgs)); | ||
} | ||
var value = getValueAtPath(path, object); | ||
return value === void 0 ? value : fn.apply(void 0, [value].concat(extraArgs)); | ||
return value === void 0 ? value : fn.apply(void 0, __spreadArrays([value], extraArgs)); | ||
}; | ||
@@ -484,6 +506,6 @@ } | ||
if (isEmptyPath(path)) { | ||
return fn.apply(void 0, [object].concat(extraArgs)); | ||
return fn.apply(void 0, __spreadArrays([object], extraArgs)); | ||
} | ||
var value = getValueAtPath(path, object); | ||
return value === void 0 ? noMatchValue : fn.apply(void 0, [value].concat(extraArgs)); | ||
return value === void 0 ? noMatchValue : fn.apply(void 0, __spreadArrays([value], extraArgs)); | ||
}; | ||
@@ -503,6 +525,6 @@ } | ||
if (isEmptyPath(path)) { | ||
return !!fn.apply(void 0, [object].concat(extraArgs)); | ||
return !!fn.apply(void 0, __spreadArrays([object], extraArgs)); | ||
} | ||
var value = getValueAtPath(path, object); | ||
return value !== void 0 && !!fn.apply(void 0, [value].concat(extraArgs)); | ||
return value !== void 0 && !!fn.apply(void 0, __spreadArrays([value], extraArgs)); | ||
}; | ||
@@ -522,5 +544,5 @@ } | ||
if (isEmptyPath(path)) { | ||
return isSameValueZero(fn.apply(void 0, [object].concat(extraArgs)), value); | ||
return isSameValueZero(fn.apply(void 0, __spreadArrays([object], extraArgs)), value); | ||
} | ||
return isSameValueZero(fn.apply(void 0, [getValueAtPath(path, object)].concat(extraArgs)), value); | ||
return isSameValueZero(fn.apply(void 0, __spreadArrays([getValueAtPath(path, object)], extraArgs)), value); | ||
}; | ||
@@ -541,6 +563,6 @@ } | ||
if (!isCloneable(object)) { | ||
return fn.apply(void 0, [object].concat(extraArgs)); | ||
return fn.apply(void 0, __spreadArrays([object], extraArgs)); | ||
} | ||
if (isEmptyPath(path)) { | ||
var objectToMerge = fn.apply(void 0, [object].concat(extraArgs)); | ||
var objectToMerge = fn.apply(void 0, __spreadArrays([object], extraArgs)); | ||
return objectToMerge ? getMergedObject(object, objectToMerge, isDeep) : object; | ||
@@ -550,3 +572,3 @@ } | ||
var result = getDeepClone(path, object, function (ref, key) { | ||
var objectToMerge = fn.apply(void 0, [ref[key]].concat(extraArgs)); | ||
var objectToMerge = fn.apply(void 0, __spreadArrays([ref[key]], extraArgs)); | ||
if (objectToMerge) { | ||
@@ -586,6 +608,6 @@ ref[key] = getMergedObject(ref[key], objectToMerge, isDeep); | ||
var emptyObject = getNewEmptyObject(object); | ||
return fn.apply(void 0, [emptyObject].concat(extraArgs)) ? emptyObject : object; | ||
return fn.apply(void 0, __spreadArrays([emptyObject], extraArgs)) ? emptyObject : object; | ||
} | ||
var value = getValueAtPath(path, object); | ||
return value !== void 0 && fn.apply(void 0, [value].concat(extraArgs)) | ||
return value !== void 0 && fn.apply(void 0, __spreadArrays([value], extraArgs)) | ||
? getDeepClone(path, object, function (ref, key) { | ||
@@ -626,4 +648,4 @@ if (isArray$1(ref)) { | ||
return isEmptyPath(path) | ||
? fn.apply(void 0, [object].concat(extraArgs)) : getDeepClone(path, object, function (ref, key) { | ||
ref[key] = fn.apply(void 0, [ref[key]].concat(extraArgs)); | ||
? fn.apply(void 0, __spreadArrays([object], extraArgs)) : getDeepClone(path, object, function (ref, key) { | ||
ref[key] = fn.apply(void 0, __spreadArrays([ref[key]], extraArgs)); | ||
}); | ||
@@ -630,0 +652,0 @@ }; |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('curriable'), require('pathington')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'curriable', 'pathington'], factory) : | ||
(global = global || self, factory(global.unchanged = {}, global.curriable, global.pathington)); | ||
}(this, function (exports, curriable, pathington) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('curriable'), require('pathington')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'curriable', 'pathington'], factory) : | ||
(global = global || self, factory(global.unchanged = {}, global.curriable, global.pathington)); | ||
}(this, (function (exports, curriable, pathington) { 'use strict'; | ||
// external dependencies | ||
var O = Object; | ||
var create = O.create, getOwnPropertySymbols = O.getOwnPropertySymbols, getPrototypeOf = O.getPrototypeOf, keys = O.keys, propertyIsEnumerable = O.propertyIsEnumerable; | ||
var isArray = Array.isArray; | ||
var toStringFunction = Function.prototype.bind.call(Function.prototype.call, Function.prototype.toString); | ||
var toStringObject = Function.prototype.bind.call(Function.prototype.call, O.prototype.toString); | ||
/** | ||
* @constant HAS_SYMBOL_SUPPORT are Symbols supported | ||
*/ | ||
var HAS_SYMBOL_SUPPORT = typeof Symbol === 'function' && typeof Symbol.for === 'function'; | ||
/** | ||
* @constant REACT_ELEMENT the symbol / number specific to react elements | ||
*/ | ||
var REACT_ELEMENT = HAS_SYMBOL_SUPPORT ? Symbol.for('react.element') : 0xeac7; | ||
/** | ||
* @function cloneArray | ||
* | ||
* @description | ||
* clone an array to a new array | ||
* | ||
* @param array the array to clone | ||
* @returns the cloned array | ||
*/ | ||
var cloneArray = function (array) { | ||
var Constructor = array.constructor; | ||
var cloned = Constructor === Array ? [] : new Constructor(); | ||
for (var index = 0, length_1 = array.length; index < length_1; index++) { | ||
cloned[index] = array[index]; | ||
} | ||
return cloned; | ||
}; | ||
/** | ||
* @function reduce | ||
* | ||
* @description | ||
* a targeted reduce method faster than the native | ||
* | ||
* @param array the array to reduce | ||
* @param fn the method to reduce each array value with | ||
* @param initialValue the initial value of the reduction | ||
* @returns the reduced value | ||
*/ | ||
var reduce = function (array, fn, initialValue) { | ||
var value = initialValue; | ||
for (var index = 0, length_2 = array.length; index < length_2; index++) { | ||
value = fn(value, array[index]); | ||
} | ||
return value; | ||
}; | ||
/** | ||
* @function getOwnProperties | ||
* | ||
* @description | ||
* get the all properties (keys and symbols) of the object passed | ||
* | ||
* @param object the object to get the properties of | ||
* @returns the keys and symbols the object has | ||
*/ | ||
var getOwnProperties = function (object) { | ||
if (!HAS_SYMBOL_SUPPORT) { | ||
return keys(object); | ||
} | ||
var ownSymbols = getOwnPropertySymbols(object); | ||
if (!ownSymbols.length) { | ||
return keys(object); | ||
} | ||
return keys(object).concat(reduce(ownSymbols, function (enumerableSymbols, symbol) { | ||
if (propertyIsEnumerable.call(object, symbol)) { | ||
enumerableSymbols.push(symbol); | ||
} | ||
return enumerableSymbols; | ||
}, [])); | ||
}; | ||
/** | ||
* @function assignFallback | ||
* | ||
* @description | ||
* a targeted fallback if native Object.assign is unavailable | ||
* | ||
* @param target the object to shallowly merge into | ||
* @param source the object to shallowly merge into target | ||
* @returns the shallowly merged object | ||
*/ | ||
var assignFallback = function (target, source) { | ||
if (!source) { | ||
return target; | ||
} | ||
return reduce(getOwnProperties(source), function (clonedObject, property) { | ||
clonedObject[property] = source[property]; | ||
return clonedObject; | ||
}, Object(target)); | ||
}; | ||
var assign = typeof O.assign === 'function' ? O.assign : assignFallback; | ||
/** | ||
* @function createWithProto | ||
* | ||
* @description | ||
* create a new object with the prototype of the object passed | ||
* | ||
* @param object object whose prototype will be the new object's prototype | ||
* @returns object with the prototype of the one passed | ||
*/ | ||
var createWithProto = function (object) { | ||
return create(object.__proto__ || getPrototypeOf(object)); | ||
}; | ||
/** | ||
* @function isCloneable | ||
* | ||
* @description | ||
* is the object passed considered cloneable | ||
* | ||
* @param object the object that is being checked for cloneability | ||
* @returns whether the object can be cloned | ||
*/ | ||
var isCloneable = function (object) { | ||
if (!object || typeof object !== 'object' || object.$$typeof === REACT_ELEMENT) { | ||
return false; | ||
} | ||
var type = toStringObject(object); | ||
return type !== '[object Date]' && type !== '[object RegExp]'; | ||
}; | ||
/** | ||
* @function isEmptyPath | ||
* | ||
* @description | ||
* is the path passed an empty path | ||
* | ||
* @param path the path to check for emptiness | ||
* @returns whether the path passed is considered empty | ||
*/ | ||
var isEmptyPath = function (path) { return path == null || (isArray(path) && !path.length); }; | ||
/** | ||
* @function isGlobalConstructor | ||
* | ||
* @description | ||
* is the fn passed a global constructor | ||
* | ||
* @param fn the fn to check if a global constructor | ||
* @returns whether the fn passed is a global constructor | ||
*/ | ||
var isGlobalConstructor = function (fn) { | ||
return typeof fn === 'function' && !!~toStringFunction(fn).indexOf('[native code]'); | ||
}; | ||
/** | ||
* @function callIfFunction | ||
* | ||
* @description | ||
* if the object passed is a function, call it and return its return, else return undefined | ||
* | ||
* @param object the object to call if a function | ||
* @param context the context to call the function with | ||
* @param parameters the parameters to call the function with | ||
* @returns the result of the function call, or undefined | ||
*/ | ||
var callIfFunction = function (object, context, parameters) { | ||
return typeof object === 'function' ? object.apply(context, parameters) : void 0; | ||
}; | ||
/** | ||
* @function getNewEmptyChild | ||
* | ||
* @description | ||
* get a new empty child object based on the key passed | ||
* | ||
* @param key the key to base the empty child on | ||
* @returns the empty object the child is built from | ||
*/ | ||
var getNewEmptyChild = function (key) { | ||
return typeof key === 'number' ? [] : {}; | ||
}; | ||
/** | ||
* @function getNewEmptyObject | ||
* | ||
* @description | ||
* get a new empty object based on the object passed | ||
* | ||
* @param object the object to base the empty object on | ||
* @returns an empty version of the object passed | ||
*/ | ||
var getNewEmptyObject = function (object) { | ||
return isArray(object) ? [] : {}; | ||
}; | ||
/** | ||
* @function getShallowClone | ||
* | ||
* @description | ||
* create a shallow clone of the object passed, respecting its prototype | ||
* | ||
* @param object the object to clone | ||
* @returns a shallow clone of the object passed | ||
*/ | ||
var getShallowClone = function (object) { | ||
if (object.constructor === O) { | ||
return assign({}, object); | ||
} | ||
if (isArray(object)) { | ||
return cloneArray(object); | ||
} | ||
return isGlobalConstructor(object.constructor) ? {} : assign(createWithProto(object), object); | ||
}; | ||
/** | ||
* @function isSameValueZero | ||
* | ||
* @description | ||
* are the values equal based on SameValueZero | ||
* | ||
* @param value1 the first value to test | ||
* @param value2 the second value to test | ||
* @returns are the two values passed equal based on SameValueZero | ||
*/ | ||
var isSameValueZero = function (value1, value2) { | ||
return value1 === value2 || (value1 !== value1 && value2 !== value2); | ||
}; | ||
/** | ||
* @function cloneIfPossible | ||
* | ||
* @description | ||
* clone the object if it can be cloned, otherwise return the object itself | ||
* | ||
* @param object the object to clone | ||
* @returns a cloned version of the object, or the object itself if not cloneable | ||
*/ | ||
var cloneIfPossible = function (object) { | ||
return isCloneable(object) ? getShallowClone(object) : object; | ||
}; | ||
/** | ||
* @function getCloneOrEmptyObject | ||
* | ||
* @description | ||
* if the object is cloneable, get a clone of the object, else get a new | ||
* empty child object based on the key | ||
* | ||
* @param object the object to clone | ||
* @param nextKey the key to base the empty child object on | ||
* @returns a clone of the object, or an empty child object | ||
*/ | ||
var getCloneOrEmptyObject = function (object, nextKey) { | ||
return isCloneable(object) ? getShallowClone(object) : getNewEmptyChild(nextKey); | ||
}; | ||
/** | ||
* @function getCoalescedValue | ||
* | ||
* @description | ||
* return the value if not undefined, otherwise return the fallback value | ||
* | ||
* @param value the value to coalesce if undefined | ||
* @param fallbackValue the value to coalesce to | ||
* @returns the coalesced value | ||
*/ | ||
var getCoalescedValue = function (value, fallbackValue) { | ||
return value === void 0 ? fallbackValue : value; | ||
}; | ||
/** | ||
* @function getParsedPath | ||
* | ||
* @description | ||
* parse the path passed into an array path | ||
* | ||
* @param path the path to parse | ||
* @returns the parsed path | ||
*/ | ||
var getParsedPath = function (path) { | ||
return isArray(path) ? path : pathington.parse(path); | ||
}; | ||
/** | ||
* @function getCloneAtPath | ||
* | ||
* @description | ||
* get a new object, cloned at the path specified while leveraging | ||
* structural sharing for the rest of the properties | ||
* | ||
* @param path the path to clone at | ||
* @param object the object with cloned children at path | ||
* @param onMatch the method to call once the end of the path is reached | ||
* @param index the path index | ||
* @returns the object deeply cloned at the path specified | ||
*/ | ||
var getCloneAtPath = function (path, object, onMatch, index) { | ||
var key = path[index]; | ||
var nextIndex = index + 1; | ||
if (nextIndex === path.length) { | ||
onMatch(object, key); | ||
} | ||
else { | ||
object[key] = getCloneAtPath(path, getCloneOrEmptyObject(object[key], path[nextIndex]), onMatch, nextIndex); | ||
} | ||
return object; | ||
}; | ||
/** | ||
* @function getDeepClone | ||
* | ||
* @description | ||
* get a clone of the object at the path specified | ||
* | ||
* @param path the path to clone at | ||
* @param object the object to clone at the path | ||
* @param onMatch once a patch match is found, the callback to fire | ||
* @returns the clone of the object at path specified | ||
*/ | ||
var getDeepClone = function (path, object, onMatch) { | ||
var parsedPath = getParsedPath(path); | ||
var topLevelClone = getCloneOrEmptyObject(object, parsedPath[0]); | ||
if (parsedPath.length === 1) { | ||
onMatch(topLevelClone, parsedPath[0]); | ||
return topLevelClone; | ||
} | ||
return getCloneAtPath(parsedPath, topLevelClone, onMatch, 0); | ||
}; | ||
/** | ||
* @function getMergedObject | ||
* | ||
* @description | ||
* merge the source into the target, either deeply or shallowly | ||
* | ||
* @param target the object to merge into | ||
* @param source the object being merged into the target | ||
* @param isDeep is the merge a deep merge | ||
* @returns the merged object | ||
*/ | ||
var getMergedObject = function (target, source, isDeep) { | ||
var isObject1Array = isArray(target); | ||
if (isObject1Array !== isArray(source) || !isCloneable(target)) { | ||
return cloneIfPossible(source); | ||
} | ||
if (isObject1Array) { | ||
return target.concat(source); | ||
} | ||
var targetClone = target.constructor === O || isGlobalConstructor(target.constructor) | ||
? {} | ||
: createWithProto(target); | ||
return reduce(getOwnProperties(source), function (clone, key) { | ||
clone[key] = | ||
isDeep && isCloneable(source[key]) | ||
? getMergedObject(target[key], source[key], isDeep) | ||
: source[key]; | ||
return clone; | ||
}, assign(targetClone, target)); | ||
}; | ||
/** | ||
* @function getValueAtPath | ||
* | ||
* @description | ||
* get the value at the nested property, or the fallback provided | ||
* | ||
* @param path the path to get the value from | ||
* @param object the object to get the value from at path | ||
* @param noMatchValue the value returned if no match is found | ||
* @returns the matching value, or the fallback provided | ||
*/ | ||
var getValueAtPath = function (path, object, noMatchValue) { | ||
var parsedPath = getParsedPath(path); | ||
if (parsedPath.length === 1) { | ||
return object ? getCoalescedValue(object[parsedPath[0]], noMatchValue) : noMatchValue; | ||
} | ||
var ref = object; | ||
var key = parsedPath[0]; | ||
for (var index = 0; index < parsedPath.length - 1; index++) { | ||
if (!ref || !ref[key]) { | ||
return noMatchValue; | ||
} | ||
ref = ref[key]; | ||
key = parsedPath[index + 1]; | ||
} | ||
return ref ? getCoalescedValue(ref[key], noMatchValue) : noMatchValue; | ||
}; | ||
/** | ||
* @function getFullPath | ||
* | ||
* @description | ||
* get the path to add to, based on the object and fn passed | ||
* | ||
* @param path the path to add to | ||
* @param object the object traversed by the path | ||
* @param fn the function to transform the retrieved value with | ||
* @returns the full path to add to | ||
*/ | ||
var getFullPath = function (path, object, fn) { | ||
var isPathEmpty = isEmptyPath(path); | ||
var valueAtPath = isPathEmpty | ||
? object | ||
: fn | ||
? fn(getValueAtPath(path, object)) | ||
: getValueAtPath(path, object); | ||
return isArray(valueAtPath) | ||
? isArray(path) | ||
? path.concat([valueAtPath.length]) | ||
: (isPathEmpty ? '' : path) + "[" + valueAtPath.length + "]" | ||
: path; | ||
}; | ||
/** | ||
* @function splice | ||
* | ||
* @description | ||
* a faster, more targeted version of the native splice | ||
* | ||
* @param array the array to remove the value from | ||
* @param splicedIndex the index of the value to remove | ||
*/ | ||
var splice = function (array, splicedIndex) { | ||
if (array.length) { | ||
var cutoff = array.length - 1; | ||
var index = splicedIndex; | ||
while (index < cutoff) { | ||
array[index] = array[index + 1]; | ||
++index; | ||
} | ||
array.length = cutoff; | ||
} | ||
}; | ||
/** | ||
* @function throwInvalidFnError | ||
* | ||
* @description | ||
* throw the TypeError based on the invalid handler | ||
* | ||
* @throws | ||
*/ | ||
var throwInvalidFnError = function () { | ||
throw new TypeError('handler passed is not of type "function".'); | ||
}; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
// utils | ||
var isArray$1 = Array.isArray; | ||
var slice = Function.prototype.bind.call(Function.prototype.bind, Array.prototype.slice); | ||
function createCall(isWithHandler) { | ||
if (isWithHandler) { | ||
return function callWith(fn, path, parameters, object, context) { | ||
if (context === void 0) { context = object; } | ||
if (typeof fn !== 'function') { | ||
throwInvalidFnError(); | ||
} | ||
var extraArgs = slice(arguments, 5); | ||
if (isEmptyPath(path)) { | ||
return callIfFunction(fn.apply(void 0, [object].concat(extraArgs)), context, parameters); | ||
} | ||
var value = getValueAtPath(path, object); | ||
if (value === void 0) { | ||
return; | ||
} | ||
var result = fn.apply(void 0, [value].concat(extraArgs)); | ||
return callIfFunction(result, context, parameters); | ||
}; | ||
} | ||
return function call(path, parameters, object, context) { | ||
if (context === void 0) { context = object; } | ||
var callable = isEmptyPath(path) ? object : getValueAtPath(path, object); | ||
return callIfFunction(callable, context, parameters); | ||
}; | ||
} | ||
function createGet(isWithHandler) { | ||
if (isWithHandler) { | ||
return function getWith(fn, path, object) { | ||
if (typeof fn !== 'function') { | ||
throwInvalidFnError(); | ||
} | ||
var extraArgs = slice(arguments, 4); | ||
if (isEmptyPath(path)) { | ||
return fn.apply(void 0, [object].concat(extraArgs)); | ||
} | ||
var value = getValueAtPath(path, object); | ||
return value === void 0 ? value : fn.apply(void 0, [value].concat(extraArgs)); | ||
}; | ||
} | ||
return function get(path, object) { | ||
return isEmptyPath(path) ? object : getValueAtPath(path, object); | ||
}; | ||
} | ||
function createGetOr(isWithHandler) { | ||
if (isWithHandler) { | ||
return function getWithOr(fn, noMatchValue, path, object) { | ||
if (typeof fn !== 'function') { | ||
throwInvalidFnError(); | ||
} | ||
var extraArgs = slice(arguments, 4); | ||
if (isEmptyPath(path)) { | ||
return fn.apply(void 0, [object].concat(extraArgs)); | ||
} | ||
var value = getValueAtPath(path, object); | ||
return value === void 0 ? noMatchValue : fn.apply(void 0, [value].concat(extraArgs)); | ||
}; | ||
} | ||
return function getOr(noMatchValue, path, object) { | ||
return isEmptyPath(path) ? object : getValueAtPath(path, object, noMatchValue); | ||
}; | ||
} | ||
function createHas(isWithHandler) { | ||
if (isWithHandler) { | ||
return function hasWith(fn, path, object) { | ||
if (typeof fn !== 'function') { | ||
throwInvalidFnError(); | ||
} | ||
var extraArgs = slice(arguments, 3); | ||
if (isEmptyPath(path)) { | ||
return !!fn.apply(void 0, [object].concat(extraArgs)); | ||
} | ||
var value = getValueAtPath(path, object); | ||
return value !== void 0 && !!fn.apply(void 0, [value].concat(extraArgs)); | ||
}; | ||
} | ||
return function has(path, object) { | ||
return isEmptyPath(path) ? object != null : getValueAtPath(path, object) !== void 0; | ||
}; | ||
} | ||
function createIs(isWithHandler) { | ||
if (isWithHandler) { | ||
return function isWith(fn, path, value, object) { | ||
if (typeof fn !== 'function') { | ||
throwInvalidFnError(); | ||
} | ||
var extraArgs = slice(arguments, 4); | ||
if (isEmptyPath(path)) { | ||
return isSameValueZero(fn.apply(void 0, [object].concat(extraArgs)), value); | ||
} | ||
return isSameValueZero(fn.apply(void 0, [getValueAtPath(path, object)].concat(extraArgs)), value); | ||
}; | ||
} | ||
return function is(path, value, object) { | ||
var _path = isEmptyPath(path) ? object : getValueAtPath(path, object); | ||
return isSameValueZero(_path, value); | ||
}; | ||
} | ||
function createMerge(isWithHandler, isDeep) { | ||
if (isWithHandler) { | ||
return function mergeWith(fn, path, object) { | ||
if (typeof fn !== 'function') { | ||
throwInvalidFnError(); | ||
} | ||
var extraArgs = slice(arguments, 3); | ||
if (!isCloneable(object)) { | ||
return fn.apply(void 0, [object].concat(extraArgs)); | ||
} | ||
if (isEmptyPath(path)) { | ||
var objectToMerge = fn.apply(void 0, [object].concat(extraArgs)); | ||
return objectToMerge ? getMergedObject(object, objectToMerge, isDeep) : object; | ||
} | ||
var hasChanged = false; | ||
var result = getDeepClone(path, object, function (ref, key) { | ||
var objectToMerge = fn.apply(void 0, [ref[key]].concat(extraArgs)); | ||
if (objectToMerge) { | ||
ref[key] = getMergedObject(ref[key], objectToMerge, isDeep); | ||
hasChanged = true; | ||
} | ||
}); | ||
return hasChanged ? result : object; | ||
}; | ||
} | ||
return function merge(path, objectToMerge, object) { | ||
if (!isCloneable(object)) { | ||
return objectToMerge; | ||
} | ||
return isEmptyPath(path) | ||
? getMergedObject(object, objectToMerge, true) | ||
: getDeepClone(path, object, function (ref, key) { | ||
ref[key] = getMergedObject(ref[key], objectToMerge, isDeep); | ||
}); | ||
}; | ||
} | ||
function createNot(isWithHandler) { | ||
var is = createIs(isWithHandler); | ||
return function not() { | ||
return !is.apply(this, arguments); | ||
}; | ||
} | ||
function createRemove(isWithHandler) { | ||
if (isWithHandler) { | ||
return function removeWith(fn, path, object) { | ||
if (typeof fn !== 'function') { | ||
throwInvalidFnError(); | ||
} | ||
var extraArgs = slice(arguments, 3); | ||
if (isEmptyPath(path)) { | ||
var emptyObject = getNewEmptyObject(object); | ||
return fn.apply(void 0, [emptyObject].concat(extraArgs)) ? emptyObject : object; | ||
} | ||
var value = getValueAtPath(path, object); | ||
return value !== void 0 && fn.apply(void 0, [value].concat(extraArgs)) | ||
? getDeepClone(path, object, function (ref, key) { | ||
if (isArray$1(ref)) { | ||
splice(ref, key); | ||
} | ||
else { | ||
delete ref[key]; | ||
} | ||
}) | ||
: object; | ||
}; | ||
} | ||
return function remove(path, object) { | ||
if (isEmptyPath(path)) { | ||
return getNewEmptyObject(object); | ||
} | ||
return getValueAtPath(path, object) !== void 0 | ||
? getDeepClone(path, object, function (ref, key) { | ||
if (isArray$1(ref)) { | ||
splice(ref, key); | ||
} | ||
else { | ||
delete ref[key]; | ||
} | ||
}) | ||
: object; | ||
}; | ||
} | ||
function createSet(isWithHandler) { | ||
if (isWithHandler) { | ||
return function setWith(fn, path, object) { | ||
if (typeof fn !== 'function') { | ||
throwInvalidFnError(); | ||
} | ||
var extraArgs = slice(arguments, 3); | ||
return isEmptyPath(path) | ||
? fn.apply(void 0, [object].concat(extraArgs)) : getDeepClone(path, object, function (ref, key) { | ||
ref[key] = fn.apply(void 0, [ref[key]].concat(extraArgs)); | ||
}); | ||
}; | ||
} | ||
return function set(path, value, object) { | ||
return isEmptyPath(path) | ||
? value | ||
: getDeepClone(path, object, function (ref, key) { | ||
ref[key] = value; | ||
}); | ||
}; | ||
} | ||
function createAdd(isWithHandler) { | ||
var _add = createSet(isWithHandler); | ||
if (isWithHandler) { | ||
return function addWith(fn, path, object) { | ||
return _add.apply(this, [fn, getFullPath(path, object, fn), object].concat(slice(arguments, 3))); | ||
}; | ||
} | ||
return function add(path, value, object) { | ||
return _add(getFullPath(path, object), value, object); | ||
}; | ||
} | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
// external dependencies | ||
var add = curriable.curry(createAdd(false)); | ||
var addWith = curriable.curry(createAdd(true)); | ||
var assign$1 = curriable.curry(createMerge(false, false)); | ||
var assignWith = curriable.curry(createMerge(true, false)); | ||
var call = curriable.curry(createCall(false), 3); | ||
var callWith = curriable.curry(createCall(true), 4); | ||
var get = curriable.curry(createGet(false)); | ||
var getOr = curriable.curry(createGetOr(false)); | ||
var getWith = curriable.curry(createGet(true)); | ||
var getWithOr = curriable.curry(createGetOr(true)); | ||
var has = curriable.curry(createHas(false)); | ||
var hasWith = curriable.curry(createHas(true)); | ||
var is = curriable.curry(createIs(false)); | ||
var isWith = curriable.curry(createIs(true)); | ||
var merge = curriable.curry(createMerge(false, true)); | ||
var mergeWith = curriable.curry(createMerge(true, true)); | ||
var not = curriable.curry(createNot(false)); | ||
var notWith = curriable.curry(createNot(true)); | ||
var remove = curriable.curry(createRemove(false)); | ||
var removeWith = curriable.curry(createRemove(true)); | ||
var set = curriable.curry(createSet(false)); | ||
var setWith = curriable.curry(createSet(true)); | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
***************************************************************************** */ | ||
Object.defineProperty(exports, '__', { | ||
enumerable: true, | ||
get: function () { | ||
return curriable.__; | ||
function __spreadArrays() { | ||
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; | ||
for (var r = Array(s), k = 0, i = 0; i < il; i++) | ||
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) | ||
r[k] = a[j]; | ||
return r; | ||
} | ||
}); | ||
exports.add = add; | ||
exports.addWith = addWith; | ||
exports.assign = assign$1; | ||
exports.assignWith = assignWith; | ||
exports.call = call; | ||
exports.callWith = callWith; | ||
exports.get = get; | ||
exports.getOr = getOr; | ||
exports.getWith = getWith; | ||
exports.getWithOr = getWithOr; | ||
exports.has = has; | ||
exports.hasWith = hasWith; | ||
exports.is = is; | ||
exports.isWith = isWith; | ||
exports.merge = merge; | ||
exports.mergeWith = mergeWith; | ||
exports.not = not; | ||
exports.notWith = notWith; | ||
exports.remove = remove; | ||
exports.removeWith = removeWith; | ||
exports.set = set; | ||
exports.setWith = setWith; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
// external dependencies | ||
var O = Object; | ||
var create = O.create, getOwnPropertySymbols = O.getOwnPropertySymbols, getPrototypeOf = O.getPrototypeOf, keys = O.keys, propertyIsEnumerable = O.propertyIsEnumerable; | ||
var isArray = Array.isArray; | ||
var toStringFunction = Function.prototype.bind.call(Function.prototype.call, Function.prototype.toString); | ||
var toStringObject = Function.prototype.bind.call(Function.prototype.call, O.prototype.toString); | ||
/** | ||
* @constant HAS_SYMBOL_SUPPORT are Symbols supported | ||
*/ | ||
var HAS_SYMBOL_SUPPORT = typeof Symbol === 'function' && typeof Symbol.for === 'function'; | ||
/** | ||
* @constant REACT_ELEMENT the symbol / number specific to react elements | ||
*/ | ||
var REACT_ELEMENT = HAS_SYMBOL_SUPPORT ? Symbol.for('react.element') : 0xeac7; | ||
/** | ||
* @function cloneArray | ||
* | ||
* @description | ||
* clone an array to a new array | ||
* | ||
* @param array the array to clone | ||
* @returns the cloned array | ||
*/ | ||
var cloneArray = function (array) { | ||
var Constructor = array.constructor; | ||
var cloned = Constructor === Array ? [] : new Constructor(); | ||
for (var index = 0, length_1 = array.length; index < length_1; index++) { | ||
cloned[index] = array[index]; | ||
} | ||
return cloned; | ||
}; | ||
/** | ||
* @function reduce | ||
* | ||
* @description | ||
* a targeted reduce method faster than the native | ||
* | ||
* @param array the array to reduce | ||
* @param fn the method to reduce each array value with | ||
* @param initialValue the initial value of the reduction | ||
* @returns the reduced value | ||
*/ | ||
var reduce = function (array, fn, initialValue) { | ||
var value = initialValue; | ||
for (var index = 0, length_2 = array.length; index < length_2; index++) { | ||
value = fn(value, array[index]); | ||
} | ||
return value; | ||
}; | ||
/** | ||
* @function getOwnProperties | ||
* | ||
* @description | ||
* get the all properties (keys and symbols) of the object passed | ||
* | ||
* @param object the object to get the properties of | ||
* @returns the keys and symbols the object has | ||
*/ | ||
var getOwnProperties = function (object) { | ||
if (!HAS_SYMBOL_SUPPORT) { | ||
return keys(object); | ||
} | ||
var ownSymbols = getOwnPropertySymbols(object); | ||
if (!ownSymbols.length) { | ||
return keys(object); | ||
} | ||
return keys(object).concat(reduce(ownSymbols, function (enumerableSymbols, symbol) { | ||
if (propertyIsEnumerable.call(object, symbol)) { | ||
enumerableSymbols.push(symbol); | ||
} | ||
return enumerableSymbols; | ||
}, [])); | ||
}; | ||
/** | ||
* @function assignFallback | ||
* | ||
* @description | ||
* a targeted fallback if native Object.assign is unavailable | ||
* | ||
* @param target the object to shallowly merge into | ||
* @param source the object to shallowly merge into target | ||
* @returns the shallowly merged object | ||
*/ | ||
var assignFallback = function (target, source) { | ||
if (!source) { | ||
return target; | ||
} | ||
return reduce(getOwnProperties(source), function (clonedObject, property) { | ||
clonedObject[property] = source[property]; | ||
return clonedObject; | ||
}, Object(target)); | ||
}; | ||
var assign = typeof O.assign === 'function' ? O.assign : assignFallback; | ||
/** | ||
* @function createWithProto | ||
* | ||
* @description | ||
* create a new object with the prototype of the object passed | ||
* | ||
* @param object object whose prototype will be the new object's prototype | ||
* @returns object with the prototype of the one passed | ||
*/ | ||
var createWithProto = function (object) { | ||
return create(object.__proto__ || getPrototypeOf(object)); | ||
}; | ||
/** | ||
* @function isCloneable | ||
* | ||
* @description | ||
* is the object passed considered cloneable | ||
* | ||
* @param object the object that is being checked for cloneability | ||
* @returns whether the object can be cloned | ||
*/ | ||
var isCloneable = function (object) { | ||
if (!object || typeof object !== 'object' || object.$$typeof === REACT_ELEMENT) { | ||
return false; | ||
} | ||
var type = toStringObject(object); | ||
return type !== '[object Date]' && type !== '[object RegExp]'; | ||
}; | ||
/** | ||
* @function isEmptyPath | ||
* | ||
* @description | ||
* is the path passed an empty path | ||
* | ||
* @param path the path to check for emptiness | ||
* @returns whether the path passed is considered empty | ||
*/ | ||
var isEmptyPath = function (path) { return path == null || (isArray(path) && !path.length); }; | ||
/** | ||
* @function isGlobalConstructor | ||
* | ||
* @description | ||
* is the fn passed a global constructor | ||
* | ||
* @param fn the fn to check if a global constructor | ||
* @returns whether the fn passed is a global constructor | ||
*/ | ||
var isGlobalConstructor = function (fn) { | ||
return typeof fn === 'function' && !!~toStringFunction(fn).indexOf('[native code]'); | ||
}; | ||
/** | ||
* @function callIfFunction | ||
* | ||
* @description | ||
* if the object passed is a function, call it and return its return, else return undefined | ||
* | ||
* @param object the object to call if a function | ||
* @param context the context to call the function with | ||
* @param parameters the parameters to call the function with | ||
* @returns the result of the function call, or undefined | ||
*/ | ||
var callIfFunction = function (object, context, parameters) { | ||
return typeof object === 'function' ? object.apply(context, parameters) : void 0; | ||
}; | ||
/** | ||
* @function getNewEmptyChild | ||
* | ||
* @description | ||
* get a new empty child object based on the key passed | ||
* | ||
* @param key the key to base the empty child on | ||
* @returns the empty object the child is built from | ||
*/ | ||
var getNewEmptyChild = function (key) { | ||
return typeof key === 'number' ? [] : {}; | ||
}; | ||
/** | ||
* @function getNewEmptyObject | ||
* | ||
* @description | ||
* get a new empty object based on the object passed | ||
* | ||
* @param object the object to base the empty object on | ||
* @returns an empty version of the object passed | ||
*/ | ||
var getNewEmptyObject = function (object) { | ||
return isArray(object) ? [] : {}; | ||
}; | ||
/** | ||
* @function getShallowClone | ||
* | ||
* @description | ||
* create a shallow clone of the object passed, respecting its prototype | ||
* | ||
* @param object the object to clone | ||
* @returns a shallow clone of the object passed | ||
*/ | ||
var getShallowClone = function (object) { | ||
if (object.constructor === O) { | ||
return assign({}, object); | ||
} | ||
if (isArray(object)) { | ||
return cloneArray(object); | ||
} | ||
return isGlobalConstructor(object.constructor) ? {} : assign(createWithProto(object), object); | ||
}; | ||
/** | ||
* @function isSameValueZero | ||
* | ||
* @description | ||
* are the values equal based on SameValueZero | ||
* | ||
* @param value1 the first value to test | ||
* @param value2 the second value to test | ||
* @returns are the two values passed equal based on SameValueZero | ||
*/ | ||
var isSameValueZero = function (value1, value2) { | ||
return value1 === value2 || (value1 !== value1 && value2 !== value2); | ||
}; | ||
/** | ||
* @function cloneIfPossible | ||
* | ||
* @description | ||
* clone the object if it can be cloned, otherwise return the object itself | ||
* | ||
* @param object the object to clone | ||
* @returns a cloned version of the object, or the object itself if not cloneable | ||
*/ | ||
var cloneIfPossible = function (object) { | ||
return isCloneable(object) ? getShallowClone(object) : object; | ||
}; | ||
/** | ||
* @function getCloneOrEmptyObject | ||
* | ||
* @description | ||
* if the object is cloneable, get a clone of the object, else get a new | ||
* empty child object based on the key | ||
* | ||
* @param object the object to clone | ||
* @param nextKey the key to base the empty child object on | ||
* @returns a clone of the object, or an empty child object | ||
*/ | ||
var getCloneOrEmptyObject = function (object, nextKey) { | ||
return isCloneable(object) ? getShallowClone(object) : getNewEmptyChild(nextKey); | ||
}; | ||
/** | ||
* @function getCoalescedValue | ||
* | ||
* @description | ||
* return the value if not undefined, otherwise return the fallback value | ||
* | ||
* @param value the value to coalesce if undefined | ||
* @param fallbackValue the value to coalesce to | ||
* @returns the coalesced value | ||
*/ | ||
var getCoalescedValue = function (value, fallbackValue) { | ||
return value === void 0 ? fallbackValue : value; | ||
}; | ||
/** | ||
* @function getParsedPath | ||
* | ||
* @description | ||
* parse the path passed into an array path | ||
* | ||
* @param path the path to parse | ||
* @returns the parsed path | ||
*/ | ||
var getParsedPath = function (path) { | ||
return isArray(path) ? path : pathington.parse(path); | ||
}; | ||
/** | ||
* @function getCloneAtPath | ||
* | ||
* @description | ||
* get a new object, cloned at the path specified while leveraging | ||
* structural sharing for the rest of the properties | ||
* | ||
* @param path the path to clone at | ||
* @param object the object with cloned children at path | ||
* @param onMatch the method to call once the end of the path is reached | ||
* @param index the path index | ||
* @returns the object deeply cloned at the path specified | ||
*/ | ||
var getCloneAtPath = function (path, object, onMatch, index) { | ||
var key = path[index]; | ||
var nextIndex = index + 1; | ||
if (nextIndex === path.length) { | ||
onMatch(object, key); | ||
} | ||
else { | ||
object[key] = getCloneAtPath(path, getCloneOrEmptyObject(object[key], path[nextIndex]), onMatch, nextIndex); | ||
} | ||
return object; | ||
}; | ||
/** | ||
* @function getDeepClone | ||
* | ||
* @description | ||
* get a clone of the object at the path specified | ||
* | ||
* @param path the path to clone at | ||
* @param object the object to clone at the path | ||
* @param onMatch once a patch match is found, the callback to fire | ||
* @returns the clone of the object at path specified | ||
*/ | ||
var getDeepClone = function (path, object, onMatch) { | ||
var parsedPath = getParsedPath(path); | ||
var topLevelClone = getCloneOrEmptyObject(object, parsedPath[0]); | ||
if (parsedPath.length === 1) { | ||
onMatch(topLevelClone, parsedPath[0]); | ||
return topLevelClone; | ||
} | ||
return getCloneAtPath(parsedPath, topLevelClone, onMatch, 0); | ||
}; | ||
/** | ||
* @function getMergedObject | ||
* | ||
* @description | ||
* merge the source into the target, either deeply or shallowly | ||
* | ||
* @param target the object to merge into | ||
* @param source the object being merged into the target | ||
* @param isDeep is the merge a deep merge | ||
* @returns the merged object | ||
*/ | ||
var getMergedObject = function (target, source, isDeep) { | ||
var isObject1Array = isArray(target); | ||
if (isObject1Array !== isArray(source) || !isCloneable(target)) { | ||
return cloneIfPossible(source); | ||
} | ||
if (isObject1Array) { | ||
return target.concat(source); | ||
} | ||
var targetClone = target.constructor === O || isGlobalConstructor(target.constructor) | ||
? {} | ||
: createWithProto(target); | ||
return reduce(getOwnProperties(source), function (clone, key) { | ||
clone[key] = | ||
isDeep && isCloneable(source[key]) | ||
? getMergedObject(target[key], source[key], isDeep) | ||
: source[key]; | ||
return clone; | ||
}, assign(targetClone, target)); | ||
}; | ||
/** | ||
* @function getValueAtPath | ||
* | ||
* @description | ||
* get the value at the nested property, or the fallback provided | ||
* | ||
* @param path the path to get the value from | ||
* @param object the object to get the value from at path | ||
* @param noMatchValue the value returned if no match is found | ||
* @returns the matching value, or the fallback provided | ||
*/ | ||
var getValueAtPath = function (path, object, noMatchValue) { | ||
var parsedPath = getParsedPath(path); | ||
if (parsedPath.length === 1) { | ||
return object ? getCoalescedValue(object[parsedPath[0]], noMatchValue) : noMatchValue; | ||
} | ||
var ref = object; | ||
var key = parsedPath[0]; | ||
for (var index = 0; index < parsedPath.length - 1; index++) { | ||
if (!ref || !ref[key]) { | ||
return noMatchValue; | ||
} | ||
ref = ref[key]; | ||
key = parsedPath[index + 1]; | ||
} | ||
return ref ? getCoalescedValue(ref[key], noMatchValue) : noMatchValue; | ||
}; | ||
/** | ||
* @function getFullPath | ||
* | ||
* @description | ||
* get the path to add to, based on the object and fn passed | ||
* | ||
* @param path the path to add to | ||
* @param object the object traversed by the path | ||
* @param fn the function to transform the retrieved value with | ||
* @returns the full path to add to | ||
*/ | ||
var getFullPath = function (path, object, fn) { | ||
var isPathEmpty = isEmptyPath(path); | ||
var valueAtPath = isPathEmpty | ||
? object | ||
: fn | ||
? fn(getValueAtPath(path, object)) | ||
: getValueAtPath(path, object); | ||
return isArray(valueAtPath) | ||
? isArray(path) | ||
? path.concat([valueAtPath.length]) | ||
: (isPathEmpty ? '' : path) + "[" + valueAtPath.length + "]" | ||
: path; | ||
}; | ||
/** | ||
* @function splice | ||
* | ||
* @description | ||
* a faster, more targeted version of the native splice | ||
* | ||
* @param array the array to remove the value from | ||
* @param splicedIndex the index of the value to remove | ||
*/ | ||
var splice = function (array, splicedIndex) { | ||
if (array.length) { | ||
var cutoff = array.length - 1; | ||
var index = splicedIndex; | ||
while (index < cutoff) { | ||
array[index] = array[index + 1]; | ||
++index; | ||
} | ||
array.length = cutoff; | ||
} | ||
}; | ||
/** | ||
* @function throwInvalidFnError | ||
* | ||
* @description | ||
* throw the TypeError based on the invalid handler | ||
* | ||
* @throws | ||
*/ | ||
var throwInvalidFnError = function () { | ||
throw new TypeError('handler passed is not of type "function".'); | ||
}; | ||
})); | ||
var isArray$1 = Array.isArray; | ||
var slice = Function.prototype.bind.call(Function.prototype.call, Array.prototype.slice); | ||
function createCall(isWithHandler) { | ||
if (isWithHandler) { | ||
return function callWith(fn, path, parameters, object, context) { | ||
if (context === void 0) { context = object; } | ||
if (typeof fn !== 'function') { | ||
throwInvalidFnError(); | ||
} | ||
var extraArgs = slice(arguments, 5); | ||
if (isEmptyPath(path)) { | ||
return callIfFunction(fn.apply(void 0, __spreadArrays([object], extraArgs)), context, parameters); | ||
} | ||
var value = getValueAtPath(path, object); | ||
if (value === void 0) { | ||
return; | ||
} | ||
var result = fn.apply(void 0, __spreadArrays([value], extraArgs)); | ||
return callIfFunction(result, context, parameters); | ||
}; | ||
} | ||
return function call(path, parameters, object, context) { | ||
if (context === void 0) { context = object; } | ||
var callable = isEmptyPath(path) ? object : getValueAtPath(path, object); | ||
return callIfFunction(callable, context, parameters); | ||
}; | ||
} | ||
function createGet(isWithHandler) { | ||
if (isWithHandler) { | ||
return function getWith(fn, path, object) { | ||
if (typeof fn !== 'function') { | ||
throwInvalidFnError(); | ||
} | ||
var extraArgs = slice(arguments, 4); | ||
if (isEmptyPath(path)) { | ||
return fn.apply(void 0, __spreadArrays([object], extraArgs)); | ||
} | ||
var value = getValueAtPath(path, object); | ||
return value === void 0 ? value : fn.apply(void 0, __spreadArrays([value], extraArgs)); | ||
}; | ||
} | ||
return function get(path, object) { | ||
return isEmptyPath(path) ? object : getValueAtPath(path, object); | ||
}; | ||
} | ||
function createGetOr(isWithHandler) { | ||
if (isWithHandler) { | ||
return function getWithOr(fn, noMatchValue, path, object) { | ||
if (typeof fn !== 'function') { | ||
throwInvalidFnError(); | ||
} | ||
var extraArgs = slice(arguments, 4); | ||
if (isEmptyPath(path)) { | ||
return fn.apply(void 0, __spreadArrays([object], extraArgs)); | ||
} | ||
var value = getValueAtPath(path, object); | ||
return value === void 0 ? noMatchValue : fn.apply(void 0, __spreadArrays([value], extraArgs)); | ||
}; | ||
} | ||
return function getOr(noMatchValue, path, object) { | ||
return isEmptyPath(path) ? object : getValueAtPath(path, object, noMatchValue); | ||
}; | ||
} | ||
function createHas(isWithHandler) { | ||
if (isWithHandler) { | ||
return function hasWith(fn, path, object) { | ||
if (typeof fn !== 'function') { | ||
throwInvalidFnError(); | ||
} | ||
var extraArgs = slice(arguments, 3); | ||
if (isEmptyPath(path)) { | ||
return !!fn.apply(void 0, __spreadArrays([object], extraArgs)); | ||
} | ||
var value = getValueAtPath(path, object); | ||
return value !== void 0 && !!fn.apply(void 0, __spreadArrays([value], extraArgs)); | ||
}; | ||
} | ||
return function has(path, object) { | ||
return isEmptyPath(path) ? object != null : getValueAtPath(path, object) !== void 0; | ||
}; | ||
} | ||
function createIs(isWithHandler) { | ||
if (isWithHandler) { | ||
return function isWith(fn, path, value, object) { | ||
if (typeof fn !== 'function') { | ||
throwInvalidFnError(); | ||
} | ||
var extraArgs = slice(arguments, 4); | ||
if (isEmptyPath(path)) { | ||
return isSameValueZero(fn.apply(void 0, __spreadArrays([object], extraArgs)), value); | ||
} | ||
return isSameValueZero(fn.apply(void 0, __spreadArrays([getValueAtPath(path, object)], extraArgs)), value); | ||
}; | ||
} | ||
return function is(path, value, object) { | ||
var _path = isEmptyPath(path) ? object : getValueAtPath(path, object); | ||
return isSameValueZero(_path, value); | ||
}; | ||
} | ||
function createMerge(isWithHandler, isDeep) { | ||
if (isWithHandler) { | ||
return function mergeWith(fn, path, object) { | ||
if (typeof fn !== 'function') { | ||
throwInvalidFnError(); | ||
} | ||
var extraArgs = slice(arguments, 3); | ||
if (!isCloneable(object)) { | ||
return fn.apply(void 0, __spreadArrays([object], extraArgs)); | ||
} | ||
if (isEmptyPath(path)) { | ||
var objectToMerge = fn.apply(void 0, __spreadArrays([object], extraArgs)); | ||
return objectToMerge ? getMergedObject(object, objectToMerge, isDeep) : object; | ||
} | ||
var hasChanged = false; | ||
var result = getDeepClone(path, object, function (ref, key) { | ||
var objectToMerge = fn.apply(void 0, __spreadArrays([ref[key]], extraArgs)); | ||
if (objectToMerge) { | ||
ref[key] = getMergedObject(ref[key], objectToMerge, isDeep); | ||
hasChanged = true; | ||
} | ||
}); | ||
return hasChanged ? result : object; | ||
}; | ||
} | ||
return function merge(path, objectToMerge, object) { | ||
if (!isCloneable(object)) { | ||
return objectToMerge; | ||
} | ||
return isEmptyPath(path) | ||
? getMergedObject(object, objectToMerge, true) | ||
: getDeepClone(path, object, function (ref, key) { | ||
ref[key] = getMergedObject(ref[key], objectToMerge, isDeep); | ||
}); | ||
}; | ||
} | ||
function createNot(isWithHandler) { | ||
var is = createIs(isWithHandler); | ||
return function not() { | ||
return !is.apply(this, arguments); | ||
}; | ||
} | ||
function createRemove(isWithHandler) { | ||
if (isWithHandler) { | ||
return function removeWith(fn, path, object) { | ||
if (typeof fn !== 'function') { | ||
throwInvalidFnError(); | ||
} | ||
var extraArgs = slice(arguments, 3); | ||
if (isEmptyPath(path)) { | ||
var emptyObject = getNewEmptyObject(object); | ||
return fn.apply(void 0, __spreadArrays([emptyObject], extraArgs)) ? emptyObject : object; | ||
} | ||
var value = getValueAtPath(path, object); | ||
return value !== void 0 && fn.apply(void 0, __spreadArrays([value], extraArgs)) | ||
? getDeepClone(path, object, function (ref, key) { | ||
if (isArray$1(ref)) { | ||
splice(ref, key); | ||
} | ||
else { | ||
delete ref[key]; | ||
} | ||
}) | ||
: object; | ||
}; | ||
} | ||
return function remove(path, object) { | ||
if (isEmptyPath(path)) { | ||
return getNewEmptyObject(object); | ||
} | ||
return getValueAtPath(path, object) !== void 0 | ||
? getDeepClone(path, object, function (ref, key) { | ||
if (isArray$1(ref)) { | ||
splice(ref, key); | ||
} | ||
else { | ||
delete ref[key]; | ||
} | ||
}) | ||
: object; | ||
}; | ||
} | ||
function createSet(isWithHandler) { | ||
if (isWithHandler) { | ||
return function setWith(fn, path, object) { | ||
if (typeof fn !== 'function') { | ||
throwInvalidFnError(); | ||
} | ||
var extraArgs = slice(arguments, 3); | ||
return isEmptyPath(path) | ||
? fn.apply(void 0, __spreadArrays([object], extraArgs)) : getDeepClone(path, object, function (ref, key) { | ||
ref[key] = fn.apply(void 0, __spreadArrays([ref[key]], extraArgs)); | ||
}); | ||
}; | ||
} | ||
return function set(path, value, object) { | ||
return isEmptyPath(path) | ||
? value | ||
: getDeepClone(path, object, function (ref, key) { | ||
ref[key] = value; | ||
}); | ||
}; | ||
} | ||
function createAdd(isWithHandler) { | ||
var _add = createSet(isWithHandler); | ||
if (isWithHandler) { | ||
return function addWith(fn, path, object) { | ||
return _add.apply(this, [fn, getFullPath(path, object, fn), object].concat(slice(arguments, 3))); | ||
}; | ||
} | ||
return function add(path, value, object) { | ||
return _add(getFullPath(path, object), value, object); | ||
}; | ||
} | ||
// external dependencies | ||
var add = curriable.curry(createAdd(false)); | ||
var addWith = curriable.curry(createAdd(true)); | ||
var assign$1 = curriable.curry(createMerge(false, false)); | ||
var assignWith = curriable.curry(createMerge(true, false)); | ||
var call = curriable.curry(createCall(false), 3); | ||
var callWith = curriable.curry(createCall(true), 4); | ||
var get = curriable.curry(createGet(false)); | ||
var getOr = curriable.curry(createGetOr(false)); | ||
var getWith = curriable.curry(createGet(true)); | ||
var getWithOr = curriable.curry(createGetOr(true)); | ||
var has = curriable.curry(createHas(false)); | ||
var hasWith = curriable.curry(createHas(true)); | ||
var is = curriable.curry(createIs(false)); | ||
var isWith = curriable.curry(createIs(true)); | ||
var merge = curriable.curry(createMerge(false, true)); | ||
var mergeWith = curriable.curry(createMerge(true, true)); | ||
var not = curriable.curry(createNot(false)); | ||
var notWith = curriable.curry(createNot(true)); | ||
var remove = curriable.curry(createRemove(false)); | ||
var removeWith = curriable.curry(createRemove(true)); | ||
var set = curriable.curry(createSet(false)); | ||
var setWith = curriable.curry(createSet(true)); | ||
Object.defineProperty(exports, '__', { | ||
enumerable: true, | ||
get: function () { | ||
return curriable.__; | ||
} | ||
}); | ||
exports.add = add; | ||
exports.addWith = addWith; | ||
exports.assign = assign$1; | ||
exports.assignWith = assignWith; | ||
exports.call = call; | ||
exports.callWith = callWith; | ||
exports.get = get; | ||
exports.getOr = getOr; | ||
exports.getWith = getWith; | ||
exports.getWithOr = getWithOr; | ||
exports.has = has; | ||
exports.hasWith = hasWith; | ||
exports.is = is; | ||
exports.isWith = isWith; | ||
exports.merge = merge; | ||
exports.mergeWith = mergeWith; | ||
exports.not = not; | ||
exports.notWith = notWith; | ||
exports.remove = remove; | ||
exports.removeWith = removeWith; | ||
exports.set = set; | ||
exports.setWith = setWith; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
}))); | ||
//# sourceMappingURL=unchanged.js.map |
@@ -1,1 +0,15 @@ | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("curriable"),require("pathington")):"function"==typeof define&&define.amd?define(["exports","curriable","pathington"],t):t((n=n||self).unchanged={},n.curriable,n.pathington)}(this,function(n,t,r){"use strict";var o=Object,e=o.create,u=o.getOwnPropertySymbols,c=o.getPrototypeOf,i=o.keys,f=o.propertyIsEnumerable,a=Array.isArray,p=Function.prototype.bind.call(Function.prototype.call,Function.prototype.toString),y=Function.prototype.bind.call(Function.prototype.call,o.prototype.toString),l="function"==typeof Symbol&&"function"==typeof Symbol.for,v=l?Symbol.for("react.element"):60103,d=function(n,t,r){for(var o=r,e=0,u=n.length;e<u;e++)o=t(o,n[e]);return o},s=function(n){if(!l)return i(n);var t=u(n);return t.length?i(n).concat(d(t,function(t,r){return f.call(n,r)&&t.push(r),t},[])):i(n)},h="function"==typeof o.assign?o.assign:function(n,t){return t?d(s(t),function(n,r){return n[r]=t[r],n},Object(n)):n},g=function(n){return e(n.__proto__||c(n))},b=function(n){if(!n||"object"!=typeof n||n.$$typeof===v)return!1;var t=y(n);return"[object Date]"!==t&&"[object RegExp]"!==t},m=function(n){return null==n||a(n)&&!n.length},W=function(n){return"function"==typeof n&&!!~p(n).indexOf("[native code]")},_=function(n,t,r){return"function"==typeof n?n.apply(t,r):void 0},O=function(n){return a(n)?[]:{}},j=function(n){return n.constructor===o?h({},n):a(n)?function(n){for(var t=n.constructor,r=t===Array?[]:new t,o=0,e=n.length;o<e;o++)r[o]=n[o];return r}(n):W(n.constructor)?{}:h(g(n),n)},F=function(n,t){return n===t||n!=n&&t!=t},A=function(n,t){return b(n)?j(n):"number"==typeof t?[]:{}},S=function(n,t){return void 0===n?t:n},x=function(n){return a(n)?n:r.parse(n)},w=function(n,t,r,o){var e=n[o],u=o+1;return u===n.length?r(t,e):t[e]=w(n,A(t[e],n[u]),r,u),t},P=function(n,t,r){var o=x(n),e=A(t,o[0]);return 1===o.length?(r(e,o[0]),e):w(o,e,r,0)},E=function(n,t,r){var e,u=a(n);if(u!==a(t)||!b(n))return b(e=t)?j(e):e;if(u)return n.concat(t);var c=n.constructor===o||W(n.constructor)?{}:g(n);return d(s(t),function(o,e){return o[e]=r&&b(t[e])?E(n[e],t[e],r):t[e],o},h(c,n))},q=function(n,t,r){var o=x(n);if(1===o.length)return t?S(t[o[0]],r):r;for(var e=t,u=o[0],c=0;c<o.length-1;c++){if(!e||!e[u])return r;e=e[u],u=o[c+1]}return e?S(e[u],r):r},$=function(n,t,r){var o=m(n),e=o?t:r?r(q(n,t)):q(n,t);return a(e)?a(n)?n.concat([e.length]):(o?"":n)+"["+e.length+"]":n},k=function(n,t){if(n.length){for(var r=n.length-1,o=t;o<r;)n[o]=n[o+1],++o;n.length=r}},D=function(){throw new TypeError('handler passed is not of type "function".')},I=Array.isArray,M=Function.prototype.bind.call(Function.prototype.bind,Array.prototype.slice);function R(n){return n?function(n,t,r,o,e){void 0===e&&(e=o),"function"!=typeof n&&D();var u=M(arguments,5);if(m(t))return _(n.apply(void 0,[o].concat(u)),e,r);var c=q(t,o);if(void 0!==c){var i=n.apply(void 0,[c].concat(u));return _(i,e,r)}}:function(n,t,r,o){void 0===o&&(o=r);var e=m(n)?r:q(n,r);return _(e,o,t)}}function T(n){return n?function(n,t,r){"function"!=typeof n&&D();var o=M(arguments,4);if(m(t))return n.apply(void 0,[r].concat(o));var e=q(t,r);return void 0===e?e:n.apply(void 0,[e].concat(o))}:function(n,t){return m(n)?t:q(n,t)}}function z(n){return n?function(n,t,r,o){"function"!=typeof n&&D();var e=M(arguments,4);if(m(r))return n.apply(void 0,[o].concat(e));var u=q(r,o);return void 0===u?t:n.apply(void 0,[u].concat(e))}:function(n,t,r){return m(t)?r:q(t,r,n)}}function B(n){return n?function(n,t,r){"function"!=typeof n&&D();var o=M(arguments,3);if(m(t))return!!n.apply(void 0,[r].concat(o));var e=q(t,r);return void 0!==e&&!!n.apply(void 0,[e].concat(o))}:function(n,t){return m(n)?null!=t:void 0!==q(n,t)}}function C(n){return n?function(n,t,r,o){"function"!=typeof n&&D();var e=M(arguments,4);return m(t)?F(n.apply(void 0,[o].concat(e)),r):F(n.apply(void 0,[q(t,o)].concat(e)),r)}:function(n,t,r){var o=m(n)?r:q(n,r);return F(o,t)}}function G(n,t){return n?function(n,r,o){"function"!=typeof n&&D();var e=M(arguments,3);if(!b(o))return n.apply(void 0,[o].concat(e));if(m(r)){var u=n.apply(void 0,[o].concat(e));return u?E(o,u,t):o}var c=!1,i=P(r,o,function(r,o){var u=n.apply(void 0,[r[o]].concat(e));u&&(r[o]=E(r[o],u,t),c=!0)});return c?i:o}:function(n,r,o){return b(o)?m(n)?E(o,r,!0):P(n,o,function(n,o){n[o]=E(n[o],r,t)}):r}}function H(n){var t=C(n);return function(){return!t.apply(this,arguments)}}function J(n){return n?function(n,t,r){"function"!=typeof n&&D();var o=M(arguments,3);if(m(t)){var e=O(r);return n.apply(void 0,[e].concat(o))?e:r}var u=q(t,r);return void 0!==u&&n.apply(void 0,[u].concat(o))?P(t,r,function(n,t){I(n)?k(n,t):delete n[t]}):r}:function(n,t){return m(n)?O(t):void 0!==q(n,t)?P(n,t,function(n,t){I(n)?k(n,t):delete n[t]}):t}}function K(n){return n?function(n,t,r){"function"!=typeof n&&D();var o=M(arguments,3);return m(t)?n.apply(void 0,[r].concat(o)):P(t,r,function(t,r){t[r]=n.apply(void 0,[t[r]].concat(o))})}:function(n,t,r){return m(n)?t:P(n,r,function(n,r){n[r]=t})}}function L(n){var t=K(n);return n?function(n,r,o){return t.apply(this,[n,$(r,o,n),o].concat(M(arguments,3)))}:function(n,r,o){return t($(n,o),r,o)}}var N=t.curry(L(!1)),Q=t.curry(L(!0)),U=t.curry(G(!1,!1)),V=t.curry(G(!0,!1)),X=t.curry(R(!1),3),Y=t.curry(R(!0),4),Z=t.curry(T(!1)),nn=t.curry(z(!1)),tn=t.curry(T(!0)),rn=t.curry(z(!0)),on=t.curry(B(!1)),en=t.curry(B(!0)),un=t.curry(C(!1)),cn=t.curry(C(!0)),fn=t.curry(G(!1,!0)),an=t.curry(G(!0,!0)),pn=t.curry(H(!1)),yn=t.curry(H(!0)),ln=t.curry(J(!1)),vn=t.curry(J(!0)),dn=t.curry(K(!1)),sn=t.curry(K(!0));Object.defineProperty(n,"__",{enumerable:!0,get:function(){return t.__}}),n.add=N,n.addWith=Q,n.assign=U,n.assignWith=V,n.call=X,n.callWith=Y,n.get=Z,n.getOr=nn,n.getWith=tn,n.getWithOr=rn,n.has=on,n.hasWith=en,n.is=un,n.isWith=cn,n.merge=fn,n.mergeWith=an,n.not=pn,n.notWith=yn,n.remove=ln,n.removeWith=vn,n.set=dn,n.setWith=sn,Object.defineProperty(n,"__esModule",{value:!0})}); | ||
!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("curriable"),require("pathington")):"function"==typeof define&&define.amd?define(["exports","curriable","pathington"],r):r((n=n||self).unchanged={},n.curriable,n.pathington)}(this,(function(n,r,t){"use strict"; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
***************************************************************************** */function o(){for(var n=0,r=0,t=arguments.length;r<t;r++)n+=arguments[r].length;var o=Array(n),e=0;for(r=0;r<t;r++)for(var u=arguments[r],i=0,c=u.length;i<c;i++,e++)o[e]=u[i];return o}var e=Object,u=e.create,i=e.getOwnPropertySymbols,c=e.getPrototypeOf,f=e.keys,a=e.propertyIsEnumerable,p=Array.isArray,y=Function.prototype.bind.call(Function.prototype.call,Function.prototype.toString),l=Function.prototype.bind.call(Function.prototype.call,e.prototype.toString),v="function"==typeof Symbol&&"function"==typeof Symbol.for,d=v?Symbol.for("react.element"):60103,s=function(n,r,t){for(var o=t,e=0,u=n.length;e<u;e++)o=r(o,n[e]);return o},h=function(n){if(!v)return f(n);var r=i(n);return r.length?f(n).concat(s(r,(function(r,t){return a.call(n,t)&&r.push(t),r}),[])):f(n)},g="function"==typeof e.assign?e.assign:function(n,r){return r?s(h(r),(function(n,t){return n[t]=r[t],n}),Object(n)):n},b=function(n){return u(n.__proto__||c(n))},m=function(n){if(!n||"object"!=typeof n||n.$$typeof===d)return!1;var r=l(n);return"[object Date]"!==r&&"[object RegExp]"!==r},W=function(n){return null==n||p(n)&&!n.length},_=function(n){return"function"==typeof n&&!!~y(n).indexOf("[native code]")},O=function(n,r,t){return"function"==typeof n?n.apply(r,t):void 0},j=function(n){return p(n)?[]:{}},A=function(n){return n.constructor===e?g({},n):p(n)?function(n){for(var r=n.constructor,t=r===Array?[]:new r,o=0,e=n.length;o<e;o++)t[o]=n[o];return t}(n):_(n.constructor)?{}:g(b(n),n)},F=function(n,r){return n===r||n!=n&&r!=r},S=function(n,r){return m(n)?A(n):"number"==typeof r?[]:{}},x=function(n,r){return void 0===n?r:n},w=function(n){return p(n)?n:t.parse(n)},P=function(n,r,t,o){var e=n[o],u=o+1;return u===n.length?t(r,e):r[e]=P(n,S(r[e],n[u]),t,u),r},E=function(n,r,t){var o=w(n),e=S(r,o[0]);return 1===o.length?(t(e,o[0]),e):P(o,e,t,0)},q=function(n,r,t){var o,u=p(n);if(u!==p(r)||!m(n))return m(o=r)?A(o):o;if(u)return n.concat(r);var i=n.constructor===e||_(n.constructor)?{}:b(n);return s(h(r),(function(o,e){return o[e]=t&&m(r[e])?q(n[e],r[e],t):r[e],o}),g(i,n))},$=function(n,r,t){var o=w(n);if(1===o.length)return r?x(r[o[0]],t):t;for(var e=r,u=o[0],i=0;i<o.length-1;i++){if(!e||!e[u])return t;e=e[u],u=o[i+1]}return e?x(e[u],t):t},k=function(n,r,t){var o=W(n),e=o?r:t?t($(n,r)):$(n,r);return p(e)?p(n)?n.concat([e.length]):(o?"":n)+"["+e.length+"]":n},D=function(n,r){if(n.length){for(var t=n.length-1,o=r;o<t;)n[o]=n[o+1],++o;n.length=t}},I=function(){throw new TypeError('handler passed is not of type "function".')},M=Array.isArray,R=Function.prototype.bind.call(Function.prototype.call,Array.prototype.slice);function T(n){return n?function(n,r,t,e,u){void 0===u&&(u=e),"function"!=typeof n&&I();var i=R(arguments,5);if(W(r))return O(n.apply(void 0,o([e],i)),u,t);var c=$(r,e);if(void 0!==c){var f=n.apply(void 0,o([c],i));return O(f,u,t)}}:function(n,r,t,o){void 0===o&&(o=t);var e=W(n)?t:$(n,t);return O(e,o,r)}}function z(n){return n?function(n,r,t){"function"!=typeof n&&I();var e=R(arguments,4);if(W(r))return n.apply(void 0,o([t],e));var u=$(r,t);return void 0===u?u:n.apply(void 0,o([u],e))}:function(n,r){return W(n)?r:$(n,r)}}function B(n){return n?function(n,r,t,e){"function"!=typeof n&&I();var u=R(arguments,4);if(W(t))return n.apply(void 0,o([e],u));var i=$(t,e);return void 0===i?r:n.apply(void 0,o([i],u))}:function(n,r,t){return W(r)?t:$(r,t,n)}}function C(n){return n?function(n,r,t){"function"!=typeof n&&I();var e=R(arguments,3);if(W(r))return!!n.apply(void 0,o([t],e));var u=$(r,t);return void 0!==u&&!!n.apply(void 0,o([u],e))}:function(n,r){return W(n)?null!=r:void 0!==$(n,r)}}function G(n){return n?function(n,r,t,e){"function"!=typeof n&&I();var u=R(arguments,4);return W(r)?F(n.apply(void 0,o([e],u)),t):F(n.apply(void 0,o([$(r,e)],u)),t)}:function(n,r,t){var o=W(n)?t:$(n,t);return F(o,r)}}function H(n,r){return n?function(n,t,e){"function"!=typeof n&&I();var u=R(arguments,3);if(!m(e))return n.apply(void 0,o([e],u));if(W(t)){var i=n.apply(void 0,o([e],u));return i?q(e,i,r):e}var c=!1,f=E(t,e,(function(t,e){var i=n.apply(void 0,o([t[e]],u));i&&(t[e]=q(t[e],i,r),c=!0)}));return c?f:e}:function(n,t,o){return m(o)?W(n)?q(o,t,!0):E(n,o,(function(n,o){n[o]=q(n[o],t,r)})):t}}function J(n){var r=G(n);return function(){return!r.apply(this,arguments)}}function K(n){return n?function(n,r,t){"function"!=typeof n&&I();var e=R(arguments,3);if(W(r)){var u=j(t);return n.apply(void 0,o([u],e))?u:t}var i=$(r,t);return void 0!==i&&n.apply(void 0,o([i],e))?E(r,t,(function(n,r){M(n)?D(n,r):delete n[r]})):t}:function(n,r){return W(n)?j(r):void 0!==$(n,r)?E(n,r,(function(n,r){M(n)?D(n,r):delete n[r]})):r}}function L(n){return n?function(n,r,t){"function"!=typeof n&&I();var e=R(arguments,3);return W(r)?n.apply(void 0,o([t],e)):E(r,t,(function(r,t){r[t]=n.apply(void 0,o([r[t]],e))}))}:function(n,r,t){return W(n)?r:E(n,t,(function(n,t){n[t]=r}))}}function N(n){var r=L(n);return n?function(n,t,o){return r.apply(this,[n,k(t,o,n),o].concat(R(arguments,3)))}:function(n,t,o){return r(k(n,o),t,o)}}var Q=r.curry(N(!1)),U=r.curry(N(!0)),V=r.curry(H(!1,!1)),X=r.curry(H(!0,!1)),Y=r.curry(T(!1),3),Z=r.curry(T(!0),4),nn=r.curry(z(!1)),rn=r.curry(B(!1)),tn=r.curry(z(!0)),on=r.curry(B(!0)),en=r.curry(C(!1)),un=r.curry(C(!0)),cn=r.curry(G(!1)),fn=r.curry(G(!0)),an=r.curry(H(!1,!0)),pn=r.curry(H(!0,!0)),yn=r.curry(J(!1)),ln=r.curry(J(!0)),vn=r.curry(K(!1)),dn=r.curry(K(!0)),sn=r.curry(L(!1)),hn=r.curry(L(!0));Object.defineProperty(n,"__",{enumerable:!0,get:function(){return r.__}}),n.add=Q,n.addWith=U,n.assign=V,n.assignWith=X,n.call=Y,n.callWith=Z,n.get=nn,n.getOr=rn,n.getWith=tn,n.getWithOr=on,n.has=en,n.hasWith=un,n.is=cn,n.isWith=fn,n.merge=an,n.mergeWith=pn,n.not=yn,n.notWith=ln,n.remove=vn,n.removeWith=dn,n.set=sn,n.setWith=hn,Object.defineProperty(n,"__esModule",{value:!0})})); |
@@ -21,29 +21,29 @@ { | ||
"devDependencies": { | ||
"@types/jest": "^24.0.15", | ||
"@types/node": "^12.6.1", | ||
"@types/ramda": "^0.26.15", | ||
"@types/react": "^16.8.23", | ||
"@types/jest": "^24.0.20", | ||
"@types/node": "^12.11.7", | ||
"@types/ramda": "^0.26.33", | ||
"@types/react": "^16.9.11", | ||
"benchmark": "^2.1.4", | ||
"cli-table": "^0.3.1", | ||
"eslint": "^6.0.1", | ||
"eslint": "^6.6.0", | ||
"html-webpack-plugin": "^3.2.0", | ||
"jest": "^24.8.0", | ||
"jest": "^24.9.0", | ||
"lodash": "^4.17.10", | ||
"nyc": "^14.1.1", | ||
"ramda": "^0.26.1", | ||
"react": "^16.8.6", | ||
"react-dom": "^16.8.6", | ||
"rollup": "^1.16.6", | ||
"react": "^16.11.0", | ||
"react-dom": "^16.11.0", | ||
"rollup": "^1.25.2", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"rollup-plugin-terser": "^5.1.1", | ||
"rollup-plugin-typescript2": "^0.21.2", | ||
"ts-jest": "^24.0.2", | ||
"ts-loader": "^6.0.4", | ||
"tslint": "^5.18.0", | ||
"tslint-config-airbnb": "^5.11.0", | ||
"rollup-plugin-terser": "^5.1.2", | ||
"rollup-plugin-typescript2": "^0.24.3", | ||
"ts-jest": "^24.1.0", | ||
"ts-loader": "^6.2.1", | ||
"tslint": "^5.20.0", | ||
"tslint-config-airbnb": "^5.11.2", | ||
"tslint-loader": "^3.5.4", | ||
"typescript": "^3.5.3", | ||
"webpack": "^4.35.3", | ||
"webpack-cli": "^3.3.5", | ||
"webpack-dev-server": "^3.7.2" | ||
"typescript": "^3.6.4", | ||
"webpack": "^4.41.2", | ||
"webpack-cli": "^3.3.9", | ||
"webpack-dev-server": "^3.9.0" | ||
}, | ||
@@ -82,3 +82,3 @@ "keywords": [ | ||
"types": "dist/index.d.ts", | ||
"version": "2.2.0" | ||
"version": "2.2.1" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
294355
2279
1