@kineviz/lodash 4.17.21 → 4.17.23
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/LICENSE +47 -47
- package/README.md +39 -39
- package/_DataView.js +7 -7
- package/_Hash.js +32 -32
- package/_LazyWrapper.js +28 -28
- package/_ListCache.js +32 -32
- package/_LodashWrapper.js +22 -22
- package/_Map.js +7 -7
- package/_MapCache.js +32 -32
- package/_Promise.js +7 -7
- package/_Set.js +7 -7
- package/_SetCache.js +27 -27
- package/_Stack.js +27 -27
- package/_Symbol.js +6 -6
- package/_Uint8Array.js +6 -6
- package/_WeakMap.js +7 -7
- package/_apply.js +21 -21
- package/_arrayAggregator.js +22 -22
- package/_arrayEach.js +22 -22
- package/_arrayEachRight.js +21 -21
- package/_arrayEvery.js +23 -23
- package/_arrayFilter.js +25 -25
- package/_arrayIncludes.js +17 -17
- package/_arrayIncludesWith.js +22 -22
- package/_arrayLikeKeys.js +49 -49
- package/_arrayMap.js +21 -21
- package/_arrayPush.js +20 -20
- package/_arrayReduce.js +26 -26
- package/_arrayReduceRight.js +24 -24
- package/_arraySample.js +15 -15
- package/_arraySampleSize.js +17 -17
- package/_arrayShuffle.js +15 -15
- package/_arraySome.js +23 -23
- package/_asciiSize.js +12 -12
- package/_asciiToArray.js +12 -12
- package/_asciiWords.js +15 -15
- package/_assignMergeValue.js +20 -20
- package/_assignValue.js +28 -28
- package/_assocIndexOf.js +21 -21
- package/_baseAggregator.js +21 -21
- package/_baseAssign.js +17 -17
- package/_baseAssignIn.js +17 -17
- package/_baseAssignValue.js +25 -25
- package/_baseAt.js +23 -23
- package/_baseClamp.js +22 -22
- package/_baseClone.js +166 -166
- package/_baseConforms.js +18 -18
- package/_baseConformsTo.js +27 -27
- package/_baseCreate.js +30 -30
- package/_baseDelay.js +21 -21
- package/_baseDifference.js +67 -67
- package/_baseEach.js +14 -14
- package/_baseEachRight.js +14 -14
- package/_baseEvery.js +21 -21
- package/_baseExtremum.js +32 -32
- package/_baseFill.js +32 -32
- package/_baseFilter.js +21 -21
- package/_baseFindIndex.js +24 -24
- package/_baseFindKey.js +23 -23
- package/_baseFlatten.js +38 -38
- package/_baseFor.js +16 -16
- package/_baseForOwn.js +16 -16
- package/_baseForOwnRight.js +16 -16
- package/_baseForRight.js +15 -15
- package/_baseFunctions.js +19 -19
- package/_baseGet.js +24 -24
- package/_baseGetAllKeys.js +20 -20
- package/_baseGetTag.js +28 -28
- package/_baseGt.js +14 -14
- package/_baseHas.js +19 -19
- package/_baseHasIn.js +13 -13
- package/_baseInRange.js +18 -18
- package/_baseIndexOf.js +20 -20
- package/_baseIndexOfWith.js +23 -23
- package/_baseIntersection.js +74 -74
- package/_baseInverter.js +21 -21
- package/_baseInvoke.js +24 -24
- package/_baseIsArguments.js +18 -18
- package/_baseIsArrayBuffer.js +17 -17
- package/_baseIsDate.js +18 -18
- package/_baseIsEqual.js +28 -28
- package/_baseIsEqualDeep.js +83 -83
- package/_baseIsMap.js +18 -18
- package/_baseIsMatch.js +62 -62
- package/_baseIsNaN.js +12 -12
- package/_baseIsNative.js +47 -47
- package/_baseIsRegExp.js +18 -18
- package/_baseIsSet.js +18 -18
- package/_baseIsTypedArray.js +60 -60
- package/_baseIteratee.js +31 -31
- package/_baseKeys.js +30 -30
- package/_baseKeysIn.js +33 -33
- package/_baseLodash.js +10 -10
- package/_baseLt.js +14 -14
- package/_baseMap.js +22 -22
- package/_baseMatches.js +22 -22
- package/_baseMatchesProperty.js +33 -33
- package/_baseMean.js +20 -20
- package/_baseMerge.js +42 -42
- package/_baseMergeDeep.js +94 -94
- package/_baseNth.js +20 -20
- package/_baseOrderBy.js +49 -49
- package/_basePick.js +19 -19
- package/_basePickBy.js +30 -30
- package/_baseProperty.js +14 -14
- package/_basePropertyDeep.js +16 -16
- package/_basePropertyOf.js +14 -14
- package/_basePullAll.js +51 -51
- package/_basePullAt.js +37 -37
- package/_baseRandom.js +18 -18
- package/_baseRange.js +28 -28
- package/_baseReduce.js +23 -23
- package/_baseRepeat.js +35 -35
- package/_baseRest.js +17 -17
- package/_baseSample.js +15 -15
- package/_baseSampleSize.js +18 -18
- package/_baseSet.js +51 -51
- package/_baseSetData.js +17 -17
- package/_baseSetToString.js +22 -22
- package/_baseShuffle.js +15 -15
- package/_baseSlice.js +31 -31
- package/_baseSome.js +22 -22
- package/_baseSortBy.js +21 -21
- package/_baseSortedIndex.js +42 -42
- package/_baseSortedIndexBy.js +67 -67
- package/_baseSortedUniq.js +30 -30
- package/_baseSum.js +24 -24
- package/_baseTimes.js +20 -20
- package/_baseToNumber.js +24 -24
- package/_baseToPairs.js +18 -18
- package/_baseToString.js +37 -37
- package/_baseTrim.js +19 -19
- package/_baseUnary.js +14 -14
- package/_baseUniq.js +72 -72
- package/_baseUnset.js +65 -20
- package/_baseUpdate.js +18 -18
- package/_baseValues.js +19 -19
- package/_baseWhile.js +26 -26
- package/_baseWrapperValue.js +25 -25
- package/_baseXor.js +36 -36
- package/_baseZipObject.js +23 -23
- package/_cacheHas.js +13 -13
- package/_castArrayLikeObject.js +14 -14
- package/_castFunction.js +14 -14
- package/_castPath.js +21 -21
- package/_castRest.js +14 -14
- package/_castSlice.js +18 -18
- package/_charsEndIndex.js +19 -19
- package/_charsStartIndex.js +20 -20
- package/_cloneArrayBuffer.js +16 -16
- package/_cloneBuffer.js +35 -35
- package/_cloneDataView.js +16 -16
- package/_cloneRegExp.js +17 -17
- package/_cloneSymbol.js +18 -18
- package/_cloneTypedArray.js +16 -16
- package/_compareAscending.js +41 -41
- package/_compareMultiple.js +44 -44
- package/_composeArgs.js +39 -39
- package/_composeArgsRight.js +41 -41
- package/_copyArray.js +20 -20
- package/_copyObject.js +40 -40
- package/_copySymbols.js +16 -16
- package/_copySymbolsIn.js +16 -16
- package/_coreJsData.js +6 -6
- package/_countHolders.js +21 -21
- package/_createAggregator.js +23 -23
- package/_createAssigner.js +37 -37
- package/_createBaseEach.js +32 -32
- package/_createBaseFor.js +25 -25
- package/_createBind.js +28 -28
- package/_createCaseFirst.js +33 -33
- package/_createCompounder.js +24 -24
- package/_createCtor.js +37 -37
- package/_createCurry.js +46 -46
- package/_createFind.js +25 -25
- package/_createFlow.js +78 -78
- package/_createHybrid.js +92 -92
- package/_createInverter.js +17 -17
- package/_createMathOperation.js +38 -38
- package/_createOver.js +27 -27
- package/_createPadding.js +33 -33
- package/_createPartial.js +43 -43
- package/_createRange.js +30 -30
- package/_createRecurry.js +56 -56
- package/_createRelationalOperation.js +20 -20
- package/_createRound.js +35 -35
- package/_createSet.js +19 -19
- package/_createToPairs.js +30 -30
- package/_createWrap.js +106 -106
- package/_customDefaultsAssignIn.js +29 -29
- package/_customDefaultsMerge.js +28 -28
- package/_customOmitClone.js +16 -16
- package/_deburrLetter.js +71 -71
- package/_defineProperty.js +11 -11
- package/_equalArrays.js +84 -84
- package/_equalByTag.js +112 -112
- package/_equalObjects.js +90 -90
- package/_escapeHtmlChar.js +21 -21
- package/_escapeStringChar.js +22 -22
- package/_flatRest.js +16 -16
- package/_freeGlobal.js +4 -4
- package/_getAllKeys.js +16 -16
- package/_getAllKeysIn.js +17 -17
- package/_getData.js +15 -15
- package/_getFuncName.js +31 -31
- package/_getHolder.js +13 -13
- package/_getMapData.js +18 -18
- package/_getMatchData.js +24 -24
- package/_getNative.js +17 -17
- package/_getPrototype.js +6 -6
- package/_getRawTag.js +46 -46
- package/_getSymbols.js +30 -30
- package/_getSymbolsIn.js +25 -25
- package/_getTag.js +58 -58
- package/_getValue.js +13 -13
- package/_getView.js +33 -33
- package/_getWrapDetails.js +17 -17
- package/_hasPath.js +39 -39
- package/_hasUnicode.js +26 -26
- package/_hasUnicodeWord.js +15 -15
- package/_hashClear.js +15 -15
- package/_hashDelete.js +17 -17
- package/_hashGet.js +30 -30
- package/_hashHas.js +23 -23
- package/_hashSet.js +23 -23
- package/_initCloneArray.js +26 -26
- package/_initCloneByTag.js +77 -77
- package/_initCloneObject.js +18 -18
- package/_insertWrapDetails.js +23 -23
- package/_isFlattenable.js +20 -20
- package/_isIndex.js +25 -25
- package/_isIterateeCall.js +30 -30
- package/_isKey.js +29 -29
- package/_isKeyable.js +15 -15
- package/_isLaziable.js +28 -28
- package/_isMaskable.js +14 -14
- package/_isMasked.js +20 -20
- package/_isPrototype.js +18 -18
- package/_isStrictComparable.js +15 -15
- package/_iteratorToArray.js +18 -18
- package/_lazyClone.js +23 -23
- package/_lazyReverse.js +23 -23
- package/_lazyValue.js +69 -69
- package/_listCacheClear.js +13 -13
- package/_listCacheDelete.js +35 -35
- package/_listCacheGet.js +19 -19
- package/_listCacheHas.js +16 -16
- package/_listCacheSet.js +26 -26
- package/_mapCacheClear.js +21 -21
- package/_mapCacheDelete.js +18 -18
- package/_mapCacheGet.js +16 -16
- package/_mapCacheHas.js +16 -16
- package/_mapCacheSet.js +22 -22
- package/_mapToArray.js +18 -18
- package/_matchesStrictComparable.js +20 -20
- package/_memoizeCapped.js +26 -26
- package/_mergeData.js +90 -90
- package/_metaMap.js +6 -6
- package/_nativeCreate.js +6 -6
- package/_nativeKeys.js +6 -6
- package/_nativeKeysIn.js +20 -20
- package/_nodeUtil.js +30 -30
- package/_objectToString.js +22 -22
- package/_overArg.js +15 -15
- package/_overRest.js +36 -36
- package/_parent.js +16 -16
- package/_reEscape.js +4 -4
- package/_reEvaluate.js +4 -4
- package/_reInterpolate.js +4 -4
- package/_realNames.js +4 -4
- package/_reorder.js +29 -29
- package/_replaceHolders.js +29 -29
- package/_root.js +9 -9
- package/_safeGet.js +21 -21
- package/_setCacheAdd.js +19 -19
- package/_setCacheHas.js +14 -14
- package/_setData.js +20 -20
- package/_setToArray.js +18 -18
- package/_setToPairs.js +18 -18
- package/_setToString.js +14 -14
- package/_setWrapToString.js +21 -21
- package/_shortOut.js +37 -37
- package/_shuffleSelf.js +28 -28
- package/_stackClear.js +15 -15
- package/_stackDelete.js +18 -18
- package/_stackGet.js +14 -14
- package/_stackHas.js +14 -14
- package/_stackSet.js +34 -34
- package/_strictIndexOf.js +23 -23
- package/_strictLastIndexOf.js +21 -21
- package/_stringSize.js +18 -18
- package/_stringToArray.js +18 -18
- package/_stringToPath.js +27 -27
- package/_toKey.js +21 -21
- package/_toSource.js +26 -26
- package/_trimmedEndIndex.js +19 -19
- package/_unescapeHtmlChar.js +21 -21
- package/_unicodeSize.js +44 -44
- package/_unicodeToArray.js +40 -40
- package/_unicodeWords.js +69 -69
- package/_updateWrapDetails.js +46 -46
- package/_wrapperClone.js +23 -23
- package/add.js +22 -22
- package/after.js +42 -42
- package/array.js +67 -67
- package/ary.js +29 -29
- package/assign.js +58 -58
- package/assignIn.js +40 -40
- package/assignInWith.js +38 -38
- package/assignWith.js +37 -37
- package/at.js +23 -23
- package/attempt.js +35 -35
- package/before.js +40 -40
- package/bind.js +57 -57
- package/bindAll.js +41 -41
- package/bindKey.js +68 -68
- package/camelCase.js +29 -29
- package/capitalize.js +23 -23
- package/castArray.js +44 -44
- package/ceil.js +26 -26
- package/chain.js +38 -38
- package/chunk.js +50 -50
- package/clamp.js +39 -39
- package/clone.js +36 -36
- package/cloneDeep.js +29 -29
- package/cloneDeepWith.js +40 -40
- package/cloneWith.js +42 -42
- package/collection.js +30 -30
- package/commit.js +33 -33
- package/compact.js +31 -31
- package/concat.js +43 -43
- package/cond.js +60 -60
- package/conforms.js +35 -35
- package/conformsTo.js +32 -32
- package/constant.js +26 -26
- package/core.js +3877 -3877
- package/core.min.js +6 -25
- package/countBy.js +40 -40
- package/create.js +43 -43
- package/curry.js +57 -57
- package/curryRight.js +54 -54
- package/date.js +3 -3
- package/debounce.js +191 -191
- package/deburr.js +45 -45
- package/defaultTo.js +25 -25
- package/defaults.js +64 -64
- package/defaultsDeep.js +30 -30
- package/defer.js +26 -26
- package/delay.js +28 -28
- package/difference.js +33 -33
- package/differenceBy.js +44 -44
- package/differenceWith.js +40 -40
- package/divide.js +22 -22
- package/drop.js +38 -38
- package/dropRight.js +39 -39
- package/dropRightWhile.js +45 -45
- package/dropWhile.js +45 -45
- package/each.js +1 -1
- package/eachRight.js +1 -1
- package/endsWith.js +43 -43
- package/entries.js +1 -1
- package/entriesIn.js +1 -1
- package/eq.js +37 -37
- package/escape.js +43 -43
- package/escapeRegExp.js +32 -32
- package/every.js +56 -56
- package/extend.js +1 -1
- package/extendWith.js +1 -1
- package/fill.js +45 -45
- package/filter.js +52 -52
- package/find.js +42 -42
- package/findIndex.js +55 -55
- package/findKey.js +44 -44
- package/findLast.js +25 -25
- package/findLastIndex.js +59 -59
- package/findLastKey.js +44 -44
- package/first.js +1 -1
- package/flatMap.js +29 -29
- package/flatMapDeep.js +31 -31
- package/flatMapDepth.js +31 -31
- package/flatten.js +22 -22
- package/flattenDeep.js +25 -25
- package/flattenDepth.js +33 -33
- package/flip.js +28 -28
- package/floor.js +26 -26
- package/flow.js +27 -27
- package/flowRight.js +26 -26
- package/forEach.js +41 -41
- package/forEachRight.js +31 -31
- package/forIn.js +39 -39
- package/forInRight.js +37 -37
- package/forOwn.js +36 -36
- package/forOwnRight.js +34 -34
- package/fp/F.js +1 -1
- package/fp/T.js +1 -1
- package/fp/__.js +1 -1
- package/fp/_baseConvert.js +569 -569
- package/fp/_convertBrowser.js +18 -18
- package/fp/_falseOptions.js +7 -7
- package/fp/_mapping.js +358 -358
- package/fp/_util.js +16 -16
- package/fp/add.js +5 -5
- package/fp/after.js +5 -5
- package/fp/all.js +1 -1
- package/fp/allPass.js +1 -1
- package/fp/always.js +1 -1
- package/fp/any.js +1 -1
- package/fp/anyPass.js +1 -1
- package/fp/apply.js +1 -1
- package/fp/array.js +2 -2
- package/fp/ary.js +5 -5
- package/fp/assign.js +5 -5
- package/fp/assignAll.js +5 -5
- package/fp/assignAllWith.js +5 -5
- package/fp/assignIn.js +5 -5
- package/fp/assignInAll.js +5 -5
- package/fp/assignInAllWith.js +5 -5
- package/fp/assignInWith.js +5 -5
- package/fp/assignWith.js +5 -5
- package/fp/assoc.js +1 -1
- package/fp/assocPath.js +1 -1
- package/fp/at.js +5 -5
- package/fp/attempt.js +5 -5
- package/fp/before.js +5 -5
- package/fp/bind.js +5 -5
- package/fp/bindAll.js +5 -5
- package/fp/bindKey.js +5 -5
- package/fp/camelCase.js +5 -5
- package/fp/capitalize.js +5 -5
- package/fp/castArray.js +5 -5
- package/fp/ceil.js +5 -5
- package/fp/chain.js +5 -5
- package/fp/chunk.js +5 -5
- package/fp/clamp.js +5 -5
- package/fp/clone.js +5 -5
- package/fp/cloneDeep.js +5 -5
- package/fp/cloneDeepWith.js +5 -5
- package/fp/cloneWith.js +5 -5
- package/fp/collection.js +2 -2
- package/fp/commit.js +5 -5
- package/fp/compact.js +5 -5
- package/fp/complement.js +1 -1
- package/fp/compose.js +1 -1
- package/fp/concat.js +5 -5
- package/fp/cond.js +5 -5
- package/fp/conforms.js +1 -1
- package/fp/conformsTo.js +5 -5
- package/fp/constant.js +5 -5
- package/fp/contains.js +1 -1
- package/fp/convert.js +18 -18
- package/fp/countBy.js +5 -5
- package/fp/create.js +5 -5
- package/fp/curry.js +5 -5
- package/fp/curryN.js +5 -5
- package/fp/curryRight.js +5 -5
- package/fp/curryRightN.js +5 -5
- package/fp/date.js +2 -2
- package/fp/debounce.js +5 -5
- package/fp/deburr.js +5 -5
- package/fp/defaultTo.js +5 -5
- package/fp/defaults.js +5 -5
- package/fp/defaultsAll.js +5 -5
- package/fp/defaultsDeep.js +5 -5
- package/fp/defaultsDeepAll.js +5 -5
- package/fp/defer.js +5 -5
- package/fp/delay.js +5 -5
- package/fp/difference.js +5 -5
- package/fp/differenceBy.js +5 -5
- package/fp/differenceWith.js +5 -5
- package/fp/dissoc.js +1 -1
- package/fp/dissocPath.js +1 -1
- package/fp/divide.js +5 -5
- package/fp/drop.js +5 -5
- package/fp/dropLast.js +1 -1
- package/fp/dropLastWhile.js +1 -1
- package/fp/dropRight.js +5 -5
- package/fp/dropRightWhile.js +5 -5
- package/fp/dropWhile.js +5 -5
- package/fp/each.js +1 -1
- package/fp/eachRight.js +1 -1
- package/fp/endsWith.js +5 -5
- package/fp/entries.js +1 -1
- package/fp/entriesIn.js +1 -1
- package/fp/eq.js +5 -5
- package/fp/equals.js +1 -1
- package/fp/escape.js +5 -5
- package/fp/escapeRegExp.js +5 -5
- package/fp/every.js +5 -5
- package/fp/extend.js +1 -1
- package/fp/extendAll.js +1 -1
- package/fp/extendAllWith.js +1 -1
- package/fp/extendWith.js +1 -1
- package/fp/fill.js +5 -5
- package/fp/filter.js +5 -5
- package/fp/find.js +5 -5
- package/fp/findFrom.js +5 -5
- package/fp/findIndex.js +5 -5
- package/fp/findIndexFrom.js +5 -5
- package/fp/findKey.js +5 -5
- package/fp/findLast.js +5 -5
- package/fp/findLastFrom.js +5 -5
- package/fp/findLastIndex.js +5 -5
- package/fp/findLastIndexFrom.js +5 -5
- package/fp/findLastKey.js +5 -5
- package/fp/first.js +1 -1
- package/fp/flatMap.js +5 -5
- package/fp/flatMapDeep.js +5 -5
- package/fp/flatMapDepth.js +5 -5
- package/fp/flatten.js +5 -5
- package/fp/flattenDeep.js +5 -5
- package/fp/flattenDepth.js +5 -5
- package/fp/flip.js +5 -5
- package/fp/floor.js +5 -5
- package/fp/flow.js +5 -5
- package/fp/flowRight.js +5 -5
- package/fp/forEach.js +5 -5
- package/fp/forEachRight.js +5 -5
- package/fp/forIn.js +5 -5
- package/fp/forInRight.js +5 -5
- package/fp/forOwn.js +5 -5
- package/fp/forOwnRight.js +5 -5
- package/fp/fromPairs.js +5 -5
- package/fp/function.js +2 -2
- package/fp/functions.js +5 -5
- package/fp/functionsIn.js +5 -5
- package/fp/get.js +5 -5
- package/fp/getOr.js +5 -5
- package/fp/groupBy.js +5 -5
- package/fp/gt.js +5 -5
- package/fp/gte.js +5 -5
- package/fp/has.js +5 -5
- package/fp/hasIn.js +5 -5
- package/fp/head.js +5 -5
- package/fp/identical.js +1 -1
- package/fp/identity.js +5 -5
- package/fp/inRange.js +5 -5
- package/fp/includes.js +5 -5
- package/fp/includesFrom.js +5 -5
- package/fp/indexBy.js +1 -1
- package/fp/indexOf.js +5 -5
- package/fp/indexOfFrom.js +5 -5
- package/fp/init.js +1 -1
- package/fp/initial.js +5 -5
- package/fp/intersection.js +5 -5
- package/fp/intersectionBy.js +5 -5
- package/fp/intersectionWith.js +5 -5
- package/fp/invert.js +5 -5
- package/fp/invertBy.js +5 -5
- package/fp/invertObj.js +1 -1
- package/fp/invoke.js +5 -5
- package/fp/invokeArgs.js +5 -5
- package/fp/invokeArgsMap.js +5 -5
- package/fp/invokeMap.js +5 -5
- package/fp/isArguments.js +5 -5
- package/fp/isArray.js +5 -5
- package/fp/isArrayBuffer.js +5 -5
- package/fp/isArrayLike.js +5 -5
- package/fp/isArrayLikeObject.js +5 -5
- package/fp/isBoolean.js +5 -5
- package/fp/isBuffer.js +5 -5
- package/fp/isDate.js +5 -5
- package/fp/isElement.js +5 -5
- package/fp/isEmpty.js +5 -5
- package/fp/isEqual.js +5 -5
- package/fp/isEqualWith.js +5 -5
- package/fp/isError.js +5 -5
- package/fp/isFinite.js +5 -5
- package/fp/isFunction.js +5 -5
- package/fp/isInteger.js +5 -5
- package/fp/isLength.js +5 -5
- package/fp/isMap.js +5 -5
- package/fp/isMatch.js +5 -5
- package/fp/isMatchWith.js +5 -5
- package/fp/isNaN.js +5 -5
- package/fp/isNative.js +5 -5
- package/fp/isNil.js +5 -5
- package/fp/isNull.js +5 -5
- package/fp/isNumber.js +5 -5
- package/fp/isObject.js +5 -5
- package/fp/isObjectLike.js +5 -5
- package/fp/isPlainObject.js +5 -5
- package/fp/isRegExp.js +5 -5
- package/fp/isSafeInteger.js +5 -5
- package/fp/isSet.js +5 -5
- package/fp/isString.js +5 -5
- package/fp/isSymbol.js +5 -5
- package/fp/isTypedArray.js +5 -5
- package/fp/isUndefined.js +5 -5
- package/fp/isWeakMap.js +5 -5
- package/fp/isWeakSet.js +5 -5
- package/fp/iteratee.js +5 -5
- package/fp/join.js +5 -5
- package/fp/juxt.js +1 -1
- package/fp/kebabCase.js +5 -5
- package/fp/keyBy.js +5 -5
- package/fp/keys.js +5 -5
- package/fp/keysIn.js +5 -5
- package/fp/lang.js +2 -2
- package/fp/last.js +5 -5
- package/fp/lastIndexOf.js +5 -5
- package/fp/lastIndexOfFrom.js +5 -5
- package/fp/lowerCase.js +5 -5
- package/fp/lowerFirst.js +5 -5
- package/fp/lt.js +5 -5
- package/fp/lte.js +5 -5
- package/fp/map.js +5 -5
- package/fp/mapKeys.js +5 -5
- package/fp/mapValues.js +5 -5
- package/fp/matches.js +1 -1
- package/fp/matchesProperty.js +5 -5
- package/fp/math.js +2 -2
- package/fp/max.js +5 -5
- package/fp/maxBy.js +5 -5
- package/fp/mean.js +5 -5
- package/fp/meanBy.js +5 -5
- package/fp/memoize.js +5 -5
- package/fp/merge.js +5 -5
- package/fp/mergeAll.js +5 -5
- package/fp/mergeAllWith.js +5 -5
- package/fp/mergeWith.js +5 -5
- package/fp/method.js +5 -5
- package/fp/methodOf.js +5 -5
- package/fp/min.js +5 -5
- package/fp/minBy.js +5 -5
- package/fp/mixin.js +5 -5
- package/fp/multiply.js +5 -5
- package/fp/nAry.js +1 -1
- package/fp/negate.js +5 -5
- package/fp/next.js +5 -5
- package/fp/noop.js +5 -5
- package/fp/now.js +5 -5
- package/fp/nth.js +5 -5
- package/fp/nthArg.js +5 -5
- package/fp/number.js +2 -2
- package/fp/object.js +2 -2
- package/fp/omit.js +5 -5
- package/fp/omitAll.js +1 -1
- package/fp/omitBy.js +5 -5
- package/fp/once.js +5 -5
- package/fp/orderBy.js +5 -5
- package/fp/over.js +5 -5
- package/fp/overArgs.js +5 -5
- package/fp/overEvery.js +5 -5
- package/fp/overSome.js +5 -5
- package/fp/pad.js +5 -5
- package/fp/padChars.js +5 -5
- package/fp/padCharsEnd.js +5 -5
- package/fp/padCharsStart.js +5 -5
- package/fp/padEnd.js +5 -5
- package/fp/padStart.js +5 -5
- package/fp/parseInt.js +5 -5
- package/fp/partial.js +5 -5
- package/fp/partialRight.js +5 -5
- package/fp/partition.js +5 -5
- package/fp/path.js +1 -1
- package/fp/pathEq.js +1 -1
- package/fp/pathOr.js +1 -1
- package/fp/paths.js +1 -1
- package/fp/pick.js +5 -5
- package/fp/pickAll.js +1 -1
- package/fp/pickBy.js +5 -5
- package/fp/pipe.js +1 -1
- package/fp/placeholder.js +6 -6
- package/fp/plant.js +5 -5
- package/fp/pluck.js +1 -1
- package/fp/prop.js +1 -1
- package/fp/propEq.js +1 -1
- package/fp/propOr.js +1 -1
- package/fp/property.js +1 -1
- package/fp/propertyOf.js +5 -5
- package/fp/props.js +1 -1
- package/fp/pull.js +5 -5
- package/fp/pullAll.js +5 -5
- package/fp/pullAllBy.js +5 -5
- package/fp/pullAllWith.js +5 -5
- package/fp/pullAt.js +5 -5
- package/fp/random.js +5 -5
- package/fp/range.js +5 -5
- package/fp/rangeRight.js +5 -5
- package/fp/rangeStep.js +5 -5
- package/fp/rangeStepRight.js +5 -5
- package/fp/rearg.js +5 -5
- package/fp/reduce.js +5 -5
- package/fp/reduceRight.js +5 -5
- package/fp/reject.js +5 -5
- package/fp/remove.js +5 -5
- package/fp/repeat.js +5 -5
- package/fp/replace.js +5 -5
- package/fp/rest.js +5 -5
- package/fp/restFrom.js +5 -5
- package/fp/result.js +5 -5
- package/fp/reverse.js +5 -5
- package/fp/round.js +5 -5
- package/fp/sample.js +5 -5
- package/fp/sampleSize.js +5 -5
- package/fp/seq.js +2 -2
- package/fp/set.js +5 -5
- package/fp/setWith.js +5 -5
- package/fp/shuffle.js +5 -5
- package/fp/size.js +5 -5
- package/fp/slice.js +5 -5
- package/fp/snakeCase.js +5 -5
- package/fp/some.js +5 -5
- package/fp/sortBy.js +5 -5
- package/fp/sortedIndex.js +5 -5
- package/fp/sortedIndexBy.js +5 -5
- package/fp/sortedIndexOf.js +5 -5
- package/fp/sortedLastIndex.js +5 -5
- package/fp/sortedLastIndexBy.js +5 -5
- package/fp/sortedLastIndexOf.js +5 -5
- package/fp/sortedUniq.js +5 -5
- package/fp/sortedUniqBy.js +5 -5
- package/fp/split.js +5 -5
- package/fp/spread.js +5 -5
- package/fp/spreadFrom.js +5 -5
- package/fp/startCase.js +5 -5
- package/fp/startsWith.js +5 -5
- package/fp/string.js +2 -2
- package/fp/stubArray.js +5 -5
- package/fp/stubFalse.js +5 -5
- package/fp/stubObject.js +5 -5
- package/fp/stubString.js +5 -5
- package/fp/stubTrue.js +5 -5
- package/fp/subtract.js +5 -5
- package/fp/sum.js +5 -5
- package/fp/sumBy.js +5 -5
- package/fp/symmetricDifference.js +1 -1
- package/fp/symmetricDifferenceBy.js +1 -1
- package/fp/symmetricDifferenceWith.js +1 -1
- package/fp/tail.js +5 -5
- package/fp/take.js +5 -5
- package/fp/takeLast.js +1 -1
- package/fp/takeLastWhile.js +1 -1
- package/fp/takeRight.js +5 -5
- package/fp/takeRightWhile.js +5 -5
- package/fp/takeWhile.js +5 -5
- package/fp/tap.js +5 -5
- package/fp/template.js +5 -5
- package/fp/templateSettings.js +5 -5
- package/fp/throttle.js +5 -5
- package/fp/thru.js +5 -5
- package/fp/times.js +5 -5
- package/fp/toArray.js +5 -5
- package/fp/toFinite.js +5 -5
- package/fp/toInteger.js +5 -5
- package/fp/toIterator.js +5 -5
- package/fp/toJSON.js +5 -5
- package/fp/toLength.js +5 -5
- package/fp/toLower.js +5 -5
- package/fp/toNumber.js +5 -5
- package/fp/toPairs.js +5 -5
- package/fp/toPairsIn.js +5 -5
- package/fp/toPath.js +5 -5
- package/fp/toPlainObject.js +5 -5
- package/fp/toSafeInteger.js +5 -5
- package/fp/toString.js +5 -5
- package/fp/toUpper.js +5 -5
- package/fp/transform.js +5 -5
- package/fp/trim.js +5 -5
- package/fp/trimChars.js +5 -5
- package/fp/trimCharsEnd.js +5 -5
- package/fp/trimCharsStart.js +5 -5
- package/fp/trimEnd.js +5 -5
- package/fp/trimStart.js +5 -5
- package/fp/truncate.js +5 -5
- package/fp/unapply.js +1 -1
- package/fp/unary.js +5 -5
- package/fp/unescape.js +5 -5
- package/fp/union.js +5 -5
- package/fp/unionBy.js +5 -5
- package/fp/unionWith.js +5 -5
- package/fp/uniq.js +5 -5
- package/fp/uniqBy.js +5 -5
- package/fp/uniqWith.js +5 -5
- package/fp/uniqueId.js +5 -5
- package/fp/unnest.js +1 -1
- package/fp/unset.js +5 -5
- package/fp/unzip.js +5 -5
- package/fp/unzipWith.js +5 -5
- package/fp/update.js +5 -5
- package/fp/updateWith.js +5 -5
- package/fp/upperCase.js +5 -5
- package/fp/upperFirst.js +5 -5
- package/fp/useWith.js +1 -1
- package/fp/util.js +2 -2
- package/fp/value.js +5 -5
- package/fp/valueOf.js +5 -5
- package/fp/values.js +5 -5
- package/fp/valuesIn.js +5 -5
- package/fp/where.js +1 -1
- package/fp/whereEq.js +1 -1
- package/fp/without.js +5 -5
- package/fp/words.js +5 -5
- package/fp/wrap.js +5 -5
- package/fp/wrapperAt.js +5 -5
- package/fp/wrapperChain.js +5 -5
- package/fp/wrapperLodash.js +5 -5
- package/fp/wrapperReverse.js +5 -5
- package/fp/wrapperValue.js +5 -5
- package/fp/xor.js +5 -5
- package/fp/xorBy.js +5 -5
- package/fp/xorWith.js +5 -5
- package/fp/zip.js +5 -5
- package/fp/zipAll.js +5 -5
- package/fp/zipObj.js +1 -1
- package/fp/zipObject.js +5 -5
- package/fp/zipObjectDeep.js +5 -5
- package/fp/zipWith.js +5 -5
- package/fp.js +2 -2
- package/fromPairs.js +28 -28
- package/function.js +25 -25
- package/functions.js +31 -31
- package/functionsIn.js +31 -31
- package/get.js +33 -33
- package/groupBy.js +41 -41
- package/gt.js +29 -29
- package/gte.js +30 -30
- package/has.js +35 -35
- package/hasIn.js +34 -34
- package/head.js +23 -23
- package/identity.js +21 -21
- package/inRange.js +55 -55
- package/includes.js +53 -53
- package/indexOf.js +42 -42
- package/initial.js +22 -22
- package/intersection.js +30 -30
- package/intersectionBy.js +45 -45
- package/intersectionWith.js +41 -41
- package/invert.js +42 -42
- package/invertBy.js +56 -56
- package/invoke.js +24 -24
- package/invokeMap.js +41 -41
- package/isArguments.js +36 -36
- package/isArray.js +26 -26
- package/isArrayBuffer.js +27 -27
- package/isArrayLike.js +33 -33
- package/isArrayLikeObject.js +33 -33
- package/isBoolean.js +29 -29
- package/isBuffer.js +38 -38
- package/isDate.js +27 -27
- package/isElement.js +25 -25
- package/isEmpty.js +77 -77
- package/isEqual.js +35 -35
- package/isEqualWith.js +41 -41
- package/isError.js +36 -36
- package/isFinite.js +36 -36
- package/isFunction.js +37 -37
- package/isInteger.js +33 -33
- package/isLength.js +35 -35
- package/isMap.js +27 -27
- package/isMatch.js +36 -36
- package/isMatchWith.js +41 -41
- package/isNaN.js +38 -38
- package/isNative.js +40 -40
- package/isNil.js +25 -25
- package/isNull.js +22 -22
- package/isNumber.js +38 -38
- package/isObject.js +31 -31
- package/isObjectLike.js +29 -29
- package/isPlainObject.js +62 -62
- package/isRegExp.js +27 -27
- package/isSafeInteger.js +37 -37
- package/isSet.js +27 -27
- package/isString.js +30 -30
- package/isSymbol.js +29 -29
- package/isTypedArray.js +27 -27
- package/isUndefined.js +22 -22
- package/isWeakMap.js +28 -28
- package/isWeakSet.js +28 -28
- package/iteratee.js +53 -53
- package/join.js +26 -26
- package/kebabCase.js +28 -28
- package/keyBy.js +36 -36
- package/keys.js +37 -37
- package/keysIn.js +32 -32
- package/lang.js +58 -58
- package/last.js +20 -20
- package/lastIndexOf.js +46 -46
- package/lodash.js +17248 -17209
- package/lodash.min.js +6 -135
- package/lowerCase.js +27 -27
- package/lowerFirst.js +22 -22
- package/lt.js +29 -29
- package/lte.js +30 -30
- package/map.js +53 -53
- package/mapKeys.js +36 -36
- package/mapValues.js +43 -43
- package/matches.js +46 -46
- package/matchesProperty.js +44 -44
- package/math.js +17 -17
- package/max.js +29 -29
- package/maxBy.js +34 -34
- package/mean.js +22 -22
- package/meanBy.js +31 -31
- package/memoize.js +73 -73
- package/merge.js +39 -39
- package/mergeWith.js +39 -39
- package/method.js +34 -34
- package/methodOf.js +33 -33
- package/min.js +29 -29
- package/minBy.js +34 -34
- package/mixin.js +74 -74
- package/multiply.js +22 -22
- package/negate.js +40 -40
- package/next.js +35 -35
- package/noop.js +17 -17
- package/now.js +23 -23
- package/nth.js +29 -29
- package/nthArg.js +32 -32
- package/number.js +5 -5
- package/object.js +49 -49
- package/omit.js +57 -57
- package/omitBy.js +29 -29
- package/once.js +25 -25
- package/orderBy.js +47 -47
- package/over.js +24 -24
- package/overArgs.js +61 -61
- package/overEvery.js +34 -34
- package/overSome.js +37 -37
- package/package.json +30 -27
- package/pad.js +49 -49
- package/padEnd.js +39 -39
- package/padStart.js +39 -39
- package/parseInt.js +43 -43
- package/partial.js +50 -50
- package/partialRight.js +49 -49
- package/partition.js +43 -43
- package/pick.js +25 -25
- package/pickBy.js +37 -37
- package/plant.js +48 -48
- package/property.js +32 -32
- package/propertyOf.js +30 -30
- package/pull.js +29 -29
- package/pullAll.js +29 -29
- package/pullAllBy.js +33 -33
- package/pullAllWith.js +32 -32
- package/pullAt.js +43 -43
- package/random.js +82 -82
- package/range.js +46 -46
- package/rangeRight.js +41 -41
- package/rearg.js +33 -33
- package/reduce.js +51 -51
- package/reduceRight.js +36 -36
- package/reject.js +46 -46
- package/remove.js +53 -53
- package/repeat.js +37 -37
- package/replace.js +29 -29
- package/rest.js +40 -40
- package/result.js +56 -56
- package/reverse.js +34 -34
- package/round.js +26 -26
- package/sample.js +24 -24
- package/sampleSize.js +37 -37
- package/seq.js +16 -16
- package/set.js +35 -35
- package/setWith.js +32 -32
- package/shuffle.js +25 -25
- package/size.js +46 -46
- package/slice.js +37 -37
- package/snakeCase.js +28 -28
- package/some.js +51 -51
- package/sortBy.js +48 -48
- package/sortedIndex.js +24 -24
- package/sortedIndexBy.js +33 -33
- package/sortedIndexOf.js +31 -31
- package/sortedLastIndex.js +25 -25
- package/sortedLastIndexBy.js +33 -33
- package/sortedLastIndexOf.js +31 -31
- package/sortedUniq.js +24 -24
- package/sortedUniqBy.js +26 -26
- package/split.js +52 -52
- package/spread.js +63 -63
- package/startCase.js +29 -29
- package/startsWith.js +39 -39
- package/string.js +33 -33
- package/stubArray.js +23 -23
- package/stubFalse.js +18 -18
- package/stubObject.js +23 -23
- package/stubString.js +18 -18
- package/stubTrue.js +18 -18
- package/subtract.js +22 -22
- package/sum.js +24 -24
- package/sumBy.js +33 -33
- package/tail.js +22 -22
- package/take.js +37 -37
- package/takeRight.js +39 -39
- package/takeRightWhile.js +45 -45
- package/takeWhile.js +45 -45
- package/tap.js +29 -29
- package/template.js +272 -272
- package/templateSettings.js +67 -67
- package/throttle.js +69 -69
- package/thru.js +28 -28
- package/times.js +51 -51
- package/toArray.js +58 -58
- package/toFinite.js +42 -42
- package/toInteger.js +36 -36
- package/toIterator.js +23 -23
- package/toJSON.js +1 -1
- package/toLength.js +38 -38
- package/toLower.js +28 -28
- package/toNumber.js +64 -64
- package/toPairs.js +30 -30
- package/toPairsIn.js +30 -30
- package/toPath.js +33 -33
- package/toPlainObject.js +32 -32
- package/toSafeInteger.js +37 -37
- package/toString.js +28 -28
- package/toUpper.js +28 -28
- package/transform.js +65 -65
- package/trim.js +47 -47
- package/trimEnd.js +41 -41
- package/trimStart.js +43 -43
- package/truncate.js +111 -111
- package/unary.js +22 -22
- package/unescape.js +34 -34
- package/union.js +26 -26
- package/unionBy.js +39 -39
- package/unionWith.js +34 -34
- package/uniq.js +25 -25
- package/uniqBy.js +31 -31
- package/uniqWith.js +28 -28
- package/uniqueId.js +28 -28
- package/unset.js +34 -34
- package/unzip.js +45 -45
- package/unzipWith.js +39 -39
- package/update.js +35 -35
- package/updateWith.js +33 -33
- package/upperCase.js +27 -27
- package/upperFirst.js +22 -22
- package/util.js +34 -34
- package/value.js +1 -1
- package/valueOf.js +1 -1
- package/values.js +34 -34
- package/valuesIn.js +32 -32
- package/without.js +31 -31
- package/words.js +35 -35
- package/wrap.js +30 -30
- package/wrapperAt.js +48 -48
- package/wrapperChain.js +34 -34
- package/wrapperLodash.js +147 -147
- package/wrapperReverse.js +44 -44
- package/wrapperValue.js +21 -21
- package/xor.js +28 -28
- package/xorBy.js +39 -39
- package/xorWith.js +34 -34
- package/zip.js +22 -22
- package/zipObject.js +24 -24
- package/zipObjectDeep.js +23 -23
- package/zipWith.js +32 -32
- package/_.log +0 -3
package/debounce.js
CHANGED
|
@@ -1,191 +1,191 @@
|
|
|
1
|
-
var isObject = require('./isObject'),
|
|
2
|
-
now = require('./now'),
|
|
3
|
-
toNumber = require('./toNumber');
|
|
4
|
-
|
|
5
|
-
/** Error message constants. */
|
|
6
|
-
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
7
|
-
|
|
8
|
-
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
9
|
-
var nativeMax = Math.max,
|
|
10
|
-
nativeMin = Math.min;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
14
|
-
* milliseconds have elapsed since the last time the debounced function was
|
|
15
|
-
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
16
|
-
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
17
|
-
* Provide `options` to indicate whether `func` should be invoked on the
|
|
18
|
-
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
19
|
-
* with the last arguments provided to the debounced function. Subsequent
|
|
20
|
-
* calls to the debounced function return the result of the last `func`
|
|
21
|
-
* invocation.
|
|
22
|
-
*
|
|
23
|
-
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
24
|
-
* invoked on the trailing edge of the timeout only if the debounced function
|
|
25
|
-
* is invoked more than once during the `wait` timeout.
|
|
26
|
-
*
|
|
27
|
-
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
28
|
-
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
29
|
-
*
|
|
30
|
-
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
31
|
-
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
32
|
-
*
|
|
33
|
-
* @static
|
|
34
|
-
* @memberOf _
|
|
35
|
-
* @since 0.1.0
|
|
36
|
-
* @category Function
|
|
37
|
-
* @param {Function} func The function to debounce.
|
|
38
|
-
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
39
|
-
* @param {Object} [options={}] The options object.
|
|
40
|
-
* @param {boolean} [options.leading=false]
|
|
41
|
-
* Specify invoking on the leading edge of the timeout.
|
|
42
|
-
* @param {number} [options.maxWait]
|
|
43
|
-
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
44
|
-
* @param {boolean} [options.trailing=true]
|
|
45
|
-
* Specify invoking on the trailing edge of the timeout.
|
|
46
|
-
* @returns {Function} Returns the new debounced function.
|
|
47
|
-
* @example
|
|
48
|
-
*
|
|
49
|
-
* // Avoid costly calculations while the window size is in flux.
|
|
50
|
-
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
51
|
-
*
|
|
52
|
-
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
53
|
-
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
54
|
-
* 'leading': true,
|
|
55
|
-
* 'trailing': false
|
|
56
|
-
* }));
|
|
57
|
-
*
|
|
58
|
-
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
59
|
-
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
60
|
-
* var source = new EventSource('/stream');
|
|
61
|
-
* jQuery(source).on('message', debounced);
|
|
62
|
-
*
|
|
63
|
-
* // Cancel the trailing debounced invocation.
|
|
64
|
-
* jQuery(window).on('popstate', debounced.cancel);
|
|
65
|
-
*/
|
|
66
|
-
function debounce(func, wait, options) {
|
|
67
|
-
var lastArgs,
|
|
68
|
-
lastThis,
|
|
69
|
-
maxWait,
|
|
70
|
-
result,
|
|
71
|
-
timerId,
|
|
72
|
-
lastCallTime,
|
|
73
|
-
lastInvokeTime = 0,
|
|
74
|
-
leading = false,
|
|
75
|
-
maxing = false,
|
|
76
|
-
trailing = true;
|
|
77
|
-
|
|
78
|
-
if (typeof func != 'function') {
|
|
79
|
-
throw new TypeError(FUNC_ERROR_TEXT);
|
|
80
|
-
}
|
|
81
|
-
wait = toNumber(wait) || 0;
|
|
82
|
-
if (isObject(options)) {
|
|
83
|
-
leading = !!options.leading;
|
|
84
|
-
maxing = 'maxWait' in options;
|
|
85
|
-
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
86
|
-
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function invokeFunc(time) {
|
|
90
|
-
var args = lastArgs,
|
|
91
|
-
thisArg = lastThis;
|
|
92
|
-
|
|
93
|
-
lastArgs = lastThis = undefined;
|
|
94
|
-
lastInvokeTime = time;
|
|
95
|
-
result = func.apply(thisArg, args);
|
|
96
|
-
return result;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function leadingEdge(time) {
|
|
100
|
-
// Reset any `maxWait` timer.
|
|
101
|
-
lastInvokeTime = time;
|
|
102
|
-
// Start the timer for the trailing edge.
|
|
103
|
-
timerId = setTimeout(timerExpired, wait);
|
|
104
|
-
// Invoke the leading edge.
|
|
105
|
-
return leading ? invokeFunc(time) : result;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function remainingWait(time) {
|
|
109
|
-
var timeSinceLastCall = time - lastCallTime,
|
|
110
|
-
timeSinceLastInvoke = time - lastInvokeTime,
|
|
111
|
-
timeWaiting = wait - timeSinceLastCall;
|
|
112
|
-
|
|
113
|
-
return maxing
|
|
114
|
-
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
|
|
115
|
-
: timeWaiting;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function shouldInvoke(time) {
|
|
119
|
-
var timeSinceLastCall = time - lastCallTime,
|
|
120
|
-
timeSinceLastInvoke = time - lastInvokeTime;
|
|
121
|
-
|
|
122
|
-
// Either this is the first call, activity has stopped and we're at the
|
|
123
|
-
// trailing edge, the system time has gone backwards and we're treating
|
|
124
|
-
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
125
|
-
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
126
|
-
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function timerExpired() {
|
|
130
|
-
var time = now();
|
|
131
|
-
if (shouldInvoke(time)) {
|
|
132
|
-
return trailingEdge(time);
|
|
133
|
-
}
|
|
134
|
-
// Restart the timer.
|
|
135
|
-
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function trailingEdge(time) {
|
|
139
|
-
timerId = undefined;
|
|
140
|
-
|
|
141
|
-
// Only invoke if we have `lastArgs` which means `func` has been
|
|
142
|
-
// debounced at least once.
|
|
143
|
-
if (trailing && lastArgs) {
|
|
144
|
-
return invokeFunc(time);
|
|
145
|
-
}
|
|
146
|
-
lastArgs = lastThis = undefined;
|
|
147
|
-
return result;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
function cancel() {
|
|
151
|
-
if (timerId !== undefined) {
|
|
152
|
-
clearTimeout(timerId);
|
|
153
|
-
}
|
|
154
|
-
lastInvokeTime = 0;
|
|
155
|
-
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function flush() {
|
|
159
|
-
return timerId === undefined ? result : trailingEdge(now());
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
function debounced() {
|
|
163
|
-
var time = now(),
|
|
164
|
-
isInvoking = shouldInvoke(time);
|
|
165
|
-
|
|
166
|
-
lastArgs = arguments;
|
|
167
|
-
lastThis = this;
|
|
168
|
-
lastCallTime = time;
|
|
169
|
-
|
|
170
|
-
if (isInvoking) {
|
|
171
|
-
if (timerId === undefined) {
|
|
172
|
-
return leadingEdge(lastCallTime);
|
|
173
|
-
}
|
|
174
|
-
if (maxing) {
|
|
175
|
-
// Handle invocations in a tight loop.
|
|
176
|
-
clearTimeout(timerId);
|
|
177
|
-
timerId = setTimeout(timerExpired, wait);
|
|
178
|
-
return invokeFunc(lastCallTime);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
if (timerId === undefined) {
|
|
182
|
-
timerId = setTimeout(timerExpired, wait);
|
|
183
|
-
}
|
|
184
|
-
return result;
|
|
185
|
-
}
|
|
186
|
-
debounced.cancel = cancel;
|
|
187
|
-
debounced.flush = flush;
|
|
188
|
-
return debounced;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
module.exports = debounce;
|
|
1
|
+
var isObject = require('./isObject'),
|
|
2
|
+
now = require('./now'),
|
|
3
|
+
toNumber = require('./toNumber');
|
|
4
|
+
|
|
5
|
+
/** Error message constants. */
|
|
6
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
7
|
+
|
|
8
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
9
|
+
var nativeMax = Math.max,
|
|
10
|
+
nativeMin = Math.min;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
14
|
+
* milliseconds have elapsed since the last time the debounced function was
|
|
15
|
+
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
16
|
+
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
17
|
+
* Provide `options` to indicate whether `func` should be invoked on the
|
|
18
|
+
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
19
|
+
* with the last arguments provided to the debounced function. Subsequent
|
|
20
|
+
* calls to the debounced function return the result of the last `func`
|
|
21
|
+
* invocation.
|
|
22
|
+
*
|
|
23
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
24
|
+
* invoked on the trailing edge of the timeout only if the debounced function
|
|
25
|
+
* is invoked more than once during the `wait` timeout.
|
|
26
|
+
*
|
|
27
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
28
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
29
|
+
*
|
|
30
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
31
|
+
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
32
|
+
*
|
|
33
|
+
* @static
|
|
34
|
+
* @memberOf _
|
|
35
|
+
* @since 0.1.0
|
|
36
|
+
* @category Function
|
|
37
|
+
* @param {Function} func The function to debounce.
|
|
38
|
+
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
39
|
+
* @param {Object} [options={}] The options object.
|
|
40
|
+
* @param {boolean} [options.leading=false]
|
|
41
|
+
* Specify invoking on the leading edge of the timeout.
|
|
42
|
+
* @param {number} [options.maxWait]
|
|
43
|
+
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
44
|
+
* @param {boolean} [options.trailing=true]
|
|
45
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
46
|
+
* @returns {Function} Returns the new debounced function.
|
|
47
|
+
* @example
|
|
48
|
+
*
|
|
49
|
+
* // Avoid costly calculations while the window size is in flux.
|
|
50
|
+
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
51
|
+
*
|
|
52
|
+
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
53
|
+
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
54
|
+
* 'leading': true,
|
|
55
|
+
* 'trailing': false
|
|
56
|
+
* }));
|
|
57
|
+
*
|
|
58
|
+
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
59
|
+
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
60
|
+
* var source = new EventSource('/stream');
|
|
61
|
+
* jQuery(source).on('message', debounced);
|
|
62
|
+
*
|
|
63
|
+
* // Cancel the trailing debounced invocation.
|
|
64
|
+
* jQuery(window).on('popstate', debounced.cancel);
|
|
65
|
+
*/
|
|
66
|
+
function debounce(func, wait, options) {
|
|
67
|
+
var lastArgs,
|
|
68
|
+
lastThis,
|
|
69
|
+
maxWait,
|
|
70
|
+
result,
|
|
71
|
+
timerId,
|
|
72
|
+
lastCallTime,
|
|
73
|
+
lastInvokeTime = 0,
|
|
74
|
+
leading = false,
|
|
75
|
+
maxing = false,
|
|
76
|
+
trailing = true;
|
|
77
|
+
|
|
78
|
+
if (typeof func != 'function') {
|
|
79
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
80
|
+
}
|
|
81
|
+
wait = toNumber(wait) || 0;
|
|
82
|
+
if (isObject(options)) {
|
|
83
|
+
leading = !!options.leading;
|
|
84
|
+
maxing = 'maxWait' in options;
|
|
85
|
+
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
86
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function invokeFunc(time) {
|
|
90
|
+
var args = lastArgs,
|
|
91
|
+
thisArg = lastThis;
|
|
92
|
+
|
|
93
|
+
lastArgs = lastThis = undefined;
|
|
94
|
+
lastInvokeTime = time;
|
|
95
|
+
result = func.apply(thisArg, args);
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function leadingEdge(time) {
|
|
100
|
+
// Reset any `maxWait` timer.
|
|
101
|
+
lastInvokeTime = time;
|
|
102
|
+
// Start the timer for the trailing edge.
|
|
103
|
+
timerId = setTimeout(timerExpired, wait);
|
|
104
|
+
// Invoke the leading edge.
|
|
105
|
+
return leading ? invokeFunc(time) : result;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function remainingWait(time) {
|
|
109
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
110
|
+
timeSinceLastInvoke = time - lastInvokeTime,
|
|
111
|
+
timeWaiting = wait - timeSinceLastCall;
|
|
112
|
+
|
|
113
|
+
return maxing
|
|
114
|
+
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
|
|
115
|
+
: timeWaiting;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function shouldInvoke(time) {
|
|
119
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
120
|
+
timeSinceLastInvoke = time - lastInvokeTime;
|
|
121
|
+
|
|
122
|
+
// Either this is the first call, activity has stopped and we're at the
|
|
123
|
+
// trailing edge, the system time has gone backwards and we're treating
|
|
124
|
+
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
125
|
+
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
126
|
+
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function timerExpired() {
|
|
130
|
+
var time = now();
|
|
131
|
+
if (shouldInvoke(time)) {
|
|
132
|
+
return trailingEdge(time);
|
|
133
|
+
}
|
|
134
|
+
// Restart the timer.
|
|
135
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function trailingEdge(time) {
|
|
139
|
+
timerId = undefined;
|
|
140
|
+
|
|
141
|
+
// Only invoke if we have `lastArgs` which means `func` has been
|
|
142
|
+
// debounced at least once.
|
|
143
|
+
if (trailing && lastArgs) {
|
|
144
|
+
return invokeFunc(time);
|
|
145
|
+
}
|
|
146
|
+
lastArgs = lastThis = undefined;
|
|
147
|
+
return result;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function cancel() {
|
|
151
|
+
if (timerId !== undefined) {
|
|
152
|
+
clearTimeout(timerId);
|
|
153
|
+
}
|
|
154
|
+
lastInvokeTime = 0;
|
|
155
|
+
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function flush() {
|
|
159
|
+
return timerId === undefined ? result : trailingEdge(now());
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function debounced() {
|
|
163
|
+
var time = now(),
|
|
164
|
+
isInvoking = shouldInvoke(time);
|
|
165
|
+
|
|
166
|
+
lastArgs = arguments;
|
|
167
|
+
lastThis = this;
|
|
168
|
+
lastCallTime = time;
|
|
169
|
+
|
|
170
|
+
if (isInvoking) {
|
|
171
|
+
if (timerId === undefined) {
|
|
172
|
+
return leadingEdge(lastCallTime);
|
|
173
|
+
}
|
|
174
|
+
if (maxing) {
|
|
175
|
+
// Handle invocations in a tight loop.
|
|
176
|
+
clearTimeout(timerId);
|
|
177
|
+
timerId = setTimeout(timerExpired, wait);
|
|
178
|
+
return invokeFunc(lastCallTime);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (timerId === undefined) {
|
|
182
|
+
timerId = setTimeout(timerExpired, wait);
|
|
183
|
+
}
|
|
184
|
+
return result;
|
|
185
|
+
}
|
|
186
|
+
debounced.cancel = cancel;
|
|
187
|
+
debounced.flush = flush;
|
|
188
|
+
return debounced;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
module.exports = debounce;
|
package/deburr.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
var deburrLetter = require('./_deburrLetter'),
|
|
2
|
-
toString = require('./toString');
|
|
3
|
-
|
|
4
|
-
/** Used to match Latin Unicode letters (excluding mathematical operators). */
|
|
5
|
-
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
|
|
6
|
-
|
|
7
|
-
/** Used to compose unicode character classes. */
|
|
8
|
-
var rsComboMarksRange = '\\u0300-\\u036f',
|
|
9
|
-
reComboHalfMarksRange = '\\ufe20-\\ufe2f',
|
|
10
|
-
rsComboSymbolsRange = '\\u20d0-\\u20ff',
|
|
11
|
-
rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
|
|
12
|
-
|
|
13
|
-
/** Used to compose unicode capture groups. */
|
|
14
|
-
var rsCombo = '[' + rsComboRange + ']';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
|
|
18
|
-
* [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
|
|
19
|
-
*/
|
|
20
|
-
var reComboMark = RegExp(rsCombo, 'g');
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Deburrs `string` by converting
|
|
24
|
-
* [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
|
|
25
|
-
* and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
|
|
26
|
-
* letters to basic Latin letters and removing
|
|
27
|
-
* [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
|
|
28
|
-
*
|
|
29
|
-
* @static
|
|
30
|
-
* @memberOf _
|
|
31
|
-
* @since 3.0.0
|
|
32
|
-
* @category String
|
|
33
|
-
* @param {string} [string=''] The string to deburr.
|
|
34
|
-
* @returns {string} Returns the deburred string.
|
|
35
|
-
* @example
|
|
36
|
-
*
|
|
37
|
-
* _.deburr('déjà vu');
|
|
38
|
-
* // => 'deja vu'
|
|
39
|
-
*/
|
|
40
|
-
function deburr(string) {
|
|
41
|
-
string = toString(string);
|
|
42
|
-
return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
module.exports = deburr;
|
|
1
|
+
var deburrLetter = require('./_deburrLetter'),
|
|
2
|
+
toString = require('./toString');
|
|
3
|
+
|
|
4
|
+
/** Used to match Latin Unicode letters (excluding mathematical operators). */
|
|
5
|
+
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
|
|
6
|
+
|
|
7
|
+
/** Used to compose unicode character classes. */
|
|
8
|
+
var rsComboMarksRange = '\\u0300-\\u036f',
|
|
9
|
+
reComboHalfMarksRange = '\\ufe20-\\ufe2f',
|
|
10
|
+
rsComboSymbolsRange = '\\u20d0-\\u20ff',
|
|
11
|
+
rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
|
|
12
|
+
|
|
13
|
+
/** Used to compose unicode capture groups. */
|
|
14
|
+
var rsCombo = '[' + rsComboRange + ']';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and
|
|
18
|
+
* [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols).
|
|
19
|
+
*/
|
|
20
|
+
var reComboMark = RegExp(rsCombo, 'g');
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Deburrs `string` by converting
|
|
24
|
+
* [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table)
|
|
25
|
+
* and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A)
|
|
26
|
+
* letters to basic Latin letters and removing
|
|
27
|
+
* [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks).
|
|
28
|
+
*
|
|
29
|
+
* @static
|
|
30
|
+
* @memberOf _
|
|
31
|
+
* @since 3.0.0
|
|
32
|
+
* @category String
|
|
33
|
+
* @param {string} [string=''] The string to deburr.
|
|
34
|
+
* @returns {string} Returns the deburred string.
|
|
35
|
+
* @example
|
|
36
|
+
*
|
|
37
|
+
* _.deburr('déjà vu');
|
|
38
|
+
* // => 'deja vu'
|
|
39
|
+
*/
|
|
40
|
+
function deburr(string) {
|
|
41
|
+
string = toString(string);
|
|
42
|
+
return string && string.replace(reLatin, deburrLetter).replace(reComboMark, '');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
module.exports = deburr;
|
package/defaultTo.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks `value` to determine whether a default value should be returned in
|
|
3
|
-
* its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
|
|
4
|
-
* or `undefined`.
|
|
5
|
-
*
|
|
6
|
-
* @static
|
|
7
|
-
* @memberOf _
|
|
8
|
-
* @since 4.14.0
|
|
9
|
-
* @category Util
|
|
10
|
-
* @param {*} value The value to check.
|
|
11
|
-
* @param {*} defaultValue The default value.
|
|
12
|
-
* @returns {*} Returns the resolved value.
|
|
13
|
-
* @example
|
|
14
|
-
*
|
|
15
|
-
* _.defaultTo(1, 10);
|
|
16
|
-
* // => 1
|
|
17
|
-
*
|
|
18
|
-
* _.defaultTo(undefined, 10);
|
|
19
|
-
* // => 10
|
|
20
|
-
*/
|
|
21
|
-
function defaultTo(value, defaultValue) {
|
|
22
|
-
return (value == null || value !== value) ? defaultValue : value;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
module.exports = defaultTo;
|
|
1
|
+
/**
|
|
2
|
+
* Checks `value` to determine whether a default value should be returned in
|
|
3
|
+
* its place. The `defaultValue` is returned if `value` is `NaN`, `null`,
|
|
4
|
+
* or `undefined`.
|
|
5
|
+
*
|
|
6
|
+
* @static
|
|
7
|
+
* @memberOf _
|
|
8
|
+
* @since 4.14.0
|
|
9
|
+
* @category Util
|
|
10
|
+
* @param {*} value The value to check.
|
|
11
|
+
* @param {*} defaultValue The default value.
|
|
12
|
+
* @returns {*} Returns the resolved value.
|
|
13
|
+
* @example
|
|
14
|
+
*
|
|
15
|
+
* _.defaultTo(1, 10);
|
|
16
|
+
* // => 1
|
|
17
|
+
*
|
|
18
|
+
* _.defaultTo(undefined, 10);
|
|
19
|
+
* // => 10
|
|
20
|
+
*/
|
|
21
|
+
function defaultTo(value, defaultValue) {
|
|
22
|
+
return (value == null || value !== value) ? defaultValue : value;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
module.exports = defaultTo;
|
package/defaults.js
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
var baseRest = require('./_baseRest'),
|
|
2
|
-
eq = require('./eq'),
|
|
3
|
-
isIterateeCall = require('./_isIterateeCall'),
|
|
4
|
-
keysIn = require('./keysIn');
|
|
5
|
-
|
|
6
|
-
/** Used for built-in method references. */
|
|
7
|
-
var objectProto = Object.prototype;
|
|
8
|
-
|
|
9
|
-
/** Used to check objects for own properties. */
|
|
10
|
-
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Assigns own and inherited enumerable string keyed properties of source
|
|
14
|
-
* objects to the destination object for all destination properties that
|
|
15
|
-
* resolve to `undefined`. Source objects are applied from left to right.
|
|
16
|
-
* Once a property is set, additional values of the same property are ignored.
|
|
17
|
-
*
|
|
18
|
-
* **Note:** This method mutates `object`.
|
|
19
|
-
*
|
|
20
|
-
* @static
|
|
21
|
-
* @since 0.1.0
|
|
22
|
-
* @memberOf _
|
|
23
|
-
* @category Object
|
|
24
|
-
* @param {Object} object The destination object.
|
|
25
|
-
* @param {...Object} [sources] The source objects.
|
|
26
|
-
* @returns {Object} Returns `object`.
|
|
27
|
-
* @see _.defaultsDeep
|
|
28
|
-
* @example
|
|
29
|
-
*
|
|
30
|
-
* _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
|
31
|
-
* // => { 'a': 1, 'b': 2 }
|
|
32
|
-
*/
|
|
33
|
-
var defaults = baseRest(function(object, sources) {
|
|
34
|
-
object = Object(object);
|
|
35
|
-
|
|
36
|
-
var index = -1;
|
|
37
|
-
var length = sources.length;
|
|
38
|
-
var guard = length > 2 ? sources[2] : undefined;
|
|
39
|
-
|
|
40
|
-
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
|
41
|
-
length = 1;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
while (++index < length) {
|
|
45
|
-
var source = sources[index];
|
|
46
|
-
var props = keysIn(source);
|
|
47
|
-
var propsIndex = -1;
|
|
48
|
-
var propsLength = props.length;
|
|
49
|
-
|
|
50
|
-
while (++propsIndex < propsLength) {
|
|
51
|
-
var key = props[propsIndex];
|
|
52
|
-
var value = object[key];
|
|
53
|
-
|
|
54
|
-
if (value === undefined ||
|
|
55
|
-
(eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
|
|
56
|
-
object[key] = source[key];
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return object;
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
module.exports = defaults;
|
|
1
|
+
var baseRest = require('./_baseRest'),
|
|
2
|
+
eq = require('./eq'),
|
|
3
|
+
isIterateeCall = require('./_isIterateeCall'),
|
|
4
|
+
keysIn = require('./keysIn');
|
|
5
|
+
|
|
6
|
+
/** Used for built-in method references. */
|
|
7
|
+
var objectProto = Object.prototype;
|
|
8
|
+
|
|
9
|
+
/** Used to check objects for own properties. */
|
|
10
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Assigns own and inherited enumerable string keyed properties of source
|
|
14
|
+
* objects to the destination object for all destination properties that
|
|
15
|
+
* resolve to `undefined`. Source objects are applied from left to right.
|
|
16
|
+
* Once a property is set, additional values of the same property are ignored.
|
|
17
|
+
*
|
|
18
|
+
* **Note:** This method mutates `object`.
|
|
19
|
+
*
|
|
20
|
+
* @static
|
|
21
|
+
* @since 0.1.0
|
|
22
|
+
* @memberOf _
|
|
23
|
+
* @category Object
|
|
24
|
+
* @param {Object} object The destination object.
|
|
25
|
+
* @param {...Object} [sources] The source objects.
|
|
26
|
+
* @returns {Object} Returns `object`.
|
|
27
|
+
* @see _.defaultsDeep
|
|
28
|
+
* @example
|
|
29
|
+
*
|
|
30
|
+
* _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
|
31
|
+
* // => { 'a': 1, 'b': 2 }
|
|
32
|
+
*/
|
|
33
|
+
var defaults = baseRest(function(object, sources) {
|
|
34
|
+
object = Object(object);
|
|
35
|
+
|
|
36
|
+
var index = -1;
|
|
37
|
+
var length = sources.length;
|
|
38
|
+
var guard = length > 2 ? sources[2] : undefined;
|
|
39
|
+
|
|
40
|
+
if (guard && isIterateeCall(sources[0], sources[1], guard)) {
|
|
41
|
+
length = 1;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
while (++index < length) {
|
|
45
|
+
var source = sources[index];
|
|
46
|
+
var props = keysIn(source);
|
|
47
|
+
var propsIndex = -1;
|
|
48
|
+
var propsLength = props.length;
|
|
49
|
+
|
|
50
|
+
while (++propsIndex < propsLength) {
|
|
51
|
+
var key = props[propsIndex];
|
|
52
|
+
var value = object[key];
|
|
53
|
+
|
|
54
|
+
if (value === undefined ||
|
|
55
|
+
(eq(value, objectProto[key]) && !hasOwnProperty.call(object, key))) {
|
|
56
|
+
object[key] = source[key];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return object;
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
module.exports = defaults;
|