@mll-lab/js-utils 2.36.0 → 2.37.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/index.common.js +110 -21
- package/dist/index.common.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +110 -21
- package/dist/index.js.map +1 -1
- package/dist/stringToColor.d.ts +13 -3
- package/package.json +3 -3
package/dist/index.common.js
CHANGED
|
@@ -29,10 +29,19 @@ function createCommonjsModule(fn) {
|
|
|
29
29
|
return fn(module, module.exports), module.exports;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
var lodash=createCommonjsModule(function(module,exports){(function(){/** Used as a safe reference for `undefined` in pre-ES5 environments. */var undefined$1;/** Used as the semantic version number. */var VERSION='4.17.
|
|
32
|
+
var lodash=createCommonjsModule(function(module,exports){(function(){/** Used as a safe reference for `undefined` in pre-ES5 environments. */var undefined$1;/** Used as the semantic version number. */var VERSION='4.17.21';/** Used as the size to enable large array optimizations. */var LARGE_ARRAY_SIZE=200;/** Error message constants. */var CORE_ERROR_TEXT='Unsupported core-js use. Try https://npms.io/search?q=ponyfill.',FUNC_ERROR_TEXT='Expected a function',INVALID_TEMPL_VAR_ERROR_TEXT='Invalid `variable` option passed into `_.template`';/** Used to stand-in for `undefined` hash values. */var HASH_UNDEFINED='__lodash_hash_undefined__';/** Used as the maximum memoize cache size. */var MAX_MEMOIZE_SIZE=500;/** Used as the internal argument placeholder. */var PLACEHOLDER='__lodash_placeholder__';/** Used to compose bitmasks for cloning. */var CLONE_DEEP_FLAG=1,CLONE_FLAT_FLAG=2,CLONE_SYMBOLS_FLAG=4;/** Used to compose bitmasks for value comparisons. */var COMPARE_PARTIAL_FLAG=1,COMPARE_UNORDERED_FLAG=2;/** Used to compose bitmasks for function metadata. */var WRAP_BIND_FLAG=1,WRAP_BIND_KEY_FLAG=2,WRAP_CURRY_BOUND_FLAG=4,WRAP_CURRY_FLAG=8,WRAP_CURRY_RIGHT_FLAG=16,WRAP_PARTIAL_FLAG=32,WRAP_PARTIAL_RIGHT_FLAG=64,WRAP_ARY_FLAG=128,WRAP_REARG_FLAG=256,WRAP_FLIP_FLAG=512;/** Used as default options for `_.truncate`. */var DEFAULT_TRUNC_LENGTH=30,DEFAULT_TRUNC_OMISSION='...';/** Used to detect hot functions by number of calls within a span of milliseconds. */var HOT_COUNT=800,HOT_SPAN=16;/** Used to indicate the type of lazy iteratees. */var LAZY_FILTER_FLAG=1,LAZY_MAP_FLAG=2,LAZY_WHILE_FLAG=3;/** Used as references for various `Number` constants. */var INFINITY=1/0,MAX_SAFE_INTEGER=9007199254740991,MAX_INTEGER=1.7976931348623157e+308,NAN=0/0;/** Used as references for the maximum length and index of an array. */var MAX_ARRAY_LENGTH=4294967295,MAX_ARRAY_INDEX=MAX_ARRAY_LENGTH-1,HALF_MAX_ARRAY_LENGTH=MAX_ARRAY_LENGTH>>>1;/** Used to associate wrap methods with their bit flags. */var wrapFlags=[['ary',WRAP_ARY_FLAG],['bind',WRAP_BIND_FLAG],['bindKey',WRAP_BIND_KEY_FLAG],['curry',WRAP_CURRY_FLAG],['curryRight',WRAP_CURRY_RIGHT_FLAG],['flip',WRAP_FLIP_FLAG],['partial',WRAP_PARTIAL_FLAG],['partialRight',WRAP_PARTIAL_RIGHT_FLAG],['rearg',WRAP_REARG_FLAG]];/** `Object#toString` result references. */var argsTag='[object Arguments]',arrayTag='[object Array]',asyncTag='[object AsyncFunction]',boolTag='[object Boolean]',dateTag='[object Date]',domExcTag='[object DOMException]',errorTag='[object Error]',funcTag='[object Function]',genTag='[object GeneratorFunction]',mapTag='[object Map]',numberTag='[object Number]',nullTag='[object Null]',objectTag='[object Object]',promiseTag='[object Promise]',proxyTag='[object Proxy]',regexpTag='[object RegExp]',setTag='[object Set]',stringTag='[object String]',symbolTag='[object Symbol]',undefinedTag='[object Undefined]',weakMapTag='[object WeakMap]',weakSetTag='[object WeakSet]';var arrayBufferTag='[object ArrayBuffer]',dataViewTag='[object DataView]',float32Tag='[object Float32Array]',float64Tag='[object Float64Array]',int8Tag='[object Int8Array]',int16Tag='[object Int16Array]',int32Tag='[object Int32Array]',uint8Tag='[object Uint8Array]',uint8ClampedTag='[object Uint8ClampedArray]',uint16Tag='[object Uint16Array]',uint32Tag='[object Uint32Array]';/** Used to match empty string literals in compiled template source. */var reEmptyStringLeading=/\b__p \+= '';/g,reEmptyStringMiddle=/\b(__p \+=) '' \+/g,reEmptyStringTrailing=/(__e\(.*?\)|\b__t\)) \+\n'';/g;/** Used to match HTML entities and HTML characters. */var reEscapedHtml=/&(?:amp|lt|gt|quot|#39);/g,reUnescapedHtml=/[&<>"']/g,reHasEscapedHtml=RegExp(reEscapedHtml.source),reHasUnescapedHtml=RegExp(reUnescapedHtml.source);/** Used to match template delimiters. */var reEscape=/<%-([\s\S]+?)%>/g,reEvaluate=/<%([\s\S]+?)%>/g,reInterpolate=/<%=([\s\S]+?)%>/g;/** Used to match property names within property paths. */var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/,rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;/**
|
|
33
33
|
* Used to match `RegExp`
|
|
34
34
|
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
35
|
-
*/var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reHasRegExpChar=RegExp(reRegExpChar.source);/** Used to match leading
|
|
35
|
+
*/var reRegExpChar=/[\\^$.*+?()[\]{}|]/g,reHasRegExpChar=RegExp(reRegExpChar.source);/** Used to match leading whitespace. */var reTrimStart=/^\s+/;/** Used to match a single whitespace character. */var reWhitespace=/\s/;/** Used to match wrap detail comments. */var reWrapComment=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,reWrapDetails=/\{\n\/\* \[wrapped with (.+)\] \*/,reSplitDetails=/,? & /;/** Used to match words composed of alphanumeric characters. */var reAsciiWord=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;/**
|
|
36
|
+
* Used to validate the `validate` option in `_.template` variable.
|
|
37
|
+
*
|
|
38
|
+
* Forbids characters which could potentially change the meaning of the function argument definition:
|
|
39
|
+
* - "()," (modification of function parameters)
|
|
40
|
+
* - "=" (default value)
|
|
41
|
+
* - "[]{}" (destructuring of function parameters)
|
|
42
|
+
* - "/" (beginning of a comment)
|
|
43
|
+
* - whitespace
|
|
44
|
+
*/var reForbiddenIdentifierChars=/[()=,{}\[\]\/\s]/;/** Used to match backslashes in property paths. */var reEscapeChar=/\\(\\)?/g;/**
|
|
36
45
|
* Used to match
|
|
37
46
|
* [ES template delimiters](http://ecma-international.org/ecma-262/7.0/#sec-template-literal-lexical-components).
|
|
38
47
|
*/var reEsTemplate=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;/** Used to match `RegExp` flags from their coerced string values. */var reFlags=/\w*$/;/** Used to detect bad signed hexadecimal string values. */var reIsBadHex=/^[-+]0x[0-9a-f]+$/i;/** Used to detect binary string values. */var reIsBinary=/^0b[01]+$/i;/** Used to detect host constructors (Safari). */var reIsHostCtor=/^\[object .+?Constructor\]$/;/** Used to detect octal string values. */var reIsOctal=/^0o[0-7]+$/i;/** Used to detect unsigned integer values. */var reIsUint=/^(?:0|[1-9]\d*)$/;/** Used to match Latin Unicode letters (excluding mathematical operators). */var reLatin=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;/** Used to ensure capturing order of template delimiters. */var reNoMatch=/($^)/;/** Used to match unescaped characters in compiled string literals. */var reUnescapedString=/['\n\r\u2028\u2029\\]/g;/** Used to compose unicode character classes. */var rsAstralRange="\\ud800-\\udfff",rsComboMarksRange="\\u0300-\\u036f",reComboHalfMarksRange="\\ufe20-\\ufe2f",rsComboSymbolsRange="\\u20d0-\\u20ff",rsComboRange=rsComboMarksRange+reComboHalfMarksRange+rsComboSymbolsRange,rsDingbatRange="\\u2700-\\u27bf",rsLowerRange='a-z\\xdf-\\xf6\\xf8-\\xff',rsMathOpRange='\\xac\\xb1\\xd7\\xf7',rsNonCharRange='\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',rsPunctuationRange="\\u2000-\\u206f",rsSpaceRange=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",rsUpperRange='A-Z\\xc0-\\xd6\\xd8-\\xde',rsVarRange="\\ufe0e\\ufe0f",rsBreakRange=rsMathOpRange+rsNonCharRange+rsPunctuationRange+rsSpaceRange;/** Used to compose unicode capture groups. */var rsApos="['\u2019]",rsAstral='['+rsAstralRange+']',rsBreak='['+rsBreakRange+']',rsCombo='['+rsComboRange+']',rsDigits='\\d+',rsDingbat='['+rsDingbatRange+']',rsLower='['+rsLowerRange+']',rsMisc='[^'+rsAstralRange+rsBreakRange+rsDigits+rsDingbatRange+rsLowerRange+rsUpperRange+']',rsFitz="\\ud83c[\\udffb-\\udfff]",rsModifier='(?:'+rsCombo+'|'+rsFitz+')',rsNonAstral='[^'+rsAstralRange+']',rsRegional="(?:\\ud83c[\\udde6-\\uddff]){2}",rsSurrPair="[\\ud800-\\udbff][\\udc00-\\udfff]",rsUpper='['+rsUpperRange+']',rsZWJ="\\u200d";/** Used to compose unicode regexes. */var rsMiscLower='(?:'+rsLower+'|'+rsMisc+')',rsMiscUpper='(?:'+rsUpper+'|'+rsMisc+')',rsOptContrLower='(?:'+rsApos+'(?:d|ll|m|re|s|t|ve))?',rsOptContrUpper='(?:'+rsApos+'(?:D|LL|M|RE|S|T|VE))?',reOptMod=rsModifier+'?',rsOptVar='['+rsVarRange+']?',rsOptJoin='(?:'+rsZWJ+'(?:'+[rsNonAstral,rsRegional,rsSurrPair].join('|')+')'+rsOptVar+reOptMod+')*',rsOrdLower='\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])',rsOrdUpper='\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])',rsSeq=rsOptVar+reOptMod+rsOptJoin,rsEmoji='(?:'+[rsDingbat,rsRegional,rsSurrPair].join('|')+')'+rsSeq,rsSymbol='(?:'+[rsNonAstral+rsCombo+'?',rsCombo,rsRegional,rsSurrPair,rsAstral].join('|')+')';/** Used to match apostrophes. */var reApos=RegExp(rsApos,'g');/**
|
|
@@ -282,6 +291,12 @@ return freeProcess&&freeProcess.binding&&freeProcess.binding('util');}catch(e){}
|
|
|
282
291
|
* @param {Array} props The property names to get values for.
|
|
283
292
|
* @returns {Object} Returns the key-value pairs.
|
|
284
293
|
*/function baseToPairs(object,props){return arrayMap(props,function(key){return [key,object[key]];});}/**
|
|
294
|
+
* The base implementation of `_.trim`.
|
|
295
|
+
*
|
|
296
|
+
* @private
|
|
297
|
+
* @param {string} string The string to trim.
|
|
298
|
+
* @returns {string} Returns the trimmed string.
|
|
299
|
+
*/function baseTrim(string){return string?string.slice(0,trimmedEndIndex(string)+1).replace(reTrimStart,''):string;}/**
|
|
285
300
|
* The base implementation of `_.unary` without support for storing metadata.
|
|
286
301
|
*
|
|
287
302
|
* @private
|
|
@@ -434,6 +449,13 @@ return freeProcess&&freeProcess.binding&&freeProcess.binding('util');}catch(e){}
|
|
|
434
449
|
* @param {string} string The string to convert.
|
|
435
450
|
* @returns {Array} Returns the converted array.
|
|
436
451
|
*/function stringToArray(string){return hasUnicode(string)?unicodeToArray(string):asciiToArray(string);}/**
|
|
452
|
+
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
453
|
+
* character of `string`.
|
|
454
|
+
*
|
|
455
|
+
* @private
|
|
456
|
+
* @param {string} string The string to inspect.
|
|
457
|
+
* @returns {number} Returns the index of the last non-whitespace character.
|
|
458
|
+
*/function trimmedEndIndex(string){var index=string.length;while(index--&&reWhitespace.test(string.charAt(index))){}return index;}/**
|
|
437
459
|
* Used by `_.unescape` to convert HTML entities to characters.
|
|
438
460
|
*
|
|
439
461
|
* @private
|
|
@@ -1404,7 +1426,7 @@ stack.set(srcValue,newValue);mergeFunc(newValue,srcValue,srcIndex,customizer,sta
|
|
|
1404
1426
|
* @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by.
|
|
1405
1427
|
* @param {string[]} orders The sort orders of `iteratees`.
|
|
1406
1428
|
* @returns {Array} Returns the new sorted array.
|
|
1407
|
-
*/function baseOrderBy(collection,iteratees,orders){
|
|
1429
|
+
*/function baseOrderBy(collection,iteratees,orders){if(iteratees.length){iteratees=arrayMap(iteratees,function(iteratee){if(isArray(iteratee)){return function(value){return baseGet(value,iteratee.length===1?iteratee[0]:iteratee);};}return iteratee;});}else {iteratees=[identity];}var index=-1;iteratees=arrayMap(iteratees,baseUnary(getIteratee()));var result=baseMap(collection,function(value,key,collection){var criteria=arrayMap(iteratees,function(iteratee){return iteratee(value);});return {'criteria':criteria,'index':++index,'value':value};});return baseSortBy(result,function(object,other){return compareMultiple(object,other,orders);});}/**
|
|
1408
1430
|
* The base implementation of `_.pick` without support for individual
|
|
1409
1431
|
* property identifiers.
|
|
1410
1432
|
*
|
|
@@ -1500,7 +1522,7 @@ do{if(n%2){result+=string;}n=nativeFloor(n/2);if(n){string+=string;}}while(n);re
|
|
|
1500
1522
|
* @param {*} value The value to set.
|
|
1501
1523
|
* @param {Function} [customizer] The function to customize path creation.
|
|
1502
1524
|
* @returns {Object} Returns `object`.
|
|
1503
|
-
*/function baseSet(object,path,value,customizer){if(!isObject(object)){return object;}path=castPath(path,object);var index=-1,length=path.length,lastIndex=length-1,nested=object;while(nested!=null&&++index<length){var key=toKey(path[index]),newValue=value;if(index!=lastIndex){var objValue=nested[key];newValue=customizer?customizer(objValue,key,nested):undefined$1;if(newValue===undefined$1){newValue=isObject(objValue)?objValue:isIndex(path[index+1])?[]:{};}}assignValue(nested,key,newValue);nested=nested[key];}return object;}/**
|
|
1525
|
+
*/function baseSet(object,path,value,customizer){if(!isObject(object)){return object;}path=castPath(path,object);var index=-1,length=path.length,lastIndex=length-1,nested=object;while(nested!=null&&++index<length){var key=toKey(path[index]),newValue=value;if(key==='__proto__'||key==='constructor'||key==='prototype'){return object;}if(index!=lastIndex){var objValue=nested[key];newValue=customizer?customizer(objValue,key,nested):undefined$1;if(newValue===undefined$1){newValue=isObject(objValue)?objValue:isIndex(path[index+1])?[]:{};}}assignValue(nested,key,newValue);nested=nested[key];}return object;}/**
|
|
1504
1526
|
* The base implementation of `setData` without support for hot loop shorting.
|
|
1505
1527
|
*
|
|
1506
1528
|
* @private
|
|
@@ -1559,7 +1581,7 @@ do{if(n%2){result+=string;}n=nativeFloor(n/2);if(n){string+=string;}}while(n);re
|
|
|
1559
1581
|
* @param {boolean} [retHighest] Specify returning the highest qualified index.
|
|
1560
1582
|
* @returns {number} Returns the index at which `value` should be inserted
|
|
1561
1583
|
* into `array`.
|
|
1562
|
-
*/function baseSortedIndexBy(array,value,iteratee,retHighest){
|
|
1584
|
+
*/function baseSortedIndexBy(array,value,iteratee,retHighest){var low=0,high=array==null?0:array.length;if(high===0){return 0;}value=iteratee(value);var valIsNaN=value!==value,valIsNull=value===null,valIsSymbol=isSymbol(value),valIsUndefined=value===undefined$1;while(low<high){var mid=nativeFloor((low+high)/2),computed=iteratee(array[mid]),othIsDefined=computed!==undefined$1,othIsNull=computed===null,othIsReflexive=computed===computed,othIsSymbol=isSymbol(computed);if(valIsNaN){var setLow=retHighest||othIsReflexive;}else if(valIsUndefined){setLow=othIsReflexive&&(retHighest||othIsDefined);}else if(valIsNull){setLow=othIsReflexive&&othIsDefined&&(retHighest||!othIsNull);}else if(valIsSymbol){setLow=othIsReflexive&&othIsDefined&&!othIsNull&&(retHighest||!othIsSymbol);}else if(othIsNull||othIsSymbol){setLow=false;}else {setLow=retHighest?computed<=value:computed<value;}if(setLow){low=mid+1;}else {high=mid;}}return nativeMin(high,MAX_ARRAY_INDEX);}/**
|
|
1563
1585
|
* The base implementation of `_.sortedUniq` and `_.sortedUniqBy` without
|
|
1564
1586
|
* support for iteratee shorthands.
|
|
1565
1587
|
*
|
|
@@ -2053,8 +2075,8 @@ stack.set(srcValue,objValue);baseMerge(objValue,srcValue,undefined$1,customDefau
|
|
|
2053
2075
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
2054
2076
|
* @param {Object} stack Tracks traversed `array` and `other` objects.
|
|
2055
2077
|
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
|
2056
|
-
*/function equalArrays(array,other,bitmask,customizer,equalFunc,stack){var isPartial=bitmask&COMPARE_PARTIAL_FLAG,arrLength=array.length,othLength=other.length;if(arrLength!=othLength&&!(isPartial&&othLength>arrLength)){return false;}//
|
|
2057
|
-
var
|
|
2078
|
+
*/function equalArrays(array,other,bitmask,customizer,equalFunc,stack){var isPartial=bitmask&COMPARE_PARTIAL_FLAG,arrLength=array.length,othLength=other.length;if(arrLength!=othLength&&!(isPartial&&othLength>arrLength)){return false;}// Check that cyclic values are equal.
|
|
2079
|
+
var arrStacked=stack.get(array);var othStacked=stack.get(other);if(arrStacked&&othStacked){return arrStacked==other&&othStacked==array;}var index=-1,result=true,seen=bitmask&COMPARE_UNORDERED_FLAG?new SetCache():undefined$1;stack.set(array,other);stack.set(other,array);// Ignore non-index properties.
|
|
2058
2080
|
while(++index<arrLength){var arrValue=array[index],othValue=other[index];if(customizer){var compared=isPartial?customizer(othValue,arrValue,index,other,array,stack):customizer(arrValue,othValue,index,array,other,stack);}if(compared!==undefined$1){if(compared){continue;}result=false;break;}// Recursively compare arrays (susceptible to call stack limits).
|
|
2059
2081
|
if(seen){if(!arraySome(other,function(othValue,othIndex){if(!cacheHas(seen,othIndex)&&(arrValue===othValue||equalFunc(arrValue,othValue,bitmask,customizer,stack))){return seen.push(othIndex);}})){result=false;break;}}else if(!(arrValue===othValue||equalFunc(arrValue,othValue,bitmask,customizer,stack))){result=false;break;}}stack['delete'](array);stack['delete'](other);return result;}/**
|
|
2060
2082
|
* A specialized version of `baseIsEqualDeep` for comparing objects of
|
|
@@ -2091,8 +2113,8 @@ stack.set(object,other);var result=equalArrays(convert(object),convert(other),bi
|
|
|
2091
2113
|
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
2092
2114
|
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
|
2093
2115
|
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
2094
|
-
*/function equalObjects(object,other,bitmask,customizer,equalFunc,stack){var isPartial=bitmask&COMPARE_PARTIAL_FLAG,objProps=getAllKeys(object),objLength=objProps.length,othProps=getAllKeys(other),othLength=othProps.length;if(objLength!=othLength&&!isPartial){return false;}var index=objLength;while(index--){var key=objProps[index];if(!(isPartial?key in other:hasOwnProperty.call(other,key))){return false;}}//
|
|
2095
|
-
var
|
|
2116
|
+
*/function equalObjects(object,other,bitmask,customizer,equalFunc,stack){var isPartial=bitmask&COMPARE_PARTIAL_FLAG,objProps=getAllKeys(object),objLength=objProps.length,othProps=getAllKeys(other),othLength=othProps.length;if(objLength!=othLength&&!isPartial){return false;}var index=objLength;while(index--){var key=objProps[index];if(!(isPartial?key in other:hasOwnProperty.call(other,key))){return false;}}// Check that cyclic values are equal.
|
|
2117
|
+
var objStacked=stack.get(object);var othStacked=stack.get(other);if(objStacked&&othStacked){return objStacked==other&&othStacked==object;}var result=true;stack.set(object,other);stack.set(other,object);var skipCtor=isPartial;while(++index<objLength){key=objProps[index];var objValue=object[key],othValue=other[key];if(customizer){var compared=isPartial?customizer(othValue,objValue,key,other,object,stack):customizer(objValue,othValue,key,object,other,stack);}// Recursively compare objects (susceptible to call stack limits).
|
|
2096
2118
|
if(!(compared===undefined$1?objValue===othValue||equalFunc(objValue,othValue,bitmask,customizer,stack):compared)){result=false;break;}skipCtor||(skipCtor=key=='constructor');}if(result&&!skipCtor){var objCtor=object.constructor,othCtor=other.constructor;// Non `Object` object instances with different constructors are not equal.
|
|
2097
2119
|
if(objCtor!=othCtor&&'constructor'in object&&'constructor'in other&&!(typeof objCtor=='function'&&objCtor instanceof objCtor&&typeof othCtor=='function'&&othCtor instanceof othCtor)){result=false;}}stack['delete'](object);stack['delete'](other);return result;}/**
|
|
2098
2120
|
* A specialized version of `baseRest` which flattens the rest array.
|
|
@@ -4106,6 +4128,10 @@ data[0]=source[0];data[1]=newBitmask;return data;}/**
|
|
|
4106
4128
|
* // The `_.property` iteratee shorthand.
|
|
4107
4129
|
* _.filter(users, 'active');
|
|
4108
4130
|
* // => objects for ['barney']
|
|
4131
|
+
*
|
|
4132
|
+
* // Combining several predicates using `_.overEvery` or `_.overSome`.
|
|
4133
|
+
* _.filter(users, _.overSome([{ 'age': 36 }, ['age', 40]]));
|
|
4134
|
+
* // => objects for ['fred', 'barney']
|
|
4109
4135
|
*/function filter(collection,predicate){var func=isArray(collection)?arrayFilter:baseFilter;return func(collection,getIteratee(predicate,3));}/**
|
|
4110
4136
|
* Iterates over elements of `collection`, returning the first element
|
|
4111
4137
|
* `predicate` returns truthy for. The predicate is invoked with three
|
|
@@ -4680,15 +4706,15 @@ data[0]=source[0];data[1]=newBitmask;return data;}/**
|
|
|
4680
4706
|
* var users = [
|
|
4681
4707
|
* { 'user': 'fred', 'age': 48 },
|
|
4682
4708
|
* { 'user': 'barney', 'age': 36 },
|
|
4683
|
-
* { 'user': 'fred', 'age':
|
|
4709
|
+
* { 'user': 'fred', 'age': 30 },
|
|
4684
4710
|
* { 'user': 'barney', 'age': 34 }
|
|
4685
4711
|
* ];
|
|
4686
4712
|
*
|
|
4687
4713
|
* _.sortBy(users, [function(o) { return o.user; }]);
|
|
4688
|
-
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred',
|
|
4714
|
+
* // => objects for [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 30]]
|
|
4689
4715
|
*
|
|
4690
4716
|
* _.sortBy(users, ['user', 'age']);
|
|
4691
|
-
* // => objects for [['barney', 34], ['barney', 36], ['fred',
|
|
4717
|
+
* // => objects for [['barney', 34], ['barney', 36], ['fred', 30], ['fred', 48]]
|
|
4692
4718
|
*/var sortBy=baseRest(function(collection,iteratees){if(collection==null){return [];}var length=iteratees.length;if(length>1&&isIterateeCall(collection,iteratees[0],iteratees[1])){iteratees=[];}else if(length>2&&isIterateeCall(iteratees[0],iteratees[1],iteratees[2])){iteratees=[iteratees[0]];}return baseOrderBy(collection,baseFlatten(iteratees,1),[]);});/*------------------------------------------------------------------------*/ /**
|
|
4693
4719
|
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
4694
4720
|
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
@@ -6532,7 +6558,7 @@ return isNumber(value)&&value!=+value;}/**
|
|
|
6532
6558
|
*
|
|
6533
6559
|
* _.toNumber('3.2');
|
|
6534
6560
|
* // => 3.2
|
|
6535
|
-
*/function toNumber(value){if(typeof value=='number'){return value;}if(isSymbol(value)){return NAN;}if(isObject(value)){var other=typeof value.valueOf=='function'?value.valueOf():value;value=isObject(other)?other+'':other;}if(typeof value!='string'){return value===0?value:+value;}value=value
|
|
6561
|
+
*/function toNumber(value){if(typeof value=='number'){return value;}if(isSymbol(value)){return NAN;}if(isObject(value)){var other=typeof value.valueOf=='function'?value.valueOf():value;value=isObject(other)?other+'':other;}if(typeof value!='string'){return value===0?value:+value;}value=baseTrim(value);var isBinary=reIsBinary.test(value);return isBinary||reIsOctal.test(value)?freeParseInt(value.slice(2),isBinary?2:8):reIsBadHex.test(value)?NAN:+value;}/**
|
|
6536
6562
|
* Converts `value` to a plain object flattening inherited enumerable string
|
|
6537
6563
|
* keyed properties of `value` to own properties of the plain object.
|
|
6538
6564
|
*
|
|
@@ -8225,17 +8251,17 @@ if(!length){length=1;object=undefined$1;}while(++index<length){var value=object=
|
|
|
8225
8251
|
var settings=lodash.templateSettings;if(guard&&isIterateeCall(string,options,guard)){options=undefined$1;}string=toString(string);options=assignInWith({},options,settings,customDefaultsAssignIn);var imports=assignInWith({},options.imports,settings.imports,customDefaultsAssignIn),importsKeys=keys(imports),importsValues=baseValues(imports,importsKeys);var isEscaping,isEvaluating,index=0,interpolate=options.interpolate||reNoMatch,source="__p += '";// Compile the regexp to match each delimiter.
|
|
8226
8252
|
var reDelimiters=RegExp((options.escape||reNoMatch).source+'|'+interpolate.source+'|'+(interpolate===reInterpolate?reEsTemplate:reNoMatch).source+'|'+(options.evaluate||reNoMatch).source+'|$','g');// Use a sourceURL for easier debugging.
|
|
8227
8253
|
// The sourceURL gets injected into the source that's eval-ed, so be careful
|
|
8228
|
-
//
|
|
8229
|
-
//
|
|
8230
|
-
var sourceURL='//# sourceURL='+(hasOwnProperty.call(options,'sourceURL')?(options.sourceURL+'').replace(/
|
|
8254
|
+
// to normalize all kinds of whitespace, so e.g. newlines (and unicode versions of it) can't sneak in
|
|
8255
|
+
// and escape the comment, thus injecting code that gets evaled.
|
|
8256
|
+
var sourceURL='//# sourceURL='+(hasOwnProperty.call(options,'sourceURL')?(options.sourceURL+'').replace(/\s/g,' '):'lodash.templateSources['+ ++templateCounter+']')+'\n';string.replace(reDelimiters,function(match,escapeValue,interpolateValue,esTemplateValue,evaluateValue,offset){interpolateValue||(interpolateValue=esTemplateValue);// Escape characters that can't be included in string literals.
|
|
8231
8257
|
source+=string.slice(index,offset).replace(reUnescapedString,escapeStringChar);// Replace delimiters with snippets.
|
|
8232
8258
|
if(escapeValue){isEscaping=true;source+="' +\n__e("+escapeValue+") +\n'";}if(evaluateValue){isEvaluating=true;source+="';\n"+evaluateValue+";\n__p += '";}if(interpolateValue){source+="' +\n((__t = ("+interpolateValue+")) == null ? '' : __t) +\n'";}index=offset+match.length;// The JS engine embedded in Adobe products needs `match` returned in
|
|
8233
8259
|
// order to produce the correct `offset` value.
|
|
8234
8260
|
return match;});source+="';\n";// If `variable` is not specified wrap a with-statement around the generated
|
|
8235
8261
|
// code to add the data object to the top of the scope chain.
|
|
8236
|
-
//
|
|
8237
|
-
//
|
|
8238
|
-
|
|
8262
|
+
var variable=hasOwnProperty.call(options,'variable')&&options.variable;if(!variable){source='with (obj) {\n'+source+'\n}\n';}// Throw an error if a forbidden character was found in `variable`, to prevent
|
|
8263
|
+
// potential command injection attacks.
|
|
8264
|
+
else if(reForbiddenIdentifierChars.test(variable)){throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);}// Cleanup code by stripping empty strings.
|
|
8239
8265
|
source=(isEvaluating?source.replace(reEmptyStringLeading,''):source).replace(reEmptyStringMiddle,'$1').replace(reEmptyStringTrailing,'$1;');// Frame code as the function body.
|
|
8240
8266
|
source='function('+(variable||'obj')+') {\n'+(variable?'':'obj || (obj = {});\n')+"var __t, __p = ''"+(isEscaping?', __e = _.escape':'')+(isEvaluating?', __j = Array.prototype.join;\n'+"function print() { __p += __j.call(arguments, '') }\n":';\n')+source+'return __p\n}';var result=attempt(function(){return Function(importsKeys,sourceURL+'return '+source).apply(undefined$1,importsValues);});// Provide the compiled function's source by its `toString` method or
|
|
8241
8267
|
// the `source` property as a convenience for inlining compiled templates.
|
|
@@ -8300,7 +8326,7 @@ result.source=source;if(isError(result)){throw result;}return result;}/**
|
|
|
8300
8326
|
*
|
|
8301
8327
|
* _.map([' foo ', ' bar '], _.trim);
|
|
8302
8328
|
* // => ['foo', 'bar']
|
|
8303
|
-
*/function trim(string,chars,guard){string=toString(string);if(string&&(guard||chars===undefined$1)){return string
|
|
8329
|
+
*/function trim(string,chars,guard){string=toString(string);if(string&&(guard||chars===undefined$1)){return baseTrim(string);}if(!string||!(chars=baseToString(chars))){return string;}var strSymbols=stringToArray(string),chrSymbols=stringToArray(chars),start=charsStartIndex(strSymbols,chrSymbols),end=charsEndIndex(strSymbols,chrSymbols)+1;return castSlice(strSymbols,start,end).join('');}/**
|
|
8304
8330
|
* Removes trailing whitespace or specified characters from `string`.
|
|
8305
8331
|
*
|
|
8306
8332
|
* @static
|
|
@@ -8318,7 +8344,7 @@ result.source=source;if(isError(result)){throw result;}return result;}/**
|
|
|
8318
8344
|
*
|
|
8319
8345
|
* _.trimEnd('-_-abc-_-', '_-');
|
|
8320
8346
|
* // => '-_-abc'
|
|
8321
|
-
*/function trimEnd(string,chars,guard){string=toString(string);if(string&&(guard||chars===undefined$1)){return string.
|
|
8347
|
+
*/function trimEnd(string,chars,guard){string=toString(string);if(string&&(guard||chars===undefined$1)){return string.slice(0,trimmedEndIndex(string)+1);}if(!string||!(chars=baseToString(chars))){return string;}var strSymbols=stringToArray(string),end=charsEndIndex(strSymbols,stringToArray(chars))+1;return castSlice(strSymbols,0,end).join('');}/**
|
|
8322
8348
|
* Removes leading whitespace or specified characters from `string`.
|
|
8323
8349
|
*
|
|
8324
8350
|
* @static
|
|
@@ -8686,6 +8712,9 @@ result.source=source;if(isError(result)){throw result;}return result;}/**
|
|
|
8686
8712
|
* values against any array or object value, respectively. See `_.isEqual`
|
|
8687
8713
|
* for a list of supported value comparisons.
|
|
8688
8714
|
*
|
|
8715
|
+
* **Note:** Multiple values can be checked by combining several matchers
|
|
8716
|
+
* using `_.overSome`
|
|
8717
|
+
*
|
|
8689
8718
|
* @static
|
|
8690
8719
|
* @memberOf _
|
|
8691
8720
|
* @since 3.0.0
|
|
@@ -8701,6 +8730,10 @@ result.source=source;if(isError(result)){throw result;}return result;}/**
|
|
|
8701
8730
|
*
|
|
8702
8731
|
* _.filter(objects, _.matches({ 'a': 4, 'c': 6 }));
|
|
8703
8732
|
* // => [{ 'a': 4, 'b': 5, 'c': 6 }]
|
|
8733
|
+
*
|
|
8734
|
+
* // Checking for several possible values
|
|
8735
|
+
* _.filter(objects, _.overSome([_.matches({ 'a': 1 }), _.matches({ 'a': 4 })]));
|
|
8736
|
+
* // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
|
|
8704
8737
|
*/function matches(source){return baseMatches(baseClone(source,CLONE_DEEP_FLAG));}/**
|
|
8705
8738
|
* Creates a function that performs a partial deep comparison between the
|
|
8706
8739
|
* value at `path` of a given object to `srcValue`, returning `true` if the
|
|
@@ -8710,6 +8743,9 @@ result.source=source;if(isError(result)){throw result;}return result;}/**
|
|
|
8710
8743
|
* `srcValue` values against any array or object value, respectively. See
|
|
8711
8744
|
* `_.isEqual` for a list of supported value comparisons.
|
|
8712
8745
|
*
|
|
8746
|
+
* **Note:** Multiple values can be checked by combining several matchers
|
|
8747
|
+
* using `_.overSome`
|
|
8748
|
+
*
|
|
8713
8749
|
* @static
|
|
8714
8750
|
* @memberOf _
|
|
8715
8751
|
* @since 3.2.0
|
|
@@ -8726,6 +8762,10 @@ result.source=source;if(isError(result)){throw result;}return result;}/**
|
|
|
8726
8762
|
*
|
|
8727
8763
|
* _.find(objects, _.matchesProperty('a', 4));
|
|
8728
8764
|
* // => { 'a': 4, 'b': 5, 'c': 6 }
|
|
8765
|
+
*
|
|
8766
|
+
* // Checking for several possible values
|
|
8767
|
+
* _.filter(objects, _.overSome([_.matchesProperty('a', 1), _.matchesProperty('a', 4)]));
|
|
8768
|
+
* // => [{ 'a': 1, 'b': 2, 'c': 3 }, { 'a': 4, 'b': 5, 'c': 6 }]
|
|
8729
8769
|
*/function matchesProperty(path,srcValue){return baseMatchesProperty(path,baseClone(srcValue,CLONE_DEEP_FLAG));}/**
|
|
8730
8770
|
* Creates a function that invokes the method at `path` of a given object.
|
|
8731
8771
|
* Any additional arguments are provided to the invoked method.
|
|
@@ -8870,6 +8910,10 @@ result.source=source;if(isError(result)){throw result;}return result;}/**
|
|
|
8870
8910
|
* Creates a function that checks if **all** of the `predicates` return
|
|
8871
8911
|
* truthy when invoked with the arguments it receives.
|
|
8872
8912
|
*
|
|
8913
|
+
* Following shorthands are possible for providing predicates.
|
|
8914
|
+
* Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
|
|
8915
|
+
* Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
|
|
8916
|
+
*
|
|
8873
8917
|
* @static
|
|
8874
8918
|
* @memberOf _
|
|
8875
8919
|
* @since 4.0.0
|
|
@@ -8893,6 +8937,10 @@ result.source=source;if(isError(result)){throw result;}return result;}/**
|
|
|
8893
8937
|
* Creates a function that checks if **any** of the `predicates` return
|
|
8894
8938
|
* truthy when invoked with the arguments it receives.
|
|
8895
8939
|
*
|
|
8940
|
+
* Following shorthands are possible for providing predicates.
|
|
8941
|
+
* Pass an `Object` and it will be used as an parameter for `_.matches` to create the predicate.
|
|
8942
|
+
* Pass an `Array` of parameters for `_.matchesProperty` and the predicate will be created using them.
|
|
8943
|
+
*
|
|
8896
8944
|
* @static
|
|
8897
8945
|
* @memberOf _
|
|
8898
8946
|
* @since 4.0.0
|
|
@@ -8912,6 +8960,9 @@ result.source=source;if(isError(result)){throw result;}return result;}/**
|
|
|
8912
8960
|
*
|
|
8913
8961
|
* func(NaN);
|
|
8914
8962
|
* // => false
|
|
8963
|
+
*
|
|
8964
|
+
* var matchesFunc = _.overSome([{ 'a': 1 }, { 'a': 2 }])
|
|
8965
|
+
* var matchesPropertyFunc = _.overSome([['a', 1], ['a', 2]])
|
|
8915
8966
|
*/var overSome=createOver(arraySome);/**
|
|
8916
8967
|
* Creates a function that returns the value at `path` of a given object.
|
|
8917
8968
|
*
|
|
@@ -16164,6 +16215,43 @@ function joinNonEmpty(maybeStrings, separator) {
|
|
|
16164
16215
|
return maybeStrings.filter(Boolean).join(separator);
|
|
16165
16216
|
}
|
|
16166
16217
|
|
|
16218
|
+
function hashCode(string) {
|
|
16219
|
+
let hash = 0;
|
|
16220
|
+
// eslint-disable-next-line no-plusplus
|
|
16221
|
+
for (let i = 0; i < string.length; i++) {
|
|
16222
|
+
// eslint-disable-next-line no-bitwise
|
|
16223
|
+
hash = string.charCodeAt(i) + ((hash << 5) - hash);
|
|
16224
|
+
}
|
|
16225
|
+
return hash;
|
|
16226
|
+
}
|
|
16227
|
+
function hashToHslaColor(hash, opacity) {
|
|
16228
|
+
const h = range(hash, 0, 360);
|
|
16229
|
+
const s = range(hash, 50, 100);
|
|
16230
|
+
const l = range(hash, 20, 50);
|
|
16231
|
+
const a = opacity.toString();
|
|
16232
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/hsl#values
|
|
16233
|
+
return `hsla(${h}, ${s}%, ${l}%, ${a})`;
|
|
16234
|
+
}
|
|
16235
|
+
function range(hash, min, max) {
|
|
16236
|
+
const diff = max - min;
|
|
16237
|
+
const x = ((hash % diff) + diff) % diff;
|
|
16238
|
+
return x + min;
|
|
16239
|
+
}
|
|
16240
|
+
/**
|
|
16241
|
+
* Provides a hsla color value for use in CSS, based on the contents of the given string.
|
|
16242
|
+
*
|
|
16243
|
+
* See https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/hsl.
|
|
16244
|
+
*
|
|
16245
|
+
* @example stringToHslaColor('test') becomes 'hsla(58, 98%, 48%, 1)' (yellow)
|
|
16246
|
+
*
|
|
16247
|
+
* This function tries to provide a good spread of colors for different inputs.
|
|
16248
|
+
* However, it does not guarantee uniqueness - think of it like hashing.
|
|
16249
|
+
* It is pure, meaning that the result is only dependent on the inputs.
|
|
16250
|
+
*/
|
|
16251
|
+
function stringToHslaColor(string, { opacity = 1 } = {}) {
|
|
16252
|
+
return hashToHslaColor(hashCode(string), opacity);
|
|
16253
|
+
}
|
|
16254
|
+
|
|
16167
16255
|
/**
|
|
16168
16256
|
* Converts pixel value to number.
|
|
16169
16257
|
*
|
|
@@ -16261,6 +16349,7 @@ exports.pxToNumber = pxToNumber;
|
|
|
16261
16349
|
exports.round = round;
|
|
16262
16350
|
exports.soleItem = soleItem;
|
|
16263
16351
|
exports.sortByArray = sortByArray;
|
|
16352
|
+
exports.stringToHslaColor = stringToHslaColor;
|
|
16264
16353
|
exports.toggleElement = toggleElement;
|
|
16265
16354
|
exports.withoutIndex = withoutIndex;
|
|
16266
16355
|
//# sourceMappingURL=index.common.js.map
|