├── .gitattributes ├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── compat ├── array.js ├── array │ ├── chunk.js │ ├── compact.js │ ├── difference.js │ ├── drop.js │ ├── dropRight.js │ ├── dropRightWhile.js │ ├── dropWhile.js │ ├── fill.js │ ├── findIndex.js │ ├── findLastIndex.js │ ├── first.js │ ├── flatten.js │ ├── flattenDeep.js │ ├── head.js │ ├── indexOf.js │ ├── initial.js │ ├── intersection.js │ ├── last.js │ ├── lastIndexOf.js │ ├── object.js │ ├── pull.js │ ├── pullAt.js │ ├── remove.js │ ├── rest.js │ ├── slice.js │ ├── sortedIndex.js │ ├── sortedLastIndex.js │ ├── tail.js │ ├── take.js │ ├── takeRight.js │ ├── takeRightWhile.js │ ├── takeWhile.js │ ├── union.js │ ├── uniq.js │ ├── unique.js │ ├── unzip.js │ ├── unzipWith.js │ ├── without.js │ ├── xor.js │ ├── zip.js │ ├── zipObject.js │ └── zipWith.js ├── chain.js ├── chain │ ├── chain.js │ ├── commit.js │ ├── concat.js │ ├── lodash.js │ ├── plant.js │ ├── reverse.js │ ├── run.js │ ├── tap.js │ ├── thru.js │ ├── toJSON.js │ ├── toString.js │ ├── value.js │ ├── valueOf.js │ ├── wrapperChain.js │ ├── wrapperCommit.js │ ├── wrapperConcat.js │ ├── wrapperPlant.js │ ├── wrapperReverse.js │ ├── wrapperToString.js │ └── wrapperValue.js ├── collection.js ├── collection │ ├── all.js │ ├── any.js │ ├── at.js │ ├── collect.js │ ├── contains.js │ ├── countBy.js │ ├── detect.js │ ├── each.js │ ├── eachRight.js │ ├── every.js │ ├── filter.js │ ├── find.js │ ├── findLast.js │ ├── findWhere.js │ ├── foldl.js │ ├── foldr.js │ ├── forEach.js │ ├── forEachRight.js │ ├── groupBy.js │ ├── include.js │ ├── includes.js │ ├── indexBy.js │ ├── inject.js │ ├── invoke.js │ ├── map.js │ ├── max.js │ ├── min.js │ ├── partition.js │ ├── pluck.js │ ├── reduce.js │ ├── reduceRight.js │ ├── reject.js │ ├── sample.js │ ├── select.js │ ├── shuffle.js │ ├── size.js │ ├── some.js │ ├── sortBy.js │ ├── sortByAll.js │ ├── sortByOrder.js │ ├── sum.js │ └── where.js ├── date.js ├── date │ └── now.js ├── function.js ├── function │ ├── after.js │ ├── ary.js │ ├── backflow.js │ ├── before.js │ ├── bind.js │ ├── bindAll.js │ ├── bindKey.js │ ├── compose.js │ ├── curry.js │ ├── curryRight.js │ ├── debounce.js │ ├── defer.js │ ├── delay.js │ ├── flow.js │ ├── flowRight.js │ ├── memoize.js │ ├── modArgs.js │ ├── negate.js │ ├── once.js │ ├── partial.js │ ├── partialRight.js │ ├── rearg.js │ ├── restParam.js │ ├── spread.js │ ├── throttle.js │ └── wrap.js ├── internal │ ├── LazyWrapper.js │ ├── LodashWrapper.js │ ├── MapCache.js │ ├── SetCache.js │ ├── arrayConcat.js │ ├── arrayCopy.js │ ├── arrayEach.js │ ├── arrayEachRight.js │ ├── arrayEvery.js │ ├── arrayExtremum.js │ ├── arrayFilter.js │ ├── arrayMap.js │ ├── arrayPush.js │ ├── arrayReduce.js │ ├── arrayReduceRight.js │ ├── arraySome.js │ ├── arraySum.js │ ├── assignDefaults.js │ ├── assignOwnDefaults.js │ ├── assignWith.js │ ├── baseAssign.js │ ├── baseAt.js │ ├── baseCallback.js │ ├── baseClone.js │ ├── baseCompareAscending.js │ ├── baseCopy.js │ ├── baseCreate.js │ ├── baseDelay.js │ ├── baseDifference.js │ ├── baseEach.js │ ├── baseEachRight.js │ ├── baseEvery.js │ ├── baseExtremum.js │ ├── baseFill.js │ ├── baseFilter.js │ ├── baseFind.js │ ├── baseFindIndex.js │ ├── baseFlatten.js │ ├── baseFor.js │ ├── baseForIn.js │ ├── baseForOwn.js │ ├── baseForOwnRight.js │ ├── baseForRight.js │ ├── baseFunctions.js │ ├── baseGet.js │ ├── baseIndexOf.js │ ├── baseIsEqual.js │ ├── baseIsEqualDeep.js │ ├── baseIsFunction.js │ ├── baseIsMatch.js │ ├── baseLodash.js │ ├── baseMap.js │ ├── baseMatches.js │ ├── baseMatchesProperty.js │ ├── baseMerge.js │ ├── baseMergeDeep.js │ ├── baseProperty.js │ ├── basePropertyDeep.js │ ├── basePullAt.js │ ├── baseRandom.js │ ├── baseReduce.js │ ├── baseSetData.js │ ├── baseSlice.js │ ├── baseSome.js │ ├── baseSortBy.js │ ├── baseSortByOrder.js │ ├── baseSum.js │ ├── baseToString.js │ ├── baseUniq.js │ ├── baseValues.js │ ├── baseWhile.js │ ├── baseWrapperValue.js │ ├── binaryIndex.js │ ├── binaryIndexBy.js │ ├── bindCallback.js │ ├── bufferClone.js │ ├── cacheIndexOf.js │ ├── cachePush.js │ ├── charsLeftIndex.js │ ├── charsRightIndex.js │ ├── compareAscending.js │ ├── compareMultiple.js │ ├── composeArgs.js │ ├── composeArgsRight.js │ ├── createAggregator.js │ ├── createAssigner.js │ ├── createBaseEach.js │ ├── createBaseFor.js │ ├── createBindWrapper.js │ ├── createCache.js │ ├── createCompounder.js │ ├── createCtorWrapper.js │ ├── createCurry.js │ ├── createDefaults.js │ ├── createExtremum.js │ ├── createFind.js │ ├── createFindIndex.js │ ├── createFindKey.js │ ├── createFlow.js │ ├── createForEach.js │ ├── createForIn.js │ ├── createForOwn.js │ ├── createHybridWrapper.js │ ├── createObjectMapper.js │ ├── createPadDir.js │ ├── createPadding.js │ ├── createPartial.js │ ├── createPartialWrapper.js │ ├── createReduce.js │ ├── createRound.js │ ├── createSortedIndex.js │ ├── createWrapper.js │ ├── deburrLetter.js │ ├── equalArrays.js │ ├── equalByTag.js │ ├── equalObjects.js │ ├── escapeHtmlChar.js │ ├── escapeRegExpChar.js │ ├── escapeStringChar.js │ ├── getData.js │ ├── getFuncName.js │ ├── getLength.js │ ├── getMatchData.js │ ├── getNative.js │ ├── getView.js │ ├── indexOfNaN.js │ ├── initCloneArray.js │ ├── initCloneByTag.js │ ├── initCloneObject.js │ ├── invokePath.js │ ├── isArrayLike.js │ ├── isHostObject.js │ ├── isIndex.js │ ├── isIterateeCall.js │ ├── isKey.js │ ├── isLaziable.js │ ├── isLength.js │ ├── isObjectLike.js │ ├── isSpace.js │ ├── isStrictComparable.js │ ├── lazyClone.js │ ├── lazyReverse.js │ ├── lazyValue.js │ ├── mapDelete.js │ ├── mapGet.js │ ├── mapHas.js │ ├── mapSet.js │ ├── mergeData.js │ ├── mergeDefaults.js │ ├── metaMap.js │ ├── pickByArray.js │ ├── pickByCallback.js │ ├── reEscape.js │ ├── reEvaluate.js │ ├── reInterpolate.js │ ├── realNames.js │ ├── reorder.js │ ├── replaceHolders.js │ ├── root.js │ ├── setData.js │ ├── shimKeys.js │ ├── sortedUniq.js │ ├── toIterable.js │ ├── toObject.js │ ├── toPath.js │ ├── trimmedLeftIndex.js │ ├── trimmedRightIndex.js │ ├── unescapeHtmlChar.js │ └── wrapperClone.js ├── lang.js ├── lang │ ├── clone.js │ ├── cloneDeep.js │ ├── eq.js │ ├── gt.js │ ├── gte.js │ ├── isArguments.js │ ├── isArray.js │ ├── isBoolean.js │ ├── isDate.js │ ├── isElement.js │ ├── isEmpty.js │ ├── isEqual.js │ ├── isError.js │ ├── isFinite.js │ ├── isFunction.js │ ├── isMatch.js │ ├── isNaN.js │ ├── isNative.js │ ├── isNull.js │ ├── isNumber.js │ ├── isObject.js │ ├── isPlainObject.js │ ├── isRegExp.js │ ├── isString.js │ ├── isTypedArray.js │ ├── isUndefined.js │ ├── lt.js │ ├── lte.js │ ├── toArray.js │ └── toPlainObject.js ├── main.js ├── math.js ├── math │ ├── add.js │ ├── ceil.js │ ├── floor.js │ ├── max.js │ ├── min.js │ ├── round.js │ └── sum.js ├── number.js ├── number │ ├── inRange.js │ └── random.js ├── object.js ├── object │ ├── assign.js │ ├── create.js │ ├── defaults.js │ ├── defaultsDeep.js │ ├── extend.js │ ├── findKey.js │ ├── findLastKey.js │ ├── forIn.js │ ├── forInRight.js │ ├── forOwn.js │ ├── forOwnRight.js │ ├── functions.js │ ├── get.js │ ├── has.js │ ├── invert.js │ ├── keys.js │ ├── keysIn.js │ ├── mapKeys.js │ ├── mapValues.js │ ├── merge.js │ ├── methods.js │ ├── omit.js │ ├── pairs.js │ ├── pick.js │ ├── result.js │ ├── set.js │ ├── transform.js │ ├── values.js │ └── valuesIn.js ├── string.js ├── string │ ├── camelCase.js │ ├── capitalize.js │ ├── deburr.js │ ├── endsWith.js │ ├── escape.js │ ├── escapeRegExp.js │ ├── kebabCase.js │ ├── pad.js │ ├── padLeft.js │ ├── padRight.js │ ├── parseInt.js │ ├── repeat.js │ ├── snakeCase.js │ ├── startCase.js │ ├── startsWith.js │ ├── template.js │ ├── templateSettings.js │ ├── trim.js │ ├── trimLeft.js │ ├── trimRight.js │ ├── trunc.js │ ├── unescape.js │ └── words.js ├── support.js ├── utility.js └── utility │ ├── attempt.js │ ├── callback.js │ ├── constant.js │ ├── identity.js │ ├── iteratee.js │ ├── matches.js │ ├── matchesProperty.js │ ├── method.js │ ├── methodOf.js │ ├── mixin.js │ ├── noop.js │ ├── property.js │ ├── propertyOf.js │ ├── range.js │ ├── times.js │ └── uniqueId.js ├── main.js ├── modern ├── array.js ├── array │ ├── chunk.js │ ├── compact.js │ ├── difference.js │ ├── drop.js │ ├── dropRight.js │ ├── dropRightWhile.js │ ├── dropWhile.js │ ├── fill.js │ ├── findIndex.js │ ├── findLastIndex.js │ ├── first.js │ ├── flatten.js │ ├── flattenDeep.js │ ├── head.js │ ├── indexOf.js │ ├── initial.js │ ├── intersection.js │ ├── last.js │ ├── lastIndexOf.js │ ├── object.js │ ├── pull.js │ ├── pullAt.js │ ├── remove.js │ ├── rest.js │ ├── slice.js │ ├── sortedIndex.js │ ├── sortedLastIndex.js │ ├── tail.js │ ├── take.js │ ├── takeRight.js │ ├── takeRightWhile.js │ ├── takeWhile.js │ ├── union.js │ ├── uniq.js │ ├── unique.js │ ├── unzip.js │ ├── unzipWith.js │ ├── without.js │ ├── xor.js │ ├── zip.js │ ├── zipObject.js │ └── zipWith.js ├── chain.js ├── chain │ ├── chain.js │ ├── commit.js │ ├── concat.js │ ├── lodash.js │ ├── plant.js │ ├── reverse.js │ ├── run.js │ ├── tap.js │ ├── thru.js │ ├── toJSON.js │ ├── toString.js │ ├── value.js │ ├── valueOf.js │ ├── wrapperChain.js │ ├── wrapperCommit.js │ ├── wrapperConcat.js │ ├── wrapperPlant.js │ ├── wrapperReverse.js │ ├── wrapperToString.js │ └── wrapperValue.js ├── collection.js ├── collection │ ├── all.js │ ├── any.js │ ├── at.js │ ├── collect.js │ ├── contains.js │ ├── countBy.js │ ├── detect.js │ ├── each.js │ ├── eachRight.js │ ├── every.js │ ├── filter.js │ ├── find.js │ ├── findLast.js │ ├── findWhere.js │ ├── foldl.js │ ├── foldr.js │ ├── forEach.js │ ├── forEachRight.js │ ├── groupBy.js │ ├── include.js │ ├── includes.js │ ├── indexBy.js │ ├── inject.js │ ├── invoke.js │ ├── map.js │ ├── max.js │ ├── min.js │ ├── partition.js │ ├── pluck.js │ ├── reduce.js │ ├── reduceRight.js │ ├── reject.js │ ├── sample.js │ ├── select.js │ ├── shuffle.js │ ├── size.js │ ├── some.js │ ├── sortBy.js │ ├── sortByAll.js │ ├── sortByOrder.js │ ├── sum.js │ └── where.js ├── date.js ├── date │ └── now.js ├── function.js ├── function │ ├── after.js │ ├── ary.js │ ├── backflow.js │ ├── before.js │ ├── bind.js │ ├── bindAll.js │ ├── bindKey.js │ ├── compose.js │ ├── curry.js │ ├── curryRight.js │ ├── debounce.js │ ├── defer.js │ ├── delay.js │ ├── flow.js │ ├── flowRight.js │ ├── memoize.js │ ├── modArgs.js │ ├── negate.js │ ├── once.js │ ├── partial.js │ ├── partialRight.js │ ├── rearg.js │ ├── restParam.js │ ├── spread.js │ ├── throttle.js │ └── wrap.js ├── internal │ ├── LazyWrapper.js │ ├── LodashWrapper.js │ ├── MapCache.js │ ├── SetCache.js │ ├── arrayConcat.js │ ├── arrayCopy.js │ ├── arrayEach.js │ ├── arrayEachRight.js │ ├── arrayEvery.js │ ├── arrayExtremum.js │ ├── arrayFilter.js │ ├── arrayMap.js │ ├── arrayPush.js │ ├── arrayReduce.js │ ├── arrayReduceRight.js │ ├── arraySome.js │ ├── arraySum.js │ ├── assignDefaults.js │ ├── assignOwnDefaults.js │ ├── assignWith.js │ ├── baseAssign.js │ ├── baseAt.js │ ├── baseCallback.js │ ├── baseClone.js │ ├── baseCompareAscending.js │ ├── baseCopy.js │ ├── baseCreate.js │ ├── baseDelay.js │ ├── baseDifference.js │ ├── baseEach.js │ ├── baseEachRight.js │ ├── baseEvery.js │ ├── baseExtremum.js │ ├── baseFill.js │ ├── baseFilter.js │ ├── baseFind.js │ ├── baseFindIndex.js │ ├── baseFlatten.js │ ├── baseFor.js │ ├── baseForIn.js │ ├── baseForOwn.js │ ├── baseForOwnRight.js │ ├── baseForRight.js │ ├── baseFunctions.js │ ├── baseGet.js │ ├── baseIndexOf.js │ ├── baseIsEqual.js │ ├── baseIsEqualDeep.js │ ├── baseIsFunction.js │ ├── baseIsMatch.js │ ├── baseLodash.js │ ├── baseMap.js │ ├── baseMatches.js │ ├── baseMatchesProperty.js │ ├── baseMerge.js │ ├── baseMergeDeep.js │ ├── baseProperty.js │ ├── basePropertyDeep.js │ ├── basePullAt.js │ ├── baseRandom.js │ ├── baseReduce.js │ ├── baseSetData.js │ ├── baseSlice.js │ ├── baseSome.js │ ├── baseSortBy.js │ ├── baseSortByOrder.js │ ├── baseSum.js │ ├── baseToString.js │ ├── baseUniq.js │ ├── baseValues.js │ ├── baseWhile.js │ ├── baseWrapperValue.js │ ├── binaryIndex.js │ ├── binaryIndexBy.js │ ├── bindCallback.js │ ├── bufferClone.js │ ├── cacheIndexOf.js │ ├── cachePush.js │ ├── charsLeftIndex.js │ ├── charsRightIndex.js │ ├── compareAscending.js │ ├── compareMultiple.js │ ├── composeArgs.js │ ├── composeArgsRight.js │ ├── createAggregator.js │ ├── createAssigner.js │ ├── createBaseEach.js │ ├── createBaseFor.js │ ├── createBindWrapper.js │ ├── createCache.js │ ├── createCompounder.js │ ├── createCtorWrapper.js │ ├── createCurry.js │ ├── createDefaults.js │ ├── createExtremum.js │ ├── createFind.js │ ├── createFindIndex.js │ ├── createFindKey.js │ ├── createFlow.js │ ├── createForEach.js │ ├── createForIn.js │ ├── createForOwn.js │ ├── createHybridWrapper.js │ ├── createObjectMapper.js │ ├── createPadDir.js │ ├── createPadding.js │ ├── createPartial.js │ ├── createPartialWrapper.js │ ├── createReduce.js │ ├── createRound.js │ ├── createSortedIndex.js │ ├── createWrapper.js │ ├── deburrLetter.js │ ├── equalArrays.js │ ├── equalByTag.js │ ├── equalObjects.js │ ├── escapeHtmlChar.js │ ├── escapeRegExpChar.js │ ├── escapeStringChar.js │ ├── getData.js │ ├── getFuncName.js │ ├── getLength.js │ ├── getMatchData.js │ ├── getNative.js │ ├── getView.js │ ├── indexOfNaN.js │ ├── initCloneArray.js │ ├── initCloneByTag.js │ ├── initCloneObject.js │ ├── invokePath.js │ ├── isArrayLike.js │ ├── isIndex.js │ ├── isIterateeCall.js │ ├── isKey.js │ ├── isLaziable.js │ ├── isLength.js │ ├── isObjectLike.js │ ├── isSpace.js │ ├── isStrictComparable.js │ ├── lazyClone.js │ ├── lazyReverse.js │ ├── lazyValue.js │ ├── mapDelete.js │ ├── mapGet.js │ ├── mapHas.js │ ├── mapSet.js │ ├── mergeData.js │ ├── mergeDefaults.js │ ├── metaMap.js │ ├── pickByArray.js │ ├── pickByCallback.js │ ├── reEscape.js │ ├── reEvaluate.js │ ├── reInterpolate.js │ ├── realNames.js │ ├── reorder.js │ ├── replaceHolders.js │ ├── root.js │ ├── setData.js │ ├── shimKeys.js │ ├── sortedUniq.js │ ├── toIterable.js │ ├── toObject.js │ ├── toPath.js │ ├── trimmedLeftIndex.js │ ├── trimmedRightIndex.js │ ├── unescapeHtmlChar.js │ └── wrapperClone.js ├── lang.js ├── lang │ ├── clone.js │ ├── cloneDeep.js │ ├── eq.js │ ├── gt.js │ ├── gte.js │ ├── isArguments.js │ ├── isArray.js │ ├── isBoolean.js │ ├── isDate.js │ ├── isElement.js │ ├── isEmpty.js │ ├── isEqual.js │ ├── isError.js │ ├── isFinite.js │ ├── isFunction.js │ ├── isMatch.js │ ├── isNaN.js │ ├── isNative.js │ ├── isNull.js │ ├── isNumber.js │ ├── isObject.js │ ├── isPlainObject.js │ ├── isRegExp.js │ ├── isString.js │ ├── isTypedArray.js │ ├── isUndefined.js │ ├── lt.js │ ├── lte.js │ ├── toArray.js │ └── toPlainObject.js ├── main.js ├── math.js ├── math │ ├── add.js │ ├── ceil.js │ ├── floor.js │ ├── max.js │ ├── min.js │ ├── round.js │ └── sum.js ├── number.js ├── number │ ├── inRange.js │ └── random.js ├── object.js ├── object │ ├── assign.js │ ├── create.js │ ├── defaults.js │ ├── defaultsDeep.js │ ├── extend.js │ ├── findKey.js │ ├── findLastKey.js │ ├── forIn.js │ ├── forInRight.js │ ├── forOwn.js │ ├── forOwnRight.js │ ├── functions.js │ ├── get.js │ ├── has.js │ ├── invert.js │ ├── keys.js │ ├── keysIn.js │ ├── mapKeys.js │ ├── mapValues.js │ ├── merge.js │ ├── methods.js │ ├── omit.js │ ├── pairs.js │ ├── pick.js │ ├── result.js │ ├── set.js │ ├── transform.js │ ├── values.js │ └── valuesIn.js ├── string.js ├── string │ ├── camelCase.js │ ├── capitalize.js │ ├── deburr.js │ ├── endsWith.js │ ├── escape.js │ ├── escapeRegExp.js │ ├── kebabCase.js │ ├── pad.js │ ├── padLeft.js │ ├── padRight.js │ ├── parseInt.js │ ├── repeat.js │ ├── snakeCase.js │ ├── startCase.js │ ├── startsWith.js │ ├── template.js │ ├── templateSettings.js │ ├── trim.js │ ├── trimLeft.js │ ├── trimRight.js │ ├── trunc.js │ ├── unescape.js │ └── words.js ├── support.js ├── utility.js └── utility │ ├── attempt.js │ ├── callback.js │ ├── constant.js │ ├── identity.js │ ├── iteratee.js │ ├── matches.js │ ├── matchesProperty.js │ ├── method.js │ ├── methodOf.js │ ├── mixin.js │ ├── noop.js │ ├── property.js │ ├── propertyOf.js │ ├── range.js │ ├── times.js │ └── uniqueId.js └── package.json /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.log 3 | node_modules 4 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .* 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # lodash-amd v3.10.2 2 | 3 | The compatibility & modern builds of [lodash](https://lodash.com/) exported as [AMD](https://github.com/amdjs/amdjs-api/wiki/AMD) modules. 4 | 5 | ## Discontinued 6 | 7 | This package has been discontinued in favor of [lodash@amd](https://github.com/lodash/lodash/tree/amd). 8 | 9 | ## Installation 10 | 11 | Defining a build as `'lodash'`. 12 | 13 | ```js 14 | require({ 15 | 'packages': [ 16 | { 'name': 'lodash', 'location': 'lodash-amd/modern' } 17 | ] 18 | }, ['lodash/array/chunk'], function(chunk) { 19 | // use `chunk` 20 | }); 21 | ``` 22 | 23 | See the [package source](https://github.com/lodash/lodash-amd/tree/3.10.2) for more details. 24 | -------------------------------------------------------------------------------- /compat/array/first.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * Gets the first element of `array`. 8 | * 9 | * @static 10 | * @memberOf _ 11 | * @alias head 12 | * @category Array 13 | * @param {Array} array The array to query. 14 | * @returns {*} Returns the first element of `array`. 15 | * @example 16 | * 17 | * _.first([1, 2, 3]); 18 | * // => 1 19 | * 20 | * _.first([]); 21 | * // => undefined 22 | */ 23 | function first(array) { 24 | return array ? array[0] : undefined; 25 | } 26 | 27 | return first; 28 | }); 29 | -------------------------------------------------------------------------------- /compat/array/flattenDeep.js: -------------------------------------------------------------------------------- 1 | define(['../internal/baseFlatten'], function(baseFlatten) { 2 | 3 | /** 4 | * Recursively flattens a nested array. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Array 9 | * @param {Array} array The array to recursively flatten. 10 | * @returns {Array} Returns the new flattened array. 11 | * @example 12 | * 13 | * _.flattenDeep([1, [2, 3, [4]]]); 14 | * // => [1, 2, 3, 4] 15 | */ 16 | function flattenDeep(array) { 17 | var length = array ? array.length : 0; 18 | return length ? baseFlatten(array, true) : []; 19 | } 20 | 21 | return flattenDeep; 22 | }); 23 | -------------------------------------------------------------------------------- /compat/array/head.js: -------------------------------------------------------------------------------- 1 | define(["./first"], function(first) { 2 | return first; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/array/initial.js: -------------------------------------------------------------------------------- 1 | define(['./dropRight'], function(dropRight) { 2 | 3 | /** 4 | * Gets all but the last element of `array`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Array 9 | * @param {Array} array The array to query. 10 | * @returns {Array} Returns the slice of `array`. 11 | * @example 12 | * 13 | * _.initial([1, 2, 3]); 14 | * // => [1, 2] 15 | */ 16 | function initial(array) { 17 | return dropRight(array, 1); 18 | } 19 | 20 | return initial; 21 | }); 22 | -------------------------------------------------------------------------------- /compat/array/last.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * Gets the last element of `array`. 8 | * 9 | * @static 10 | * @memberOf _ 11 | * @category Array 12 | * @param {Array} array The array to query. 13 | * @returns {*} Returns the last element of `array`. 14 | * @example 15 | * 16 | * _.last([1, 2, 3]); 17 | * // => 3 18 | */ 19 | function last(array) { 20 | var length = array ? array.length : 0; 21 | return length ? array[length - 1] : undefined; 22 | } 23 | 24 | return last; 25 | }); 26 | -------------------------------------------------------------------------------- /compat/array/object.js: -------------------------------------------------------------------------------- 1 | define(["./zipObject"], function(zipObject) { 2 | return zipObject; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/array/rest.js: -------------------------------------------------------------------------------- 1 | define(['./drop'], function(drop) { 2 | 3 | /** 4 | * Gets all but the first element of `array`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @alias tail 9 | * @category Array 10 | * @param {Array} array The array to query. 11 | * @returns {Array} Returns the slice of `array`. 12 | * @example 13 | * 14 | * _.rest([1, 2, 3]); 15 | * // => [2, 3] 16 | */ 17 | function rest(array) { 18 | return drop(array, 1); 19 | } 20 | 21 | return rest; 22 | }); 23 | -------------------------------------------------------------------------------- /compat/array/tail.js: -------------------------------------------------------------------------------- 1 | define(["./rest"], function(rest) { 2 | return rest; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/array/union.js: -------------------------------------------------------------------------------- 1 | define(['../internal/baseFlatten', '../internal/baseUniq', '../function/restParam'], function(baseFlatten, baseUniq, restParam) { 2 | 3 | /** 4 | * Creates an array of unique values, in order, from all of the provided arrays 5 | * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) 6 | * for equality comparisons. 7 | * 8 | * @static 9 | * @memberOf _ 10 | * @category Array 11 | * @param {...Array} [arrays] The arrays to inspect. 12 | * @returns {Array} Returns the new array of combined values. 13 | * @example 14 | * 15 | * _.union([1, 2], [4, 2], [2, 1]); 16 | * // => [1, 2, 4] 17 | */ 18 | var union = restParam(function(arrays) { 19 | return baseUniq(baseFlatten(arrays, false, true)); 20 | }); 21 | 22 | return union; 23 | }); 24 | -------------------------------------------------------------------------------- /compat/array/unique.js: -------------------------------------------------------------------------------- 1 | define(["./uniq"], function(uniq) { 2 | return uniq; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/array/zip.js: -------------------------------------------------------------------------------- 1 | define(['../function/restParam', './unzip'], function(restParam, unzip) { 2 | 3 | /** 4 | * Creates an array of grouped elements, the first of which contains the first 5 | * elements of the given arrays, the second of which contains the second elements 6 | * of the given arrays, and so on. 7 | * 8 | * @static 9 | * @memberOf _ 10 | * @category Array 11 | * @param {...Array} [arrays] The arrays to process. 12 | * @returns {Array} Returns the new array of grouped elements. 13 | * @example 14 | * 15 | * _.zip(['fred', 'barney'], [30, 40], [true, false]); 16 | * // => [['fred', 30, true], ['barney', 40, false]] 17 | */ 18 | var zip = restParam(unzip); 19 | 20 | return zip; 21 | }); 22 | -------------------------------------------------------------------------------- /compat/chain.js: -------------------------------------------------------------------------------- 1 | define(['./chain/chain', './chain/commit', './chain/concat', './chain/lodash', './chain/plant', './chain/reverse', './chain/run', './chain/tap', './chain/thru', './chain/toJSON', './chain/toString', './chain/value', './chain/valueOf', './chain/wrapperChain'], function(chain, commit, concat, lodash, plant, reverse, run, tap, thru, toJSON, toString, value, valueOf, wrapperChain) { 2 | return { 3 | 'chain': chain, 4 | 'commit': commit, 5 | 'concat': concat, 6 | 'lodash': lodash, 7 | 'plant': plant, 8 | 'reverse': reverse, 9 | 'run': run, 10 | 'tap': tap, 11 | 'thru': thru, 12 | 'toJSON': toJSON, 13 | 'toString': toString, 14 | 'value': value, 15 | 'valueOf': valueOf, 16 | 'wrapperChain': wrapperChain 17 | }; 18 | }); 19 | -------------------------------------------------------------------------------- /compat/chain/commit.js: -------------------------------------------------------------------------------- 1 | define(["./wrapperCommit"], function(wrapperCommit) { 2 | return wrapperCommit; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/chain/concat.js: -------------------------------------------------------------------------------- 1 | define(["./wrapperConcat"], function(wrapperConcat) { 2 | return wrapperConcat; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/chain/plant.js: -------------------------------------------------------------------------------- 1 | define(["./wrapperPlant"], function(wrapperPlant) { 2 | return wrapperPlant; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/chain/reverse.js: -------------------------------------------------------------------------------- 1 | define(["./wrapperReverse"], function(wrapperReverse) { 2 | return wrapperReverse; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/chain/run.js: -------------------------------------------------------------------------------- 1 | define(["./wrapperValue"], function(wrapperValue) { 2 | return wrapperValue; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/chain/thru.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * This method is like `_.tap` except that it returns the result of `interceptor`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Chain 9 | * @param {*} value The value to provide to `interceptor`. 10 | * @param {Function} interceptor The function to invoke. 11 | * @param {*} [thisArg] The `this` binding of `interceptor`. 12 | * @returns {*} Returns the result of `interceptor`. 13 | * @example 14 | * 15 | * _(' abc ') 16 | * .chain() 17 | * .trim() 18 | * .thru(function(value) { 19 | * return [value]; 20 | * }) 21 | * .value(); 22 | * // => ['abc'] 23 | */ 24 | function thru(value, interceptor, thisArg) { 25 | return interceptor.call(thisArg, value); 26 | } 27 | 28 | return thru; 29 | }); 30 | -------------------------------------------------------------------------------- /compat/chain/toJSON.js: -------------------------------------------------------------------------------- 1 | define(["./wrapperValue"], function(wrapperValue) { 2 | return wrapperValue; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/chain/toString.js: -------------------------------------------------------------------------------- 1 | define(["./wrapperToString"], function(wrapperToString) { 2 | return wrapperToString; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/chain/value.js: -------------------------------------------------------------------------------- 1 | define(["./wrapperValue"], function(wrapperValue) { 2 | return wrapperValue; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/chain/valueOf.js: -------------------------------------------------------------------------------- 1 | define(["./wrapperValue"], function(wrapperValue) { 2 | return wrapperValue; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/chain/wrapperChain.js: -------------------------------------------------------------------------------- 1 | define(['./chain'], function(chain) { 2 | 3 | /** 4 | * Enables explicit method chaining on the wrapper object. 5 | * 6 | * @name chain 7 | * @memberOf _ 8 | * @category Chain 9 | * @returns {Object} Returns the new `lodash` wrapper instance. 10 | * @example 11 | * 12 | * var users = [ 13 | * { 'user': 'barney', 'age': 36 }, 14 | * { 'user': 'fred', 'age': 40 } 15 | * ]; 16 | * 17 | * // without explicit chaining 18 | * _(users).first(); 19 | * // => { 'user': 'barney', 'age': 36 } 20 | * 21 | * // with explicit chaining 22 | * _(users).chain() 23 | * .first() 24 | * .pick('user') 25 | * .value(); 26 | * // => { 'user': 'barney' } 27 | */ 28 | function wrapperChain() { 29 | return chain(this); 30 | } 31 | 32 | return wrapperChain; 33 | }); 34 | -------------------------------------------------------------------------------- /compat/chain/wrapperCommit.js: -------------------------------------------------------------------------------- 1 | define(['../internal/LodashWrapper'], function(LodashWrapper) { 2 | 3 | /** 4 | * Executes the chained sequence and returns the wrapped result. 5 | * 6 | * @name commit 7 | * @memberOf _ 8 | * @category Chain 9 | * @returns {Object} Returns the new `lodash` wrapper instance. 10 | * @example 11 | * 12 | * var array = [1, 2]; 13 | * var wrapped = _(array).push(3); 14 | * 15 | * console.log(array); 16 | * // => [1, 2] 17 | * 18 | * wrapped = wrapped.commit(); 19 | * console.log(array); 20 | * // => [1, 2, 3] 21 | * 22 | * wrapped.last(); 23 | * // => 3 24 | * 25 | * console.log(array); 26 | * // => [1, 2, 3] 27 | */ 28 | function wrapperCommit() { 29 | return new LodashWrapper(this.value(), this.__chain__); 30 | } 31 | 32 | return wrapperCommit; 33 | }); 34 | -------------------------------------------------------------------------------- /compat/chain/wrapperToString.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Produces the result of coercing the unwrapped value to a string. 5 | * 6 | * @name toString 7 | * @memberOf _ 8 | * @category Chain 9 | * @returns {string} Returns the coerced string value. 10 | * @example 11 | * 12 | * _([1, 2, 3]).toString(); 13 | * // => '1,2,3' 14 | */ 15 | function wrapperToString() { 16 | return (this.value() + ''); 17 | } 18 | 19 | return wrapperToString; 20 | }); 21 | -------------------------------------------------------------------------------- /compat/chain/wrapperValue.js: -------------------------------------------------------------------------------- 1 | define(['../internal/baseWrapperValue'], function(baseWrapperValue) { 2 | 3 | /** 4 | * Executes the chained sequence to extract the unwrapped value. 5 | * 6 | * @name value 7 | * @memberOf _ 8 | * @alias run, toJSON, valueOf 9 | * @category Chain 10 | * @returns {*} Returns the resolved unwrapped value. 11 | * @example 12 | * 13 | * _([1, 2, 3]).value(); 14 | * // => [1, 2, 3] 15 | */ 16 | function wrapperValue() { 17 | return baseWrapperValue(this.__wrapped__, this.__actions__); 18 | } 19 | 20 | return wrapperValue; 21 | }); 22 | -------------------------------------------------------------------------------- /compat/collection/all.js: -------------------------------------------------------------------------------- 1 | define(["./every"], function(every) { 2 | return every; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/collection/any.js: -------------------------------------------------------------------------------- 1 | define(["./some"], function(some) { 2 | return some; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/collection/collect.js: -------------------------------------------------------------------------------- 1 | define(["./map"], function(map) { 2 | return map; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/collection/contains.js: -------------------------------------------------------------------------------- 1 | define(["./includes"], function(includes) { 2 | return includes; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/collection/detect.js: -------------------------------------------------------------------------------- 1 | define(["./find"], function(find) { 2 | return find; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/collection/each.js: -------------------------------------------------------------------------------- 1 | define(["./forEach"], function(forEach) { 2 | return forEach; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/collection/eachRight.js: -------------------------------------------------------------------------------- 1 | define(["./forEachRight"], function(forEachRight) { 2 | return forEachRight; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/collection/foldl.js: -------------------------------------------------------------------------------- 1 | define(["./reduce"], function(reduce) { 2 | return reduce; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/collection/foldr.js: -------------------------------------------------------------------------------- 1 | define(["./reduceRight"], function(reduceRight) { 2 | return reduceRight; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/collection/include.js: -------------------------------------------------------------------------------- 1 | define(["./includes"], function(includes) { 2 | return includes; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/collection/inject.js: -------------------------------------------------------------------------------- 1 | define(["./reduce"], function(reduce) { 2 | return reduce; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/collection/max.js: -------------------------------------------------------------------------------- 1 | define(["../math/max"], function(max) { 2 | return max; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/collection/min.js: -------------------------------------------------------------------------------- 1 | define(["../math/min"], function(min) { 2 | return min; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/collection/select.js: -------------------------------------------------------------------------------- 1 | define(["./filter"], function(filter) { 2 | return filter; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/collection/shuffle.js: -------------------------------------------------------------------------------- 1 | define(['./sample'], function(sample) { 2 | 3 | /** Used as references for `-Infinity` and `Infinity`. */ 4 | var POSITIVE_INFINITY = Number.POSITIVE_INFINITY; 5 | 6 | /** 7 | * Creates an array of shuffled values, using a version of the 8 | * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). 9 | * 10 | * @static 11 | * @memberOf _ 12 | * @category Collection 13 | * @param {Array|Object|string} collection The collection to shuffle. 14 | * @returns {Array} Returns the new shuffled array. 15 | * @example 16 | * 17 | * _.shuffle([1, 2, 3, 4]); 18 | * // => [4, 1, 3, 2] 19 | */ 20 | function shuffle(collection) { 21 | return sample(collection, POSITIVE_INFINITY); 22 | } 23 | 24 | return shuffle; 25 | }); 26 | -------------------------------------------------------------------------------- /compat/collection/sum.js: -------------------------------------------------------------------------------- 1 | define(["../math/sum"], function(sum) { 2 | return sum; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/date.js: -------------------------------------------------------------------------------- 1 | define(['./date/now'], function(now) { 2 | return { 3 | 'now': now 4 | }; 5 | }); 6 | -------------------------------------------------------------------------------- /compat/date/now.js: -------------------------------------------------------------------------------- 1 | define(['../internal/getNative'], function(getNative) { 2 | 3 | /* Native method references for those with the same name as other `lodash` methods. */ 4 | var nativeNow = getNative(Date, 'now'); 5 | 6 | /** 7 | * Gets the number of milliseconds that have elapsed since the Unix epoch 8 | * (1 January 1970 00:00:00 UTC). 9 | * 10 | * @static 11 | * @memberOf _ 12 | * @category Date 13 | * @example 14 | * 15 | * _.defer(function(stamp) { 16 | * console.log(_.now() - stamp); 17 | * }, _.now()); 18 | * // => logs the number of milliseconds it took for the deferred function to be invoked 19 | */ 20 | var now = nativeNow || function() { 21 | return new Date().getTime(); 22 | }; 23 | 24 | return now; 25 | }); 26 | -------------------------------------------------------------------------------- /compat/function/backflow.js: -------------------------------------------------------------------------------- 1 | define(["./flowRight"], function(flowRight) { 2 | return flowRight; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/function/compose.js: -------------------------------------------------------------------------------- 1 | define(["./flowRight"], function(flowRight) { 2 | return flowRight; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/function/defer.js: -------------------------------------------------------------------------------- 1 | define(['../internal/baseDelay', './restParam'], function(baseDelay, restParam) { 2 | 3 | /** 4 | * Defers invoking the `func` until the current call stack has cleared. Any 5 | * additional arguments are provided to `func` when it's invoked. 6 | * 7 | * @static 8 | * @memberOf _ 9 | * @category Function 10 | * @param {Function} func The function to defer. 11 | * @param {...*} [args] The arguments to invoke the function with. 12 | * @returns {number} Returns the timer id. 13 | * @example 14 | * 15 | * _.defer(function(text) { 16 | * console.log(text); 17 | * }, 'deferred'); 18 | * // logs 'deferred' after one or more milliseconds 19 | */ 20 | var defer = restParam(function(func, args) { 21 | return baseDelay(func, 1, args); 22 | }); 23 | 24 | return defer; 25 | }); 26 | -------------------------------------------------------------------------------- /compat/function/flow.js: -------------------------------------------------------------------------------- 1 | define(['../internal/createFlow'], function(createFlow) { 2 | 3 | /** 4 | * Creates a function that returns the result of invoking the provided 5 | * functions with the `this` binding of the created function, where each 6 | * successive invocation is supplied the return value of the previous. 7 | * 8 | * @static 9 | * @memberOf _ 10 | * @category Function 11 | * @param {...Function} [funcs] Functions to invoke. 12 | * @returns {Function} Returns the new function. 13 | * @example 14 | * 15 | * function square(n) { 16 | * return n * n; 17 | * } 18 | * 19 | * var addSquare = _.flow(_.add, square); 20 | * addSquare(1, 2); 21 | * // => 9 22 | */ 23 | var flow = createFlow(); 24 | 25 | return flow; 26 | }); 27 | -------------------------------------------------------------------------------- /compat/function/flowRight.js: -------------------------------------------------------------------------------- 1 | define(['../internal/createFlow'], function(createFlow) { 2 | 3 | /** 4 | * This method is like `_.flow` except that it creates a function that 5 | * invokes the provided functions from right to left. 6 | * 7 | * @static 8 | * @memberOf _ 9 | * @alias backflow, compose 10 | * @category Function 11 | * @param {...Function} [funcs] Functions to invoke. 12 | * @returns {Function} Returns the new function. 13 | * @example 14 | * 15 | * function square(n) { 16 | * return n * n; 17 | * } 18 | * 19 | * var addSquare = _.flowRight(square, _.add); 20 | * addSquare(1, 2); 21 | * // => 9 22 | */ 23 | var flowRight = createFlow(true); 24 | 25 | return flowRight; 26 | }); 27 | -------------------------------------------------------------------------------- /compat/function/once.js: -------------------------------------------------------------------------------- 1 | define(['./before'], function(before) { 2 | 3 | /** 4 | * Creates a function that is restricted to invoking `func` once. Repeat calls 5 | * to the function return the value of the first call. The `func` is invoked 6 | * with the `this` binding and arguments of the created function. 7 | * 8 | * @static 9 | * @memberOf _ 10 | * @category Function 11 | * @param {Function} func The function to restrict. 12 | * @returns {Function} Returns the new restricted function. 13 | * @example 14 | * 15 | * var initialize = _.once(createApplication); 16 | * initialize(); 17 | * initialize(); 18 | * // `initialize` invokes `createApplication` once 19 | */ 20 | function once(func) { 21 | return before(2, func); 22 | } 23 | 24 | return once; 25 | }); 26 | -------------------------------------------------------------------------------- /compat/internal/LazyWrapper.js: -------------------------------------------------------------------------------- 1 | define(['./baseCreate', './baseLodash'], function(baseCreate, baseLodash) { 2 | 3 | /** Used as references for `-Infinity` and `Infinity`. */ 4 | var POSITIVE_INFINITY = Number.POSITIVE_INFINITY; 5 | 6 | /** 7 | * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. 8 | * 9 | * @private 10 | * @param {*} value The value to wrap. 11 | */ 12 | function LazyWrapper(value) { 13 | this.__wrapped__ = value; 14 | this.__actions__ = []; 15 | this.__dir__ = 1; 16 | this.__filtered__ = false; 17 | this.__iteratees__ = []; 18 | this.__takeCount__ = POSITIVE_INFINITY; 19 | this.__views__ = []; 20 | } 21 | 22 | LazyWrapper.prototype = baseCreate(baseLodash.prototype); 23 | LazyWrapper.prototype.constructor = LazyWrapper; 24 | 25 | return LazyWrapper; 26 | }); 27 | -------------------------------------------------------------------------------- /compat/internal/LodashWrapper.js: -------------------------------------------------------------------------------- 1 | define(['./baseCreate', './baseLodash'], function(baseCreate, baseLodash) { 2 | 3 | /** 4 | * The base constructor for creating `lodash` wrapper objects. 5 | * 6 | * @private 7 | * @param {*} value The value to wrap. 8 | * @param {boolean} [chainAll] Enable chaining for all wrapper methods. 9 | * @param {Array} [actions=[]] Actions to peform to resolve the unwrapped value. 10 | */ 11 | function LodashWrapper(value, chainAll, actions) { 12 | this.__wrapped__ = value; 13 | this.__actions__ = actions || []; 14 | this.__chain__ = !!chainAll; 15 | } 16 | 17 | LodashWrapper.prototype = baseCreate(baseLodash.prototype); 18 | LodashWrapper.prototype.constructor = LodashWrapper; 19 | 20 | return LodashWrapper; 21 | }); 22 | -------------------------------------------------------------------------------- /compat/internal/MapCache.js: -------------------------------------------------------------------------------- 1 | define(['./mapDelete', './mapGet', './mapHas', './mapSet'], function(mapDelete, mapGet, mapHas, mapSet) { 2 | 3 | /** 4 | * Creates a cache object to store key/value pairs. 5 | * 6 | * @private 7 | * @static 8 | * @name Cache 9 | * @memberOf _.memoize 10 | */ 11 | function MapCache() { 12 | this.__data__ = {}; 13 | } 14 | 15 | // Add functions to the `Map` cache. 16 | MapCache.prototype['delete'] = mapDelete; 17 | MapCache.prototype.get = mapGet; 18 | MapCache.prototype.has = mapHas; 19 | MapCache.prototype.set = mapSet; 20 | 21 | return MapCache; 22 | }); 23 | -------------------------------------------------------------------------------- /compat/internal/arrayConcat.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Creates a new array joining `array` with `other`. 5 | * 6 | * @private 7 | * @param {Array} array The array to join. 8 | * @param {Array} other The other array to join. 9 | * @returns {Array} Returns the new concatenated array. 10 | */ 11 | function arrayConcat(array, other) { 12 | var index = -1, 13 | length = array.length, 14 | othIndex = -1, 15 | othLength = other.length, 16 | result = Array(length + othLength); 17 | 18 | while (++index < length) { 19 | result[index] = array[index]; 20 | } 21 | while (++othIndex < othLength) { 22 | result[index++] = other[othIndex]; 23 | } 24 | return result; 25 | } 26 | 27 | return arrayConcat; 28 | }); 29 | -------------------------------------------------------------------------------- /compat/internal/arrayCopy.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Copies the values of `source` to `array`. 5 | * 6 | * @private 7 | * @param {Array} source The array to copy values from. 8 | * @param {Array} [array=[]] The array to copy values to. 9 | * @returns {Array} Returns `array`. 10 | */ 11 | function arrayCopy(source, array) { 12 | var index = -1, 13 | length = source.length; 14 | 15 | array || (array = Array(length)); 16 | while (++index < length) { 17 | array[index] = source[index]; 18 | } 19 | return array; 20 | } 21 | 22 | return arrayCopy; 23 | }); 24 | -------------------------------------------------------------------------------- /compat/internal/arrayEach.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * A specialized version of `_.forEach` for arrays without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Array} array The array to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @returns {Array} Returns `array`. 11 | */ 12 | function arrayEach(array, iteratee) { 13 | var index = -1, 14 | length = array.length; 15 | 16 | while (++index < length) { 17 | if (iteratee(array[index], index, array) === false) { 18 | break; 19 | } 20 | } 21 | return array; 22 | } 23 | 24 | return arrayEach; 25 | }); 26 | -------------------------------------------------------------------------------- /compat/internal/arrayEachRight.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * A specialized version of `_.forEachRight` for arrays without support for 5 | * callback shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Array} array The array to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @returns {Array} Returns `array`. 11 | */ 12 | function arrayEachRight(array, iteratee) { 13 | var length = array.length; 14 | 15 | while (length--) { 16 | if (iteratee(array[length], length, array) === false) { 17 | break; 18 | } 19 | } 20 | return array; 21 | } 22 | 23 | return arrayEachRight; 24 | }); 25 | -------------------------------------------------------------------------------- /compat/internal/arrayEvery.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * A specialized version of `_.every` for arrays without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Array} array The array to iterate over. 9 | * @param {Function} predicate The function invoked per iteration. 10 | * @returns {boolean} Returns `true` if all elements pass the predicate check, 11 | * else `false`. 12 | */ 13 | function arrayEvery(array, predicate) { 14 | var index = -1, 15 | length = array.length; 16 | 17 | while (++index < length) { 18 | if (!predicate(array[index], index, array)) { 19 | return false; 20 | } 21 | } 22 | return true; 23 | } 24 | 25 | return arrayEvery; 26 | }); 27 | -------------------------------------------------------------------------------- /compat/internal/arrayFilter.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * A specialized version of `_.filter` for arrays without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Array} array The array to iterate over. 9 | * @param {Function} predicate The function invoked per iteration. 10 | * @returns {Array} Returns the new filtered array. 11 | */ 12 | function arrayFilter(array, predicate) { 13 | var index = -1, 14 | length = array.length, 15 | resIndex = -1, 16 | result = []; 17 | 18 | while (++index < length) { 19 | var value = array[index]; 20 | if (predicate(value, index, array)) { 21 | result[++resIndex] = value; 22 | } 23 | } 24 | return result; 25 | } 26 | 27 | return arrayFilter; 28 | }); 29 | -------------------------------------------------------------------------------- /compat/internal/arrayMap.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * A specialized version of `_.map` for arrays without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Array} array The array to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @returns {Array} Returns the new mapped array. 11 | */ 12 | function arrayMap(array, iteratee) { 13 | var index = -1, 14 | length = array.length, 15 | result = Array(length); 16 | 17 | while (++index < length) { 18 | result[index] = iteratee(array[index], index, array); 19 | } 20 | return result; 21 | } 22 | 23 | return arrayMap; 24 | }); 25 | -------------------------------------------------------------------------------- /compat/internal/arrayPush.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Appends the elements of `values` to `array`. 5 | * 6 | * @private 7 | * @param {Array} array The array to modify. 8 | * @param {Array} values The values to append. 9 | * @returns {Array} Returns `array`. 10 | */ 11 | function arrayPush(array, values) { 12 | var index = -1, 13 | length = values.length, 14 | offset = array.length; 15 | 16 | while (++index < length) { 17 | array[offset + index] = values[index]; 18 | } 19 | return array; 20 | } 21 | 22 | return arrayPush; 23 | }); 24 | -------------------------------------------------------------------------------- /compat/internal/arraySome.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * A specialized version of `_.some` for arrays without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Array} array The array to iterate over. 9 | * @param {Function} predicate The function invoked per iteration. 10 | * @returns {boolean} Returns `true` if any element passes the predicate check, 11 | * else `false`. 12 | */ 13 | function arraySome(array, predicate) { 14 | var index = -1, 15 | length = array.length; 16 | 17 | while (++index < length) { 18 | if (predicate(array[index], index, array)) { 19 | return true; 20 | } 21 | } 22 | return false; 23 | } 24 | 25 | return arraySome; 26 | }); 27 | -------------------------------------------------------------------------------- /compat/internal/arraySum.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * A specialized version of `_.sum` for arrays without support for callback 5 | * shorthands and `this` binding.. 6 | * 7 | * @private 8 | * @param {Array} array The array to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @returns {number} Returns the sum. 11 | */ 12 | function arraySum(array, iteratee) { 13 | var length = array.length, 14 | result = 0; 15 | 16 | while (length--) { 17 | result += +iteratee(array[length]) || 0; 18 | } 19 | return result; 20 | } 21 | 22 | return arraySum; 23 | }); 24 | -------------------------------------------------------------------------------- /compat/internal/assignDefaults.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * Used by `_.defaults` to customize its `_.assign` use. 8 | * 9 | * @private 10 | * @param {*} objectValue The destination object property value. 11 | * @param {*} sourceValue The source object property value. 12 | * @returns {*} Returns the value to assign to the destination object. 13 | */ 14 | function assignDefaults(objectValue, sourceValue) { 15 | return objectValue === undefined ? sourceValue : objectValue; 16 | } 17 | 18 | return assignDefaults; 19 | }); 20 | -------------------------------------------------------------------------------- /compat/internal/baseAssign.js: -------------------------------------------------------------------------------- 1 | define(['./baseCopy', '../object/keys'], function(baseCopy, keys) { 2 | 3 | /** 4 | * The base implementation of `_.assign` without support for argument juggling, 5 | * multiple sources, and `customizer` functions. 6 | * 7 | * @private 8 | * @param {Object} object The destination object. 9 | * @param {Object} source The source object. 10 | * @returns {Object} Returns `object`. 11 | */ 12 | function baseAssign(object, source) { 13 | return source == null 14 | ? object 15 | : baseCopy(source, keys(source), object); 16 | } 17 | 18 | return baseAssign; 19 | }); 20 | -------------------------------------------------------------------------------- /compat/internal/baseCopy.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Copies properties of `source` to `object`. 5 | * 6 | * @private 7 | * @param {Object} source The object to copy properties from. 8 | * @param {Array} props The property names to copy. 9 | * @param {Object} [object={}] The object to copy properties to. 10 | * @returns {Object} Returns `object`. 11 | */ 12 | function baseCopy(source, props, object) { 13 | object || (object = {}); 14 | 15 | var index = -1, 16 | length = props.length; 17 | 18 | while (++index < length) { 19 | var key = props[index]; 20 | object[key] = source[key]; 21 | } 22 | return object; 23 | } 24 | 25 | return baseCopy; 26 | }); 27 | -------------------------------------------------------------------------------- /compat/internal/baseCreate.js: -------------------------------------------------------------------------------- 1 | define(['../lang/isObject'], function(isObject) { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * The base implementation of `_.create` without support for assigning 8 | * properties to the created object. 9 | * 10 | * @private 11 | * @param {Object} prototype The object to inherit from. 12 | * @returns {Object} Returns the new object. 13 | */ 14 | var baseCreate = (function() { 15 | function object() {} 16 | return function(prototype) { 17 | if (isObject(prototype)) { 18 | object.prototype = prototype; 19 | var result = new object; 20 | object.prototype = undefined; 21 | } 22 | return result || {}; 23 | }; 24 | }()); 25 | 26 | return baseCreate; 27 | }); 28 | -------------------------------------------------------------------------------- /compat/internal/baseEach.js: -------------------------------------------------------------------------------- 1 | define(['./baseForOwn', './createBaseEach'], function(baseForOwn, createBaseEach) { 2 | 3 | /** 4 | * The base implementation of `_.forEach` without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Array|Object|string} collection The collection to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @returns {Array|Object|string} Returns `collection`. 11 | */ 12 | var baseEach = createBaseEach(baseForOwn); 13 | 14 | return baseEach; 15 | }); 16 | -------------------------------------------------------------------------------- /compat/internal/baseEachRight.js: -------------------------------------------------------------------------------- 1 | define(['./baseForOwnRight', './createBaseEach'], function(baseForOwnRight, createBaseEach) { 2 | 3 | /** 4 | * The base implementation of `_.forEachRight` without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Array|Object|string} collection The collection to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @returns {Array|Object|string} Returns `collection`. 11 | */ 12 | var baseEachRight = createBaseEach(baseForOwnRight, true); 13 | 14 | return baseEachRight; 15 | }); 16 | -------------------------------------------------------------------------------- /compat/internal/baseEvery.js: -------------------------------------------------------------------------------- 1 | define(['./baseEach'], function(baseEach) { 2 | 3 | /** 4 | * The base implementation of `_.every` without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Array|Object|string} collection The collection to iterate over. 9 | * @param {Function} predicate The function invoked per iteration. 10 | * @returns {boolean} Returns `true` if all elements pass the predicate check, 11 | * else `false` 12 | */ 13 | function baseEvery(collection, predicate) { 14 | var result = true; 15 | baseEach(collection, function(value, index, collection) { 16 | result = !!predicate(value, index, collection); 17 | return result; 18 | }); 19 | return result; 20 | } 21 | 22 | return baseEvery; 23 | }); 24 | -------------------------------------------------------------------------------- /compat/internal/baseFilter.js: -------------------------------------------------------------------------------- 1 | define(['./baseEach'], function(baseEach) { 2 | 3 | /** 4 | * The base implementation of `_.filter` without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Array|Object|string} collection The collection to iterate over. 9 | * @param {Function} predicate The function invoked per iteration. 10 | * @returns {Array} Returns the new filtered array. 11 | */ 12 | function baseFilter(collection, predicate) { 13 | var result = []; 14 | baseEach(collection, function(value, index, collection) { 15 | if (predicate(value, index, collection)) { 16 | result.push(value); 17 | } 18 | }); 19 | return result; 20 | } 21 | 22 | return baseFilter; 23 | }); 24 | -------------------------------------------------------------------------------- /compat/internal/baseFor.js: -------------------------------------------------------------------------------- 1 | define(['./createBaseFor'], function(createBaseFor) { 2 | 3 | /** 4 | * The base implementation of `baseForIn` and `baseForOwn` which iterates 5 | * over `object` properties returned by `keysFunc` invoking `iteratee` for 6 | * each property. Iteratee functions may exit iteration early by explicitly 7 | * returning `false`. 8 | * 9 | * @private 10 | * @param {Object} object The object to iterate over. 11 | * @param {Function} iteratee The function invoked per iteration. 12 | * @param {Function} keysFunc The function to get the keys of `object`. 13 | * @returns {Object} Returns `object`. 14 | */ 15 | var baseFor = createBaseFor(); 16 | 17 | return baseFor; 18 | }); 19 | -------------------------------------------------------------------------------- /compat/internal/baseForIn.js: -------------------------------------------------------------------------------- 1 | define(['./baseFor', '../object/keysIn'], function(baseFor, keysIn) { 2 | 3 | /** 4 | * The base implementation of `_.forIn` without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Object} object The object to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @returns {Object} Returns `object`. 11 | */ 12 | function baseForIn(object, iteratee) { 13 | return baseFor(object, iteratee, keysIn); 14 | } 15 | 16 | return baseForIn; 17 | }); 18 | -------------------------------------------------------------------------------- /compat/internal/baseForOwn.js: -------------------------------------------------------------------------------- 1 | define(['./baseFor', '../object/keys'], function(baseFor, keys) { 2 | 3 | /** 4 | * The base implementation of `_.forOwn` without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Object} object The object to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @returns {Object} Returns `object`. 11 | */ 12 | function baseForOwn(object, iteratee) { 13 | return baseFor(object, iteratee, keys); 14 | } 15 | 16 | return baseForOwn; 17 | }); 18 | -------------------------------------------------------------------------------- /compat/internal/baseForOwnRight.js: -------------------------------------------------------------------------------- 1 | define(['./baseForRight', '../object/keys'], function(baseForRight, keys) { 2 | 3 | /** 4 | * The base implementation of `_.forOwnRight` without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Object} object The object to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @returns {Object} Returns `object`. 11 | */ 12 | function baseForOwnRight(object, iteratee) { 13 | return baseForRight(object, iteratee, keys); 14 | } 15 | 16 | return baseForOwnRight; 17 | }); 18 | -------------------------------------------------------------------------------- /compat/internal/baseForRight.js: -------------------------------------------------------------------------------- 1 | define(['./createBaseFor'], function(createBaseFor) { 2 | 3 | /** 4 | * This function is like `baseFor` except that it iterates over properties 5 | * in the opposite order. 6 | * 7 | * @private 8 | * @param {Object} object The object to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @param {Function} keysFunc The function to get the keys of `object`. 11 | * @returns {Object} Returns `object`. 12 | */ 13 | var baseForRight = createBaseFor(true); 14 | 15 | return baseForRight; 16 | }); 17 | -------------------------------------------------------------------------------- /compat/internal/baseIsFunction.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * The base implementation of `_.isFunction` without support for environments 5 | * with incorrect `typeof` results. 6 | * 7 | * @private 8 | * @param {*} value The value to check. 9 | * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. 10 | */ 11 | function baseIsFunction(value) { 12 | // Avoid a Chakra JIT bug in compatibility modes of IE 11. 13 | // See https://github.com/jashkenas/underscore/issues/1621 for more details. 14 | return typeof value == 'function' || false; 15 | } 16 | 17 | return baseIsFunction; 18 | }); 19 | -------------------------------------------------------------------------------- /compat/internal/baseLodash.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * The function whose prototype all chaining wrappers inherit from. 5 | * 6 | * @private 7 | */ 8 | function baseLodash() { 9 | // No operation performed. 10 | } 11 | 12 | return baseLodash; 13 | }); 14 | -------------------------------------------------------------------------------- /compat/internal/baseMap.js: -------------------------------------------------------------------------------- 1 | define(['./baseEach', './isArrayLike'], function(baseEach, isArrayLike) { 2 | 3 | /** 4 | * The base implementation of `_.map` without support for callback shorthands 5 | * and `this` binding. 6 | * 7 | * @private 8 | * @param {Array|Object|string} collection The collection to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @returns {Array} Returns the new mapped array. 11 | */ 12 | function baseMap(collection, iteratee) { 13 | var index = -1, 14 | result = isArrayLike(collection) ? Array(collection.length) : []; 15 | 16 | baseEach(collection, function(value, key, collection) { 17 | result[++index] = iteratee(value, key, collection); 18 | }); 19 | return result; 20 | } 21 | 22 | return baseMap; 23 | }); 24 | -------------------------------------------------------------------------------- /compat/internal/baseProperty.js: -------------------------------------------------------------------------------- 1 | define(['./toObject'], function(toObject) { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * The base implementation of `_.property` without support for deep paths. 8 | * 9 | * @private 10 | * @param {string} key The key of the property to get. 11 | * @returns {Function} Returns the new function. 12 | */ 13 | function baseProperty(key) { 14 | return function(object) { 15 | return object == null ? undefined : toObject(object)[key]; 16 | }; 17 | } 18 | 19 | return baseProperty; 20 | }); 21 | -------------------------------------------------------------------------------- /compat/internal/basePropertyDeep.js: -------------------------------------------------------------------------------- 1 | define(['./baseGet', './toPath'], function(baseGet, toPath) { 2 | 3 | /** 4 | * A specialized version of `baseProperty` which supports deep paths. 5 | * 6 | * @private 7 | * @param {Array|string} path The path of the property to get. 8 | * @returns {Function} Returns the new function. 9 | */ 10 | function basePropertyDeep(path) { 11 | var pathKey = (path + ''); 12 | path = toPath(path); 13 | return function(object) { 14 | return baseGet(object, path, pathKey); 15 | }; 16 | } 17 | 18 | return basePropertyDeep; 19 | }); 20 | -------------------------------------------------------------------------------- /compat/internal/baseRandom.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /* Native method references for those with the same name as other `lodash` methods. */ 4 | var nativeFloor = Math.floor, 5 | nativeRandom = Math.random; 6 | 7 | /** 8 | * The base implementation of `_.random` without support for argument juggling 9 | * and returning floating-point numbers. 10 | * 11 | * @private 12 | * @param {number} min The minimum possible value. 13 | * @param {number} max The maximum possible value. 14 | * @returns {number} Returns the random number. 15 | */ 16 | function baseRandom(min, max) { 17 | return min + nativeFloor(nativeRandom() * (max - min + 1)); 18 | } 19 | 20 | return baseRandom; 21 | }); 22 | -------------------------------------------------------------------------------- /compat/internal/baseSetData.js: -------------------------------------------------------------------------------- 1 | define(['../utility/identity', './metaMap'], function(identity, metaMap) { 2 | 3 | /** 4 | * The base implementation of `setData` without support for hot loop detection. 5 | * 6 | * @private 7 | * @param {Function} func The function to associate metadata with. 8 | * @param {*} data The metadata. 9 | * @returns {Function} Returns `func`. 10 | */ 11 | var baseSetData = !metaMap ? identity : function(func, data) { 12 | metaMap.set(func, data); 13 | return func; 14 | }; 15 | 16 | return baseSetData; 17 | }); 18 | -------------------------------------------------------------------------------- /compat/internal/baseSome.js: -------------------------------------------------------------------------------- 1 | define(['./baseEach'], function(baseEach) { 2 | 3 | /** 4 | * The base implementation of `_.some` without support for callback shorthands 5 | * and `this` binding. 6 | * 7 | * @private 8 | * @param {Array|Object|string} collection The collection to iterate over. 9 | * @param {Function} predicate The function invoked per iteration. 10 | * @returns {boolean} Returns `true` if any element passes the predicate check, 11 | * else `false`. 12 | */ 13 | function baseSome(collection, predicate) { 14 | var result; 15 | 16 | baseEach(collection, function(value, index, collection) { 17 | result = predicate(value, index, collection); 18 | return !result; 19 | }); 20 | return !!result; 21 | } 22 | 23 | return baseSome; 24 | }); 25 | -------------------------------------------------------------------------------- /compat/internal/baseSortBy.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * The base implementation of `_.sortBy` which uses `comparer` to define 5 | * the sort order of `array` and replaces criteria objects with their 6 | * corresponding values. 7 | * 8 | * @private 9 | * @param {Array} array The array to sort. 10 | * @param {Function} comparer The function to define sort order. 11 | * @returns {Array} Returns `array`. 12 | */ 13 | function baseSortBy(array, comparer) { 14 | var length = array.length; 15 | 16 | array.sort(comparer); 17 | while (length--) { 18 | array[length] = array[length].value; 19 | } 20 | return array; 21 | } 22 | 23 | return baseSortBy; 24 | }); 25 | -------------------------------------------------------------------------------- /compat/internal/baseSum.js: -------------------------------------------------------------------------------- 1 | define(['./baseEach'], function(baseEach) { 2 | 3 | /** 4 | * The base implementation of `_.sum` without support for callback shorthands 5 | * and `this` binding. 6 | * 7 | * @private 8 | * @param {Array|Object|string} collection The collection to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @returns {number} Returns the sum. 11 | */ 12 | function baseSum(collection, iteratee) { 13 | var result = 0; 14 | baseEach(collection, function(value, index, collection) { 15 | result += +iteratee(value, index, collection) || 0; 16 | }); 17 | return result; 18 | } 19 | 20 | return baseSum; 21 | }); 22 | -------------------------------------------------------------------------------- /compat/internal/baseToString.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Converts `value` to a string if it's not one. An empty string is returned 5 | * for `null` or `undefined` values. 6 | * 7 | * @private 8 | * @param {*} value The value to process. 9 | * @returns {string} Returns the string. 10 | */ 11 | function baseToString(value) { 12 | return value == null ? '' : (value + ''); 13 | } 14 | 15 | return baseToString; 16 | }); 17 | -------------------------------------------------------------------------------- /compat/internal/baseValues.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * The base implementation of `_.values` and `_.valuesIn` which creates an 5 | * array of `object` property values corresponding to the property names 6 | * of `props`. 7 | * 8 | * @private 9 | * @param {Object} object The object to query. 10 | * @param {Array} props The property names to get values for. 11 | * @returns {Object} Returns the array of property values. 12 | */ 13 | function baseValues(object, props) { 14 | var index = -1, 15 | length = props.length, 16 | result = Array(length); 17 | 18 | while (++index < length) { 19 | result[index] = object[props[index]]; 20 | } 21 | return result; 22 | } 23 | 24 | return baseValues; 25 | }); 26 | -------------------------------------------------------------------------------- /compat/internal/bufferClone.js: -------------------------------------------------------------------------------- 1 | define(['./root'], function(root) { 2 | 3 | /** Native method references. */ 4 | var ArrayBuffer = root.ArrayBuffer, 5 | Uint8Array = root.Uint8Array; 6 | 7 | /** 8 | * Creates a clone of the given array buffer. 9 | * 10 | * @private 11 | * @param {ArrayBuffer} buffer The array buffer to clone. 12 | * @returns {ArrayBuffer} Returns the cloned array buffer. 13 | */ 14 | function bufferClone(buffer) { 15 | var result = new ArrayBuffer(buffer.byteLength), 16 | view = new Uint8Array(result); 17 | 18 | view.set(new Uint8Array(buffer)); 19 | return result; 20 | } 21 | 22 | return bufferClone; 23 | }); 24 | -------------------------------------------------------------------------------- /compat/internal/cacheIndexOf.js: -------------------------------------------------------------------------------- 1 | define(['../lang/isObject'], function(isObject) { 2 | 3 | /** 4 | * Checks if `value` is in `cache` mimicking the return signature of 5 | * `_.indexOf` by returning `0` if the value is found, else `-1`. 6 | * 7 | * @private 8 | * @param {Object} cache The cache to search. 9 | * @param {*} value The value to search for. 10 | * @returns {number} Returns `0` if `value` is found, else `-1`. 11 | */ 12 | function cacheIndexOf(cache, value) { 13 | var data = cache.data, 14 | result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value]; 15 | 16 | return result ? 0 : -1; 17 | } 18 | 19 | return cacheIndexOf; 20 | }); 21 | -------------------------------------------------------------------------------- /compat/internal/cachePush.js: -------------------------------------------------------------------------------- 1 | define(['../lang/isObject'], function(isObject) { 2 | 3 | /** 4 | * Adds `value` to the cache. 5 | * 6 | * @private 7 | * @name push 8 | * @memberOf SetCache 9 | * @param {*} value The value to cache. 10 | */ 11 | function cachePush(value) { 12 | var data = this.data; 13 | if (typeof value == 'string' || isObject(value)) { 14 | data.set.add(value); 15 | } else { 16 | data.hash[value] = true; 17 | } 18 | } 19 | 20 | return cachePush; 21 | }); 22 | -------------------------------------------------------------------------------- /compat/internal/charsLeftIndex.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Used by `_.trim` and `_.trimLeft` to get the index of the first character 5 | * of `string` that is not found in `chars`. 6 | * 7 | * @private 8 | * @param {string} string The string to inspect. 9 | * @param {string} chars The characters to find. 10 | * @returns {number} Returns the index of the first character not found in `chars`. 11 | */ 12 | function charsLeftIndex(string, chars) { 13 | var index = -1, 14 | length = string.length; 15 | 16 | while (++index < length && chars.indexOf(string.charAt(index)) > -1) {} 17 | return index; 18 | } 19 | 20 | return charsLeftIndex; 21 | }); 22 | -------------------------------------------------------------------------------- /compat/internal/charsRightIndex.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Used by `_.trim` and `_.trimRight` to get the index of the last character 5 | * of `string` that is not found in `chars`. 6 | * 7 | * @private 8 | * @param {string} string The string to inspect. 9 | * @param {string} chars The characters to find. 10 | * @returns {number} Returns the index of the last character not found in `chars`. 11 | */ 12 | function charsRightIndex(string, chars) { 13 | var index = string.length; 14 | 15 | while (index-- && chars.indexOf(string.charAt(index)) > -1) {} 16 | return index; 17 | } 18 | 19 | return charsRightIndex; 20 | }); 21 | -------------------------------------------------------------------------------- /compat/internal/compareAscending.js: -------------------------------------------------------------------------------- 1 | define(['./baseCompareAscending'], function(baseCompareAscending) { 2 | 3 | /** 4 | * Used by `_.sortBy` to compare transformed elements of a collection and stable 5 | * sort them in ascending order. 6 | * 7 | * @private 8 | * @param {Object} object The object to compare. 9 | * @param {Object} other The other object to compare. 10 | * @returns {number} Returns the sort order indicator for `object`. 11 | */ 12 | function compareAscending(object, other) { 13 | return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index); 14 | } 15 | 16 | return compareAscending; 17 | }); 18 | -------------------------------------------------------------------------------- /compat/internal/createBindWrapper.js: -------------------------------------------------------------------------------- 1 | define(['./createCtorWrapper', './root'], function(createCtorWrapper, root) { 2 | 3 | /** 4 | * Creates a function that wraps `func` and invokes it with the `this` 5 | * binding of `thisArg`. 6 | * 7 | * @private 8 | * @param {Function} func The function to bind. 9 | * @param {*} [thisArg] The `this` binding of `func`. 10 | * @returns {Function} Returns the new bound function. 11 | */ 12 | function createBindWrapper(func, thisArg) { 13 | var Ctor = createCtorWrapper(func); 14 | 15 | function wrapper() { 16 | var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 17 | return fn.apply(thisArg, arguments); 18 | } 19 | return wrapper; 20 | } 21 | 22 | return createBindWrapper; 23 | }); 24 | -------------------------------------------------------------------------------- /compat/internal/createCache.js: -------------------------------------------------------------------------------- 1 | define(['./SetCache', './getNative', './root'], function(SetCache, getNative, root) { 2 | 3 | /** Native method references. */ 4 | var Set = getNative(root, 'Set'); 5 | 6 | /* Native method references for those with the same name as other `lodash` methods. */ 7 | var nativeCreate = getNative(Object, 'create'); 8 | 9 | /** 10 | * Creates a `Set` cache object to optimize linear searches of large arrays. 11 | * 12 | * @private 13 | * @param {Array} [values] The values to cache. 14 | * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`. 15 | */ 16 | function createCache(values) { 17 | return (nativeCreate && Set) ? new SetCache(values) : null; 18 | } 19 | 20 | return createCache; 21 | }); 22 | -------------------------------------------------------------------------------- /compat/internal/createCompounder.js: -------------------------------------------------------------------------------- 1 | define(['../string/deburr', '../string/words'], function(deburr, words) { 2 | 3 | /** 4 | * Creates a function that produces compound words out of the words in a 5 | * given string. 6 | * 7 | * @private 8 | * @param {Function} callback The function to combine each word. 9 | * @returns {Function} Returns the new compounder function. 10 | */ 11 | function createCompounder(callback) { 12 | return function(string) { 13 | var index = -1, 14 | array = words(deburr(string)), 15 | length = array.length, 16 | result = ''; 17 | 18 | while (++index < length) { 19 | result = callback(result, array[index], index); 20 | } 21 | return result; 22 | }; 23 | } 24 | 25 | return createCompounder; 26 | }); 27 | -------------------------------------------------------------------------------- /compat/internal/createFindIndex.js: -------------------------------------------------------------------------------- 1 | define(['./baseCallback', './baseFindIndex'], function(baseCallback, baseFindIndex) { 2 | 3 | /** 4 | * Creates a `_.findIndex` or `_.findLastIndex` function. 5 | * 6 | * @private 7 | * @param {boolean} [fromRight] Specify iterating from right to left. 8 | * @returns {Function} Returns the new find function. 9 | */ 10 | function createFindIndex(fromRight) { 11 | return function(array, predicate, thisArg) { 12 | if (!(array && array.length)) { 13 | return -1; 14 | } 15 | predicate = baseCallback(predicate, thisArg, 3); 16 | return baseFindIndex(array, predicate, fromRight); 17 | }; 18 | } 19 | 20 | return createFindIndex; 21 | }); 22 | -------------------------------------------------------------------------------- /compat/internal/createFindKey.js: -------------------------------------------------------------------------------- 1 | define(['./baseCallback', './baseFind'], function(baseCallback, baseFind) { 2 | 3 | /** 4 | * Creates a `_.findKey` or `_.findLastKey` function. 5 | * 6 | * @private 7 | * @param {Function} objectFunc The function to iterate over an object. 8 | * @returns {Function} Returns the new find function. 9 | */ 10 | function createFindKey(objectFunc) { 11 | return function(object, predicate, thisArg) { 12 | predicate = baseCallback(predicate, thisArg, 3); 13 | return baseFind(object, predicate, objectFunc, true); 14 | }; 15 | } 16 | 17 | return createFindKey; 18 | }); 19 | -------------------------------------------------------------------------------- /compat/internal/createForIn.js: -------------------------------------------------------------------------------- 1 | define(['./bindCallback', '../object/keysIn'], function(bindCallback, keysIn) { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * Creates a function for `_.forIn` or `_.forInRight`. 8 | * 9 | * @private 10 | * @param {Function} objectFunc The function to iterate over an object. 11 | * @returns {Function} Returns the new each function. 12 | */ 13 | function createForIn(objectFunc) { 14 | return function(object, iteratee, thisArg) { 15 | if (typeof iteratee != 'function' || thisArg !== undefined) { 16 | iteratee = bindCallback(iteratee, thisArg, 3); 17 | } 18 | return objectFunc(object, iteratee, keysIn); 19 | }; 20 | } 21 | 22 | return createForIn; 23 | }); 24 | -------------------------------------------------------------------------------- /compat/internal/createForOwn.js: -------------------------------------------------------------------------------- 1 | define(['./bindCallback'], function(bindCallback) { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * Creates a function for `_.forOwn` or `_.forOwnRight`. 8 | * 9 | * @private 10 | * @param {Function} objectFunc The function to iterate over an object. 11 | * @returns {Function} Returns the new each function. 12 | */ 13 | function createForOwn(objectFunc) { 14 | return function(object, iteratee, thisArg) { 15 | if (typeof iteratee != 'function' || thisArg !== undefined) { 16 | iteratee = bindCallback(iteratee, thisArg, 3); 17 | } 18 | return objectFunc(object, iteratee); 19 | }; 20 | } 21 | 22 | return createForOwn; 23 | }); 24 | -------------------------------------------------------------------------------- /compat/internal/createPadDir.js: -------------------------------------------------------------------------------- 1 | define(['./baseToString', './createPadding'], function(baseToString, createPadding) { 2 | 3 | /** 4 | * Creates a function for `_.padLeft` or `_.padRight`. 5 | * 6 | * @private 7 | * @param {boolean} [fromRight] Specify padding from the right. 8 | * @returns {Function} Returns the new pad function. 9 | */ 10 | function createPadDir(fromRight) { 11 | return function(string, length, chars) { 12 | string = baseToString(string); 13 | return (fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string); 14 | }; 15 | } 16 | 17 | return createPadDir; 18 | }); 19 | -------------------------------------------------------------------------------- /compat/internal/createPartial.js: -------------------------------------------------------------------------------- 1 | define(['./createWrapper', './replaceHolders', '../function/restParam'], function(createWrapper, replaceHolders, restParam) { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * Creates a `_.partial` or `_.partialRight` function. 8 | * 9 | * @private 10 | * @param {boolean} flag The partial bit flag. 11 | * @returns {Function} Returns the new partial function. 12 | */ 13 | function createPartial(flag) { 14 | var partialFunc = restParam(function(func, partials) { 15 | var holders = replaceHolders(partials, partialFunc.placeholder); 16 | return createWrapper(func, flag, undefined, partials, holders); 17 | }); 18 | return partialFunc; 19 | } 20 | 21 | return createPartial; 22 | }); 23 | -------------------------------------------------------------------------------- /compat/internal/createSortedIndex.js: -------------------------------------------------------------------------------- 1 | define(['./baseCallback', './binaryIndex', './binaryIndexBy'], function(baseCallback, binaryIndex, binaryIndexBy) { 2 | 3 | /** 4 | * Creates a `_.sortedIndex` or `_.sortedLastIndex` function. 5 | * 6 | * @private 7 | * @param {boolean} [retHighest] Specify returning the highest qualified index. 8 | * @returns {Function} Returns the new index function. 9 | */ 10 | function createSortedIndex(retHighest) { 11 | return function(array, value, iteratee, thisArg) { 12 | return iteratee == null 13 | ? binaryIndex(array, value, retHighest) 14 | : binaryIndexBy(array, value, baseCallback(iteratee, thisArg, 1), retHighest); 15 | }; 16 | } 17 | 18 | return createSortedIndex; 19 | }); 20 | -------------------------------------------------------------------------------- /compat/internal/escapeHtmlChar.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used to map characters to HTML entities. */ 4 | var htmlEscapes = { 5 | '&': '&', 6 | '<': '<', 7 | '>': '>', 8 | '"': '"', 9 | "'": ''', 10 | '`': '`' 11 | }; 12 | 13 | /** 14 | * Used by `_.escape` to convert characters to HTML entities. 15 | * 16 | * @private 17 | * @param {string} chr The matched character to escape. 18 | * @returns {string} Returns the escaped character. 19 | */ 20 | function escapeHtmlChar(chr) { 21 | return htmlEscapes[chr]; 22 | } 23 | 24 | return escapeHtmlChar; 25 | }); 26 | -------------------------------------------------------------------------------- /compat/internal/escapeStringChar.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used to escape characters for inclusion in compiled string literals. */ 4 | var stringEscapes = { 5 | '\\': '\\', 6 | "'": "'", 7 | '\n': 'n', 8 | '\r': 'r', 9 | '\u2028': 'u2028', 10 | '\u2029': 'u2029' 11 | }; 12 | 13 | /** 14 | * Used by `_.template` to escape characters for inclusion in compiled string literals. 15 | * 16 | * @private 17 | * @param {string} chr The matched character to escape. 18 | * @returns {string} Returns the escaped character. 19 | */ 20 | function escapeStringChar(chr) { 21 | return '\\' + stringEscapes[chr]; 22 | } 23 | 24 | return escapeStringChar; 25 | }); 26 | -------------------------------------------------------------------------------- /compat/internal/getData.js: -------------------------------------------------------------------------------- 1 | define(['./metaMap', '../utility/noop'], function(metaMap, noop) { 2 | 3 | /** 4 | * Gets metadata for `func`. 5 | * 6 | * @private 7 | * @param {Function} func The function to query. 8 | * @returns {*} Returns the metadata for `func`. 9 | */ 10 | var getData = !metaMap ? noop : function(func) { 11 | return metaMap.get(func); 12 | }; 13 | 14 | return getData; 15 | }); 16 | -------------------------------------------------------------------------------- /compat/internal/getFuncName.js: -------------------------------------------------------------------------------- 1 | define(['./realNames'], function(realNames) { 2 | 3 | /** 4 | * Gets the name of `func`. 5 | * 6 | * @private 7 | * @param {Function} func The function to query. 8 | * @returns {string} Returns the function name. 9 | */ 10 | function getFuncName(func) { 11 | var result = (func.name + ''), 12 | array = realNames[result], 13 | length = array ? array.length : 0; 14 | 15 | while (length--) { 16 | var data = array[length], 17 | otherFunc = data.func; 18 | if (otherFunc == null || otherFunc == func) { 19 | return data.name; 20 | } 21 | } 22 | return result; 23 | } 24 | 25 | return getFuncName; 26 | }); 27 | -------------------------------------------------------------------------------- /compat/internal/getLength.js: -------------------------------------------------------------------------------- 1 | define(['./baseProperty'], function(baseProperty) { 2 | 3 | /** 4 | * Gets the "length" property value of `object`. 5 | * 6 | * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) 7 | * that affects Safari on at least iOS 8.1-8.3 ARM64. 8 | * 9 | * @private 10 | * @param {Object} object The object to query. 11 | * @returns {*} Returns the "length" value. 12 | */ 13 | var getLength = baseProperty('length'); 14 | 15 | return getLength; 16 | }); 17 | -------------------------------------------------------------------------------- /compat/internal/getMatchData.js: -------------------------------------------------------------------------------- 1 | define(['./isStrictComparable', '../object/pairs'], function(isStrictComparable, pairs) { 2 | 3 | /** 4 | * Gets the propery names, values, and compare flags of `object`. 5 | * 6 | * @private 7 | * @param {Object} object The object to query. 8 | * @returns {Array} Returns the match data of `object`. 9 | */ 10 | function getMatchData(object) { 11 | var result = pairs(object), 12 | length = result.length; 13 | 14 | while (length--) { 15 | result[length][2] = isStrictComparable(result[length][1]); 16 | } 17 | return result; 18 | } 19 | 20 | return getMatchData; 21 | }); 22 | -------------------------------------------------------------------------------- /compat/internal/getNative.js: -------------------------------------------------------------------------------- 1 | define(['../lang/isNative'], function(isNative) { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * Gets the native function at `key` of `object`. 8 | * 9 | * @private 10 | * @param {Object} object The object to query. 11 | * @param {string} key The key of the method to get. 12 | * @returns {*} Returns the function if it's native, else `undefined`. 13 | */ 14 | function getNative(object, key) { 15 | var value = object == null ? undefined : object[key]; 16 | return isNative(value) ? value : undefined; 17 | } 18 | 19 | return getNative; 20 | }); 21 | -------------------------------------------------------------------------------- /compat/internal/indexOfNaN.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Gets the index at which the first occurrence of `NaN` is found in `array`. 5 | * 6 | * @private 7 | * @param {Array} array The array to search. 8 | * @param {number} fromIndex The index to search from. 9 | * @param {boolean} [fromRight] Specify iterating from right to left. 10 | * @returns {number} Returns the index of the matched `NaN`, else `-1`. 11 | */ 12 | function indexOfNaN(array, fromIndex, fromRight) { 13 | var length = array.length, 14 | index = fromIndex + (fromRight ? 0 : -1); 15 | 16 | while ((fromRight ? index-- : ++index < length)) { 17 | var other = array[index]; 18 | if (other !== other) { 19 | return index; 20 | } 21 | } 22 | return -1; 23 | } 24 | 25 | return indexOfNaN; 26 | }); 27 | -------------------------------------------------------------------------------- /compat/internal/initCloneObject.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Initializes an object clone. 5 | * 6 | * @private 7 | * @param {Object} object The object to clone. 8 | * @returns {Object} Returns the initialized clone. 9 | */ 10 | function initCloneObject(object) { 11 | var Ctor = object.constructor; 12 | if (!(typeof Ctor == 'function' && Ctor instanceof Ctor)) { 13 | Ctor = Object; 14 | } 15 | return new Ctor; 16 | } 17 | 18 | return initCloneObject; 19 | }); 20 | -------------------------------------------------------------------------------- /compat/internal/isArrayLike.js: -------------------------------------------------------------------------------- 1 | define(['./getLength', './isLength'], function(getLength, isLength) { 2 | 3 | /** 4 | * Checks if `value` is array-like. 5 | * 6 | * @private 7 | * @param {*} value The value to check. 8 | * @returns {boolean} Returns `true` if `value` is array-like, else `false`. 9 | */ 10 | function isArrayLike(value) { 11 | return value != null && isLength(getLength(value)); 12 | } 13 | 14 | return isArrayLike; 15 | }); 16 | -------------------------------------------------------------------------------- /compat/internal/isHostObject.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Checks if `value` is a host object in IE < 9. 5 | * 6 | * @private 7 | * @param {*} value The value to check. 8 | * @returns {boolean} Returns `true` if `value` is a host object, else `false`. 9 | */ 10 | var isHostObject = (function() { 11 | try { 12 | Object({ 'toString': 0 } + ''); 13 | } catch(e) { 14 | return function() { return false; }; 15 | } 16 | return function(value) { 17 | // IE < 9 presents many host objects as `Object` objects that can coerce 18 | // to strings despite having improperly defined `toString` methods. 19 | return typeof value.toString != 'function' && typeof (value + '') == 'string'; 20 | }; 21 | }()); 22 | 23 | return isHostObject; 24 | }); 25 | -------------------------------------------------------------------------------- /compat/internal/isLaziable.js: -------------------------------------------------------------------------------- 1 | define(['./LazyWrapper', './getData', './getFuncName', '../chain/lodash'], function(LazyWrapper, getData, getFuncName, lodash) { 2 | 3 | /** 4 | * Checks if `func` has a lazy counterpart. 5 | * 6 | * @private 7 | * @param {Function} func The function to check. 8 | * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`. 9 | */ 10 | function isLaziable(func) { 11 | var funcName = getFuncName(func), 12 | other = lodash[funcName]; 13 | 14 | if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { 15 | return false; 16 | } 17 | if (func === other) { 18 | return true; 19 | } 20 | var data = getData(other); 21 | return !!data && func === data[0]; 22 | } 23 | 24 | return isLaziable; 25 | }); 26 | -------------------------------------------------------------------------------- /compat/internal/isLength.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) 5 | * of an array-like value. 6 | */ 7 | var MAX_SAFE_INTEGER = 9007199254740991; 8 | 9 | /** 10 | * Checks if `value` is a valid array-like length. 11 | * 12 | * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). 13 | * 14 | * @private 15 | * @param {*} value The value to check. 16 | * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. 17 | */ 18 | function isLength(value) { 19 | return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; 20 | } 21 | 22 | return isLength; 23 | }); 24 | -------------------------------------------------------------------------------- /compat/internal/isObjectLike.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Checks if `value` is object-like. 5 | * 6 | * @private 7 | * @param {*} value The value to check. 8 | * @returns {boolean} Returns `true` if `value` is object-like, else `false`. 9 | */ 10 | function isObjectLike(value) { 11 | return !!value && typeof value == 'object'; 12 | } 13 | 14 | return isObjectLike; 15 | }); 16 | -------------------------------------------------------------------------------- /compat/internal/isSpace.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Used by `trimmedLeftIndex` and `trimmedRightIndex` to determine if a 5 | * character code is whitespace. 6 | * 7 | * @private 8 | * @param {number} charCode The character code to inspect. 9 | * @returns {boolean} Returns `true` if `charCode` is whitespace, else `false`. 10 | */ 11 | function isSpace(charCode) { 12 | return ((charCode <= 160 && (charCode >= 9 && charCode <= 13) || charCode == 32 || charCode == 160) || charCode == 5760 || charCode == 6158 || 13 | (charCode >= 8192 && (charCode <= 8202 || charCode == 8232 || charCode == 8233 || charCode == 8239 || charCode == 8287 || charCode == 12288 || charCode == 65279))); 14 | } 15 | 16 | return isSpace; 17 | }); 18 | -------------------------------------------------------------------------------- /compat/internal/isStrictComparable.js: -------------------------------------------------------------------------------- 1 | define(['../lang/isObject'], function(isObject) { 2 | 3 | /** 4 | * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. 5 | * 6 | * @private 7 | * @param {*} value The value to check. 8 | * @returns {boolean} Returns `true` if `value` if suitable for strict 9 | * equality comparisons, else `false`. 10 | */ 11 | function isStrictComparable(value) { 12 | return value === value && !isObject(value); 13 | } 14 | 15 | return isStrictComparable; 16 | }); 17 | -------------------------------------------------------------------------------- /compat/internal/lazyClone.js: -------------------------------------------------------------------------------- 1 | define(['./LazyWrapper', './arrayCopy'], function(LazyWrapper, arrayCopy) { 2 | 3 | /** 4 | * Creates a clone of the lazy wrapper object. 5 | * 6 | * @private 7 | * @name clone 8 | * @memberOf LazyWrapper 9 | * @returns {Object} Returns the cloned `LazyWrapper` object. 10 | */ 11 | function lazyClone() { 12 | var result = new LazyWrapper(this.__wrapped__); 13 | result.__actions__ = arrayCopy(this.__actions__); 14 | result.__dir__ = this.__dir__; 15 | result.__filtered__ = this.__filtered__; 16 | result.__iteratees__ = arrayCopy(this.__iteratees__); 17 | result.__takeCount__ = this.__takeCount__; 18 | result.__views__ = arrayCopy(this.__views__); 19 | return result; 20 | } 21 | 22 | return lazyClone; 23 | }); 24 | -------------------------------------------------------------------------------- /compat/internal/lazyReverse.js: -------------------------------------------------------------------------------- 1 | define(['./LazyWrapper'], function(LazyWrapper) { 2 | 3 | /** 4 | * Reverses the direction of lazy iteration. 5 | * 6 | * @private 7 | * @name reverse 8 | * @memberOf LazyWrapper 9 | * @returns {Object} Returns the new reversed `LazyWrapper` object. 10 | */ 11 | function lazyReverse() { 12 | if (this.__filtered__) { 13 | var result = new LazyWrapper(this); 14 | result.__dir__ = -1; 15 | result.__filtered__ = true; 16 | } else { 17 | result = this.clone(); 18 | result.__dir__ *= -1; 19 | } 20 | return result; 21 | } 22 | 23 | return lazyReverse; 24 | }); 25 | -------------------------------------------------------------------------------- /compat/internal/mapDelete.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Removes `key` and its value from the cache. 5 | * 6 | * @private 7 | * @name delete 8 | * @memberOf _.memoize.Cache 9 | * @param {string} key The key of the value to remove. 10 | * @returns {boolean} Returns `true` if the entry was removed successfully, else `false`. 11 | */ 12 | function mapDelete(key) { 13 | return this.has(key) && delete this.__data__[key]; 14 | } 15 | 16 | return mapDelete; 17 | }); 18 | -------------------------------------------------------------------------------- /compat/internal/mapGet.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * Gets the cached value for `key`. 8 | * 9 | * @private 10 | * @name get 11 | * @memberOf _.memoize.Cache 12 | * @param {string} key The key of the value to get. 13 | * @returns {*} Returns the cached value. 14 | */ 15 | function mapGet(key) { 16 | return key == '__proto__' ? undefined : this.__data__[key]; 17 | } 18 | 19 | return mapGet; 20 | }); 21 | -------------------------------------------------------------------------------- /compat/internal/mapHas.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used for native method references. */ 4 | var objectProto = Object.prototype; 5 | 6 | /** Used to check objects for own properties. */ 7 | var hasOwnProperty = objectProto.hasOwnProperty; 8 | 9 | /** 10 | * Checks if a cached value for `key` exists. 11 | * 12 | * @private 13 | * @name has 14 | * @memberOf _.memoize.Cache 15 | * @param {string} key The key of the entry to check. 16 | * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 17 | */ 18 | function mapHas(key) { 19 | return key != '__proto__' && hasOwnProperty.call(this.__data__, key); 20 | } 21 | 22 | return mapHas; 23 | }); 24 | -------------------------------------------------------------------------------- /compat/internal/mapSet.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Sets `value` to `key` of the cache. 5 | * 6 | * @private 7 | * @name set 8 | * @memberOf _.memoize.Cache 9 | * @param {string} key The key of the value to cache. 10 | * @param {*} value The value to cache. 11 | * @returns {Object} Returns the cache object. 12 | */ 13 | function mapSet(key, value) { 14 | if (key != '__proto__') { 15 | this.__data__[key] = value; 16 | } 17 | return this; 18 | } 19 | 20 | return mapSet; 21 | }); 22 | -------------------------------------------------------------------------------- /compat/internal/mergeDefaults.js: -------------------------------------------------------------------------------- 1 | define(['../object/merge'], function(merge) { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * Used by `_.defaultsDeep` to customize its `_.merge` use. 8 | * 9 | * @private 10 | * @param {*} objectValue The destination object property value. 11 | * @param {*} sourceValue The source object property value. 12 | * @returns {*} Returns the value to assign to the destination object. 13 | */ 14 | function mergeDefaults(objectValue, sourceValue) { 15 | return objectValue === undefined ? sourceValue : merge(objectValue, sourceValue, mergeDefaults); 16 | } 17 | 18 | return mergeDefaults; 19 | }); 20 | -------------------------------------------------------------------------------- /compat/internal/metaMap.js: -------------------------------------------------------------------------------- 1 | define(['./getNative', './root'], function(getNative, root) { 2 | 3 | /** Native method references. */ 4 | var WeakMap = getNative(root, 'WeakMap'); 5 | 6 | /** Used to store function metadata. */ 7 | var metaMap = WeakMap && new WeakMap; 8 | 9 | return metaMap; 10 | }); 11 | -------------------------------------------------------------------------------- /compat/internal/pickByArray.js: -------------------------------------------------------------------------------- 1 | define(['./toObject'], function(toObject) { 2 | 3 | /** 4 | * A specialized version of `_.pick` which picks `object` properties specified 5 | * by `props`. 6 | * 7 | * @private 8 | * @param {Object} object The source object. 9 | * @param {string[]} props The property names to pick. 10 | * @returns {Object} Returns the new object. 11 | */ 12 | function pickByArray(object, props) { 13 | object = toObject(object); 14 | 15 | var index = -1, 16 | length = props.length, 17 | result = {}; 18 | 19 | while (++index < length) { 20 | var key = props[index]; 21 | if (key in object) { 22 | result[key] = object[key]; 23 | } 24 | } 25 | return result; 26 | } 27 | 28 | return pickByArray; 29 | }); 30 | -------------------------------------------------------------------------------- /compat/internal/pickByCallback.js: -------------------------------------------------------------------------------- 1 | define(['./baseForIn'], function(baseForIn) { 2 | 3 | /** 4 | * A specialized version of `_.pick` which picks `object` properties `predicate` 5 | * returns truthy for. 6 | * 7 | * @private 8 | * @param {Object} object The source object. 9 | * @param {Function} predicate The function invoked per iteration. 10 | * @returns {Object} Returns the new object. 11 | */ 12 | function pickByCallback(object, predicate) { 13 | var result = {}; 14 | baseForIn(object, function(value, key, object) { 15 | if (predicate(value, key, object)) { 16 | result[key] = value; 17 | } 18 | }); 19 | return result; 20 | } 21 | 22 | return pickByCallback; 23 | }); 24 | -------------------------------------------------------------------------------- /compat/internal/reEscape.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used to match template delimiters. */ 4 | var reEscape = /<%-([\s\S]+?)%>/g; 5 | 6 | return reEscape; 7 | }); 8 | -------------------------------------------------------------------------------- /compat/internal/reEvaluate.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used to match template delimiters. */ 4 | var reEvaluate = /<%([\s\S]+?)%>/g; 5 | 6 | return reEvaluate; 7 | }); 8 | -------------------------------------------------------------------------------- /compat/internal/reInterpolate.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used to match template delimiters. */ 4 | var reInterpolate = /<%=([\s\S]+?)%>/g; 5 | 6 | return reInterpolate; 7 | }); 8 | -------------------------------------------------------------------------------- /compat/internal/realNames.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used to lookup unminified function names. */ 4 | var realNames = {}; 5 | 6 | return realNames; 7 | }); 8 | -------------------------------------------------------------------------------- /compat/internal/toIterable.js: -------------------------------------------------------------------------------- 1 | define(['./isArrayLike', '../lang/isObject', '../lang/isString', '../support', '../object/values'], function(isArrayLike, isObject, isString, support, values) { 2 | 3 | /** 4 | * Converts `value` to an array-like object if it's not one. 5 | * 6 | * @private 7 | * @param {*} value The value to process. 8 | * @returns {Array|Object} Returns the array-like object. 9 | */ 10 | function toIterable(value) { 11 | if (value == null) { 12 | return []; 13 | } 14 | if (!isArrayLike(value)) { 15 | return values(value); 16 | } 17 | if (support.unindexedChars && isString(value)) { 18 | return value.split(''); 19 | } 20 | return isObject(value) ? value : Object(value); 21 | } 22 | 23 | return toIterable; 24 | }); 25 | -------------------------------------------------------------------------------- /compat/internal/toObject.js: -------------------------------------------------------------------------------- 1 | define(['../lang/isObject', '../lang/isString', '../support'], function(isObject, isString, support) { 2 | 3 | /** 4 | * Converts `value` to an object if it's not one. 5 | * 6 | * @private 7 | * @param {*} value The value to process. 8 | * @returns {Object} Returns the object. 9 | */ 10 | function toObject(value) { 11 | if (support.unindexedChars && isString(value)) { 12 | var index = -1, 13 | length = value.length, 14 | result = Object(value); 15 | 16 | while (++index < length) { 17 | result[index] = value.charAt(index); 18 | } 19 | return result; 20 | } 21 | return isObject(value) ? value : Object(value); 22 | } 23 | 24 | return toObject; 25 | }); 26 | -------------------------------------------------------------------------------- /compat/internal/trimmedLeftIndex.js: -------------------------------------------------------------------------------- 1 | define(['./isSpace'], function(isSpace) { 2 | 3 | /** 4 | * Used by `_.trim` and `_.trimLeft` to get the index of the first non-whitespace 5 | * character of `string`. 6 | * 7 | * @private 8 | * @param {string} string The string to inspect. 9 | * @returns {number} Returns the index of the first non-whitespace character. 10 | */ 11 | function trimmedLeftIndex(string) { 12 | var index = -1, 13 | length = string.length; 14 | 15 | while (++index < length && isSpace(string.charCodeAt(index))) {} 16 | return index; 17 | } 18 | 19 | return trimmedLeftIndex; 20 | }); 21 | -------------------------------------------------------------------------------- /compat/internal/trimmedRightIndex.js: -------------------------------------------------------------------------------- 1 | define(['./isSpace'], function(isSpace) { 2 | 3 | /** 4 | * Used by `_.trim` and `_.trimRight` to get the index of the last non-whitespace 5 | * character of `string`. 6 | * 7 | * @private 8 | * @param {string} string The string to inspect. 9 | * @returns {number} Returns the index of the last non-whitespace character. 10 | */ 11 | function trimmedRightIndex(string) { 12 | var index = string.length; 13 | 14 | while (index-- && isSpace(string.charCodeAt(index))) {} 15 | return index; 16 | } 17 | 18 | return trimmedRightIndex; 19 | }); 20 | -------------------------------------------------------------------------------- /compat/internal/unescapeHtmlChar.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used to map HTML entities to characters. */ 4 | var htmlUnescapes = { 5 | '&': '&', 6 | '<': '<', 7 | '>': '>', 8 | '"': '"', 9 | ''': "'", 10 | '`': '`' 11 | }; 12 | 13 | /** 14 | * Used by `_.unescape` to convert HTML entities to characters. 15 | * 16 | * @private 17 | * @param {string} chr The matched character to unescape. 18 | * @returns {string} Returns the unescaped character. 19 | */ 20 | function unescapeHtmlChar(chr) { 21 | return htmlUnescapes[chr]; 22 | } 23 | 24 | return unescapeHtmlChar; 25 | }); 26 | -------------------------------------------------------------------------------- /compat/internal/wrapperClone.js: -------------------------------------------------------------------------------- 1 | define(['./LazyWrapper', './LodashWrapper', './arrayCopy'], function(LazyWrapper, LodashWrapper, arrayCopy) { 2 | 3 | /** 4 | * Creates a clone of `wrapper`. 5 | * 6 | * @private 7 | * @param {Object} wrapper The wrapper to clone. 8 | * @returns {Object} Returns the cloned wrapper. 9 | */ 10 | function wrapperClone(wrapper) { 11 | return wrapper instanceof LazyWrapper 12 | ? wrapper.clone() 13 | : new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__)); 14 | } 15 | 16 | return wrapperClone; 17 | }); 18 | -------------------------------------------------------------------------------- /compat/lang/eq.js: -------------------------------------------------------------------------------- 1 | define(["./isEqual"], function(isEqual) { 2 | return isEqual; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/lang/gt.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Checks if `value` is greater than `other`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Lang 9 | * @param {*} value The value to compare. 10 | * @param {*} other The other value to compare. 11 | * @returns {boolean} Returns `true` if `value` is greater than `other`, else `false`. 12 | * @example 13 | * 14 | * _.gt(3, 1); 15 | * // => true 16 | * 17 | * _.gt(3, 3); 18 | * // => false 19 | * 20 | * _.gt(1, 3); 21 | * // => false 22 | */ 23 | function gt(value, other) { 24 | return value > other; 25 | } 26 | 27 | return gt; 28 | }); 29 | -------------------------------------------------------------------------------- /compat/lang/gte.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Checks if `value` is greater than or equal to `other`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Lang 9 | * @param {*} value The value to compare. 10 | * @param {*} other The other value to compare. 11 | * @returns {boolean} Returns `true` if `value` is greater than or equal to `other`, else `false`. 12 | * @example 13 | * 14 | * _.gte(3, 1); 15 | * // => true 16 | * 17 | * _.gte(3, 3); 18 | * // => true 19 | * 20 | * _.gte(1, 3); 21 | * // => false 22 | */ 23 | function gte(value, other) { 24 | return value >= other; 25 | } 26 | 27 | return gte; 28 | }); 29 | -------------------------------------------------------------------------------- /compat/lang/isElement.js: -------------------------------------------------------------------------------- 1 | define(['../internal/isObjectLike', './isPlainObject'], function(isObjectLike, isPlainObject) { 2 | 3 | /** 4 | * Checks if `value` is a DOM element. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Lang 9 | * @param {*} value The value to check. 10 | * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. 11 | * @example 12 | * 13 | * _.isElement(document.body); 14 | * // => true 15 | * 16 | * _.isElement('
'); 17 | * // => false 18 | */ 19 | function isElement(value) { 20 | return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value); 21 | } 22 | 23 | return isElement; 24 | }); 25 | -------------------------------------------------------------------------------- /compat/lang/isNull.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Checks if `value` is `null`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Lang 9 | * @param {*} value The value to check. 10 | * @returns {boolean} Returns `true` if `value` is `null`, else `false`. 11 | * @example 12 | * 13 | * _.isNull(null); 14 | * // => true 15 | * 16 | * _.isNull(void 0); 17 | * // => false 18 | */ 19 | function isNull(value) { 20 | return value === null; 21 | } 22 | 23 | return isNull; 24 | }); 25 | -------------------------------------------------------------------------------- /compat/lang/isUndefined.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * Checks if `value` is `undefined`. 8 | * 9 | * @static 10 | * @memberOf _ 11 | * @category Lang 12 | * @param {*} value The value to check. 13 | * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. 14 | * @example 15 | * 16 | * _.isUndefined(void 0); 17 | * // => true 18 | * 19 | * _.isUndefined(null); 20 | * // => false 21 | */ 22 | function isUndefined(value) { 23 | return value === undefined; 24 | } 25 | 26 | return isUndefined; 27 | }); 28 | -------------------------------------------------------------------------------- /compat/lang/lt.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Checks if `value` is less than `other`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Lang 9 | * @param {*} value The value to compare. 10 | * @param {*} other The other value to compare. 11 | * @returns {boolean} Returns `true` if `value` is less than `other`, else `false`. 12 | * @example 13 | * 14 | * _.lt(1, 3); 15 | * // => true 16 | * 17 | * _.lt(3, 3); 18 | * // => false 19 | * 20 | * _.lt(3, 1); 21 | * // => false 22 | */ 23 | function lt(value, other) { 24 | return value < other; 25 | } 26 | 27 | return lt; 28 | }); 29 | -------------------------------------------------------------------------------- /compat/lang/lte.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Checks if `value` is less than or equal to `other`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Lang 9 | * @param {*} value The value to compare. 10 | * @param {*} other The other value to compare. 11 | * @returns {boolean} Returns `true` if `value` is less than or equal to `other`, else `false`. 12 | * @example 13 | * 14 | * _.lte(1, 3); 15 | * // => true 16 | * 17 | * _.lte(3, 3); 18 | * // => true 19 | * 20 | * _.lte(3, 1); 21 | * // => false 22 | */ 23 | function lte(value, other) { 24 | return value <= other; 25 | } 26 | 27 | return lte; 28 | }); 29 | -------------------------------------------------------------------------------- /compat/math.js: -------------------------------------------------------------------------------- 1 | define(['./math/add', './math/ceil', './math/floor', './math/max', './math/min', './math/round', './math/sum'], function(add, ceil, floor, max, min, round, sum) { 2 | return { 3 | 'add': add, 4 | 'ceil': ceil, 5 | 'floor': floor, 6 | 'max': max, 7 | 'min': min, 8 | 'round': round, 9 | 'sum': sum 10 | }; 11 | }); 12 | -------------------------------------------------------------------------------- /compat/math/add.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Adds two numbers. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Math 9 | * @param {number} augend The first number to add. 10 | * @param {number} addend The second number to add. 11 | * @returns {number} Returns the sum. 12 | * @example 13 | * 14 | * _.add(6, 4); 15 | * // => 10 16 | */ 17 | function add(augend, addend) { 18 | return (+augend || 0) + (+addend || 0); 19 | } 20 | 21 | return add; 22 | }); 23 | -------------------------------------------------------------------------------- /compat/math/ceil.js: -------------------------------------------------------------------------------- 1 | define(['../internal/createRound'], function(createRound) { 2 | 3 | /** 4 | * Calculates `n` rounded up to `precision`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Math 9 | * @param {number} n The number to round up. 10 | * @param {number} [precision=0] The precision to round up to. 11 | * @returns {number} Returns the rounded up number. 12 | * @example 13 | * 14 | * _.ceil(4.006); 15 | * // => 5 16 | * 17 | * _.ceil(6.004, 2); 18 | * // => 6.01 19 | * 20 | * _.ceil(6040, -2); 21 | * // => 6100 22 | */ 23 | var ceil = createRound('ceil'); 24 | 25 | return ceil; 26 | }); 27 | -------------------------------------------------------------------------------- /compat/math/floor.js: -------------------------------------------------------------------------------- 1 | define(['../internal/createRound'], function(createRound) { 2 | 3 | /** 4 | * Calculates `n` rounded down to `precision`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Math 9 | * @param {number} n The number to round down. 10 | * @param {number} [precision=0] The precision to round down to. 11 | * @returns {number} Returns the rounded down number. 12 | * @example 13 | * 14 | * _.floor(4.006); 15 | * // => 4 16 | * 17 | * _.floor(0.046, 2); 18 | * // => 0.04 19 | * 20 | * _.floor(4060, -2); 21 | * // => 4000 22 | */ 23 | var floor = createRound('floor'); 24 | 25 | return floor; 26 | }); 27 | -------------------------------------------------------------------------------- /compat/math/round.js: -------------------------------------------------------------------------------- 1 | define(['../internal/createRound'], function(createRound) { 2 | 3 | /** 4 | * Calculates `n` rounded to `precision`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Math 9 | * @param {number} n The number to round. 10 | * @param {number} [precision=0] The precision to round to. 11 | * @returns {number} Returns the rounded number. 12 | * @example 13 | * 14 | * _.round(4.006); 15 | * // => 4 16 | * 17 | * _.round(4.006, 2); 18 | * // => 4.01 19 | * 20 | * _.round(4060, -2); 21 | * // => 4100 22 | */ 23 | var round = createRound('round'); 24 | 25 | return round; 26 | }); 27 | -------------------------------------------------------------------------------- /compat/number.js: -------------------------------------------------------------------------------- 1 | define(['./number/inRange', './number/random'], function(inRange, random) { 2 | return { 3 | 'inRange': inRange, 4 | 'random': random 5 | }; 6 | }); 7 | -------------------------------------------------------------------------------- /compat/object/extend.js: -------------------------------------------------------------------------------- 1 | define(["./assign"], function(assign) { 2 | return assign; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/object/functions.js: -------------------------------------------------------------------------------- 1 | define(['../internal/baseFunctions', './keysIn'], function(baseFunctions, keysIn) { 2 | 3 | /** 4 | * Creates an array of function property names from all enumerable properties, 5 | * own and inherited, of `object`. 6 | * 7 | * @static 8 | * @memberOf _ 9 | * @alias methods 10 | * @category Object 11 | * @param {Object} object The object to inspect. 12 | * @returns {Array} Returns the new array of property names. 13 | * @example 14 | * 15 | * _.functions(_); 16 | * // => ['after', 'ary', 'assign', ...] 17 | */ 18 | function functions(object) { 19 | return baseFunctions(object, keysIn(object)); 20 | } 21 | 22 | return functions; 23 | }); 24 | -------------------------------------------------------------------------------- /compat/object/methods.js: -------------------------------------------------------------------------------- 1 | define(["./functions"], function(functions) { 2 | return functions; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/string/capitalize.js: -------------------------------------------------------------------------------- 1 | define(['../internal/baseToString'], function(baseToString) { 2 | 3 | /** 4 | * Capitalizes the first character of `string`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category String 9 | * @param {string} [string=''] The string to capitalize. 10 | * @returns {string} Returns the capitalized string. 11 | * @example 12 | * 13 | * _.capitalize('fred'); 14 | * // => 'Fred' 15 | */ 16 | function capitalize(string) { 17 | string = baseToString(string); 18 | return string && (string.charAt(0).toUpperCase() + string.slice(1)); 19 | } 20 | 21 | return capitalize; 22 | }); 23 | -------------------------------------------------------------------------------- /compat/string/kebabCase.js: -------------------------------------------------------------------------------- 1 | define(['../internal/createCompounder'], function(createCompounder) { 2 | 3 | /** 4 | * Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category String 9 | * @param {string} [string=''] The string to convert. 10 | * @returns {string} Returns the kebab cased string. 11 | * @example 12 | * 13 | * _.kebabCase('Foo Bar'); 14 | * // => 'foo-bar' 15 | * 16 | * _.kebabCase('fooBar'); 17 | * // => 'foo-bar' 18 | * 19 | * _.kebabCase('__foo_bar__'); 20 | * // => 'foo-bar' 21 | */ 22 | var kebabCase = createCompounder(function(result, word, index) { 23 | return result + (index ? '-' : '') + word.toLowerCase(); 24 | }); 25 | 26 | return kebabCase; 27 | }); 28 | -------------------------------------------------------------------------------- /compat/string/padLeft.js: -------------------------------------------------------------------------------- 1 | define(['../internal/createPadDir'], function(createPadDir) { 2 | 3 | /** 4 | * Pads `string` on the left side if it's shorter than `length`. Padding 5 | * characters are truncated if they exceed `length`. 6 | * 7 | * @static 8 | * @memberOf _ 9 | * @category String 10 | * @param {string} [string=''] The string to pad. 11 | * @param {number} [length=0] The padding length. 12 | * @param {string} [chars=' '] The string used as padding. 13 | * @returns {string} Returns the padded string. 14 | * @example 15 | * 16 | * _.padLeft('abc', 6); 17 | * // => ' abc' 18 | * 19 | * _.padLeft('abc', 6, '_-'); 20 | * // => '_-_abc' 21 | * 22 | * _.padLeft('abc', 3); 23 | * // => 'abc' 24 | */ 25 | var padLeft = createPadDir(); 26 | 27 | return padLeft; 28 | }); 29 | -------------------------------------------------------------------------------- /compat/string/padRight.js: -------------------------------------------------------------------------------- 1 | define(['../internal/createPadDir'], function(createPadDir) { 2 | 3 | /** 4 | * Pads `string` on the right side if it's shorter than `length`. Padding 5 | * characters are truncated if they exceed `length`. 6 | * 7 | * @static 8 | * @memberOf _ 9 | * @category String 10 | * @param {string} [string=''] The string to pad. 11 | * @param {number} [length=0] The padding length. 12 | * @param {string} [chars=' '] The string used as padding. 13 | * @returns {string} Returns the padded string. 14 | * @example 15 | * 16 | * _.padRight('abc', 6); 17 | * // => 'abc ' 18 | * 19 | * _.padRight('abc', 6, '_-'); 20 | * // => 'abc_-_' 21 | * 22 | * _.padRight('abc', 3); 23 | * // => 'abc' 24 | */ 25 | var padRight = createPadDir(true); 26 | 27 | return padRight; 28 | }); 29 | -------------------------------------------------------------------------------- /compat/string/snakeCase.js: -------------------------------------------------------------------------------- 1 | define(['../internal/createCompounder'], function(createCompounder) { 2 | 3 | /** 4 | * Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case). 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category String 9 | * @param {string} [string=''] The string to convert. 10 | * @returns {string} Returns the snake cased string. 11 | * @example 12 | * 13 | * _.snakeCase('Foo Bar'); 14 | * // => 'foo_bar' 15 | * 16 | * _.snakeCase('fooBar'); 17 | * // => 'foo_bar' 18 | * 19 | * _.snakeCase('--foo-bar'); 20 | * // => 'foo_bar' 21 | */ 22 | var snakeCase = createCompounder(function(result, word, index) { 23 | return result + (index ? '_' : '') + word.toLowerCase(); 24 | }); 25 | 26 | return snakeCase; 27 | }); 28 | -------------------------------------------------------------------------------- /compat/utility/constant.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Creates a function that returns `value`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Utility 9 | * @param {*} value The value to return from the new function. 10 | * @returns {Function} Returns the new function. 11 | * @example 12 | * 13 | * var object = { 'user': 'fred' }; 14 | * var getter = _.constant(object); 15 | * 16 | * getter() === object; 17 | * // => true 18 | */ 19 | function constant(value) { 20 | return function() { 21 | return value; 22 | }; 23 | } 24 | 25 | return constant; 26 | }); 27 | -------------------------------------------------------------------------------- /compat/utility/identity.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * This method returns the first argument provided to it. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Utility 9 | * @param {*} value Any value. 10 | * @returns {*} Returns `value`. 11 | * @example 12 | * 13 | * var object = { 'user': 'fred' }; 14 | * 15 | * _.identity(object) === object; 16 | * // => true 17 | */ 18 | function identity(value) { 19 | return value; 20 | } 21 | 22 | return identity; 23 | }); 24 | -------------------------------------------------------------------------------- /compat/utility/iteratee.js: -------------------------------------------------------------------------------- 1 | define(["./callback"], function(callback) { 2 | return callback; 3 | }); 4 | -------------------------------------------------------------------------------- /compat/utility/noop.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * A no-operation function that returns `undefined` regardless of the 5 | * arguments it receives. 6 | * 7 | * @static 8 | * @memberOf _ 9 | * @category Utility 10 | * @example 11 | * 12 | * var object = { 'user': 'fred' }; 13 | * 14 | * _.noop(object) === undefined; 15 | * // => true 16 | */ 17 | function noop() { 18 | // No operation performed. 19 | } 20 | 21 | return noop; 22 | }); 23 | -------------------------------------------------------------------------------- /compat/utility/uniqueId.js: -------------------------------------------------------------------------------- 1 | define(['../internal/baseToString'], function(baseToString) { 2 | 3 | /** Used to generate unique IDs. */ 4 | var idCounter = 0; 5 | 6 | /** 7 | * Generates a unique ID. If `prefix` is provided the ID is appended to it. 8 | * 9 | * @static 10 | * @memberOf _ 11 | * @category Utility 12 | * @param {string} [prefix] The value to prefix the ID with. 13 | * @returns {string} Returns the unique ID. 14 | * @example 15 | * 16 | * _.uniqueId('contact_'); 17 | * // => 'contact_104' 18 | * 19 | * _.uniqueId(); 20 | * // => '105' 21 | */ 22 | function uniqueId(prefix) { 23 | var id = ++idCounter; 24 | return baseToString(prefix) + id; 25 | } 26 | 27 | return uniqueId; 28 | }); 29 | -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | define(['./modern/main'], function(lodash) { 2 | return lodash; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/array/first.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * Gets the first element of `array`. 8 | * 9 | * @static 10 | * @memberOf _ 11 | * @alias head 12 | * @category Array 13 | * @param {Array} array The array to query. 14 | * @returns {*} Returns the first element of `array`. 15 | * @example 16 | * 17 | * _.first([1, 2, 3]); 18 | * // => 1 19 | * 20 | * _.first([]); 21 | * // => undefined 22 | */ 23 | function first(array) { 24 | return array ? array[0] : undefined; 25 | } 26 | 27 | return first; 28 | }); 29 | -------------------------------------------------------------------------------- /modern/array/flattenDeep.js: -------------------------------------------------------------------------------- 1 | define(['../internal/baseFlatten'], function(baseFlatten) { 2 | 3 | /** 4 | * Recursively flattens a nested array. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Array 9 | * @param {Array} array The array to recursively flatten. 10 | * @returns {Array} Returns the new flattened array. 11 | * @example 12 | * 13 | * _.flattenDeep([1, [2, 3, [4]]]); 14 | * // => [1, 2, 3, 4] 15 | */ 16 | function flattenDeep(array) { 17 | var length = array ? array.length : 0; 18 | return length ? baseFlatten(array, true) : []; 19 | } 20 | 21 | return flattenDeep; 22 | }); 23 | -------------------------------------------------------------------------------- /modern/array/head.js: -------------------------------------------------------------------------------- 1 | define(["./first"], function(first) { 2 | return first; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/array/initial.js: -------------------------------------------------------------------------------- 1 | define(['./dropRight'], function(dropRight) { 2 | 3 | /** 4 | * Gets all but the last element of `array`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Array 9 | * @param {Array} array The array to query. 10 | * @returns {Array} Returns the slice of `array`. 11 | * @example 12 | * 13 | * _.initial([1, 2, 3]); 14 | * // => [1, 2] 15 | */ 16 | function initial(array) { 17 | return dropRight(array, 1); 18 | } 19 | 20 | return initial; 21 | }); 22 | -------------------------------------------------------------------------------- /modern/array/last.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * Gets the last element of `array`. 8 | * 9 | * @static 10 | * @memberOf _ 11 | * @category Array 12 | * @param {Array} array The array to query. 13 | * @returns {*} Returns the last element of `array`. 14 | * @example 15 | * 16 | * _.last([1, 2, 3]); 17 | * // => 3 18 | */ 19 | function last(array) { 20 | var length = array ? array.length : 0; 21 | return length ? array[length - 1] : undefined; 22 | } 23 | 24 | return last; 25 | }); 26 | -------------------------------------------------------------------------------- /modern/array/object.js: -------------------------------------------------------------------------------- 1 | define(["./zipObject"], function(zipObject) { 2 | return zipObject; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/array/rest.js: -------------------------------------------------------------------------------- 1 | define(['./drop'], function(drop) { 2 | 3 | /** 4 | * Gets all but the first element of `array`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @alias tail 9 | * @category Array 10 | * @param {Array} array The array to query. 11 | * @returns {Array} Returns the slice of `array`. 12 | * @example 13 | * 14 | * _.rest([1, 2, 3]); 15 | * // => [2, 3] 16 | */ 17 | function rest(array) { 18 | return drop(array, 1); 19 | } 20 | 21 | return rest; 22 | }); 23 | -------------------------------------------------------------------------------- /modern/array/tail.js: -------------------------------------------------------------------------------- 1 | define(["./rest"], function(rest) { 2 | return rest; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/array/union.js: -------------------------------------------------------------------------------- 1 | define(['../internal/baseFlatten', '../internal/baseUniq', '../function/restParam'], function(baseFlatten, baseUniq, restParam) { 2 | 3 | /** 4 | * Creates an array of unique values, in order, from all of the provided arrays 5 | * using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) 6 | * for equality comparisons. 7 | * 8 | * @static 9 | * @memberOf _ 10 | * @category Array 11 | * @param {...Array} [arrays] The arrays to inspect. 12 | * @returns {Array} Returns the new array of combined values. 13 | * @example 14 | * 15 | * _.union([1, 2], [4, 2], [2, 1]); 16 | * // => [1, 2, 4] 17 | */ 18 | var union = restParam(function(arrays) { 19 | return baseUniq(baseFlatten(arrays, false, true)); 20 | }); 21 | 22 | return union; 23 | }); 24 | -------------------------------------------------------------------------------- /modern/array/unique.js: -------------------------------------------------------------------------------- 1 | define(["./uniq"], function(uniq) { 2 | return uniq; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/array/zip.js: -------------------------------------------------------------------------------- 1 | define(['../function/restParam', './unzip'], function(restParam, unzip) { 2 | 3 | /** 4 | * Creates an array of grouped elements, the first of which contains the first 5 | * elements of the given arrays, the second of which contains the second elements 6 | * of the given arrays, and so on. 7 | * 8 | * @static 9 | * @memberOf _ 10 | * @category Array 11 | * @param {...Array} [arrays] The arrays to process. 12 | * @returns {Array} Returns the new array of grouped elements. 13 | * @example 14 | * 15 | * _.zip(['fred', 'barney'], [30, 40], [true, false]); 16 | * // => [['fred', 30, true], ['barney', 40, false]] 17 | */ 18 | var zip = restParam(unzip); 19 | 20 | return zip; 21 | }); 22 | -------------------------------------------------------------------------------- /modern/chain.js: -------------------------------------------------------------------------------- 1 | define(['./chain/chain', './chain/commit', './chain/concat', './chain/lodash', './chain/plant', './chain/reverse', './chain/run', './chain/tap', './chain/thru', './chain/toJSON', './chain/toString', './chain/value', './chain/valueOf', './chain/wrapperChain'], function(chain, commit, concat, lodash, plant, reverse, run, tap, thru, toJSON, toString, value, valueOf, wrapperChain) { 2 | return { 3 | 'chain': chain, 4 | 'commit': commit, 5 | 'concat': concat, 6 | 'lodash': lodash, 7 | 'plant': plant, 8 | 'reverse': reverse, 9 | 'run': run, 10 | 'tap': tap, 11 | 'thru': thru, 12 | 'toJSON': toJSON, 13 | 'toString': toString, 14 | 'value': value, 15 | 'valueOf': valueOf, 16 | 'wrapperChain': wrapperChain 17 | }; 18 | }); 19 | -------------------------------------------------------------------------------- /modern/chain/commit.js: -------------------------------------------------------------------------------- 1 | define(["./wrapperCommit"], function(wrapperCommit) { 2 | return wrapperCommit; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/chain/concat.js: -------------------------------------------------------------------------------- 1 | define(["./wrapperConcat"], function(wrapperConcat) { 2 | return wrapperConcat; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/chain/plant.js: -------------------------------------------------------------------------------- 1 | define(["./wrapperPlant"], function(wrapperPlant) { 2 | return wrapperPlant; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/chain/reverse.js: -------------------------------------------------------------------------------- 1 | define(["./wrapperReverse"], function(wrapperReverse) { 2 | return wrapperReverse; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/chain/run.js: -------------------------------------------------------------------------------- 1 | define(["./wrapperValue"], function(wrapperValue) { 2 | return wrapperValue; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/chain/thru.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * This method is like `_.tap` except that it returns the result of `interceptor`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Chain 9 | * @param {*} value The value to provide to `interceptor`. 10 | * @param {Function} interceptor The function to invoke. 11 | * @param {*} [thisArg] The `this` binding of `interceptor`. 12 | * @returns {*} Returns the result of `interceptor`. 13 | * @example 14 | * 15 | * _(' abc ') 16 | * .chain() 17 | * .trim() 18 | * .thru(function(value) { 19 | * return [value]; 20 | * }) 21 | * .value(); 22 | * // => ['abc'] 23 | */ 24 | function thru(value, interceptor, thisArg) { 25 | return interceptor.call(thisArg, value); 26 | } 27 | 28 | return thru; 29 | }); 30 | -------------------------------------------------------------------------------- /modern/chain/toJSON.js: -------------------------------------------------------------------------------- 1 | define(["./wrapperValue"], function(wrapperValue) { 2 | return wrapperValue; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/chain/toString.js: -------------------------------------------------------------------------------- 1 | define(["./wrapperToString"], function(wrapperToString) { 2 | return wrapperToString; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/chain/value.js: -------------------------------------------------------------------------------- 1 | define(["./wrapperValue"], function(wrapperValue) { 2 | return wrapperValue; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/chain/valueOf.js: -------------------------------------------------------------------------------- 1 | define(["./wrapperValue"], function(wrapperValue) { 2 | return wrapperValue; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/chain/wrapperChain.js: -------------------------------------------------------------------------------- 1 | define(['./chain'], function(chain) { 2 | 3 | /** 4 | * Enables explicit method chaining on the wrapper object. 5 | * 6 | * @name chain 7 | * @memberOf _ 8 | * @category Chain 9 | * @returns {Object} Returns the new `lodash` wrapper instance. 10 | * @example 11 | * 12 | * var users = [ 13 | * { 'user': 'barney', 'age': 36 }, 14 | * { 'user': 'fred', 'age': 40 } 15 | * ]; 16 | * 17 | * // without explicit chaining 18 | * _(users).first(); 19 | * // => { 'user': 'barney', 'age': 36 } 20 | * 21 | * // with explicit chaining 22 | * _(users).chain() 23 | * .first() 24 | * .pick('user') 25 | * .value(); 26 | * // => { 'user': 'barney' } 27 | */ 28 | function wrapperChain() { 29 | return chain(this); 30 | } 31 | 32 | return wrapperChain; 33 | }); 34 | -------------------------------------------------------------------------------- /modern/chain/wrapperToString.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Produces the result of coercing the unwrapped value to a string. 5 | * 6 | * @name toString 7 | * @memberOf _ 8 | * @category Chain 9 | * @returns {string} Returns the coerced string value. 10 | * @example 11 | * 12 | * _([1, 2, 3]).toString(); 13 | * // => '1,2,3' 14 | */ 15 | function wrapperToString() { 16 | return (this.value() + ''); 17 | } 18 | 19 | return wrapperToString; 20 | }); 21 | -------------------------------------------------------------------------------- /modern/chain/wrapperValue.js: -------------------------------------------------------------------------------- 1 | define(['../internal/baseWrapperValue'], function(baseWrapperValue) { 2 | 3 | /** 4 | * Executes the chained sequence to extract the unwrapped value. 5 | * 6 | * @name value 7 | * @memberOf _ 8 | * @alias run, toJSON, valueOf 9 | * @category Chain 10 | * @returns {*} Returns the resolved unwrapped value. 11 | * @example 12 | * 13 | * _([1, 2, 3]).value(); 14 | * // => [1, 2, 3] 15 | */ 16 | function wrapperValue() { 17 | return baseWrapperValue(this.__wrapped__, this.__actions__); 18 | } 19 | 20 | return wrapperValue; 21 | }); 22 | -------------------------------------------------------------------------------- /modern/collection/all.js: -------------------------------------------------------------------------------- 1 | define(["./every"], function(every) { 2 | return every; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/collection/any.js: -------------------------------------------------------------------------------- 1 | define(["./some"], function(some) { 2 | return some; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/collection/collect.js: -------------------------------------------------------------------------------- 1 | define(["./map"], function(map) { 2 | return map; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/collection/contains.js: -------------------------------------------------------------------------------- 1 | define(["./includes"], function(includes) { 2 | return includes; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/collection/detect.js: -------------------------------------------------------------------------------- 1 | define(["./find"], function(find) { 2 | return find; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/collection/each.js: -------------------------------------------------------------------------------- 1 | define(["./forEach"], function(forEach) { 2 | return forEach; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/collection/eachRight.js: -------------------------------------------------------------------------------- 1 | define(["./forEachRight"], function(forEachRight) { 2 | return forEachRight; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/collection/foldl.js: -------------------------------------------------------------------------------- 1 | define(["./reduce"], function(reduce) { 2 | return reduce; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/collection/foldr.js: -------------------------------------------------------------------------------- 1 | define(["./reduceRight"], function(reduceRight) { 2 | return reduceRight; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/collection/include.js: -------------------------------------------------------------------------------- 1 | define(["./includes"], function(includes) { 2 | return includes; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/collection/inject.js: -------------------------------------------------------------------------------- 1 | define(["./reduce"], function(reduce) { 2 | return reduce; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/collection/max.js: -------------------------------------------------------------------------------- 1 | define(["../math/max"], function(max) { 2 | return max; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/collection/min.js: -------------------------------------------------------------------------------- 1 | define(["../math/min"], function(min) { 2 | return min; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/collection/select.js: -------------------------------------------------------------------------------- 1 | define(["./filter"], function(filter) { 2 | return filter; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/collection/shuffle.js: -------------------------------------------------------------------------------- 1 | define(['./sample'], function(sample) { 2 | 3 | /** Used as references for `-Infinity` and `Infinity`. */ 4 | var POSITIVE_INFINITY = Number.POSITIVE_INFINITY; 5 | 6 | /** 7 | * Creates an array of shuffled values, using a version of the 8 | * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). 9 | * 10 | * @static 11 | * @memberOf _ 12 | * @category Collection 13 | * @param {Array|Object|string} collection The collection to shuffle. 14 | * @returns {Array} Returns the new shuffled array. 15 | * @example 16 | * 17 | * _.shuffle([1, 2, 3, 4]); 18 | * // => [4, 1, 3, 2] 19 | */ 20 | function shuffle(collection) { 21 | return sample(collection, POSITIVE_INFINITY); 22 | } 23 | 24 | return shuffle; 25 | }); 26 | -------------------------------------------------------------------------------- /modern/collection/sum.js: -------------------------------------------------------------------------------- 1 | define(["../math/sum"], function(sum) { 2 | return sum; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/date.js: -------------------------------------------------------------------------------- 1 | define(['./date/now'], function(now) { 2 | return { 3 | 'now': now 4 | }; 5 | }); 6 | -------------------------------------------------------------------------------- /modern/date/now.js: -------------------------------------------------------------------------------- 1 | define(['../internal/getNative'], function(getNative) { 2 | 3 | /* Native method references for those with the same name as other `lodash` methods. */ 4 | var nativeNow = getNative(Date, 'now'); 5 | 6 | /** 7 | * Gets the number of milliseconds that have elapsed since the Unix epoch 8 | * (1 January 1970 00:00:00 UTC). 9 | * 10 | * @static 11 | * @memberOf _ 12 | * @category Date 13 | * @example 14 | * 15 | * _.defer(function(stamp) { 16 | * console.log(_.now() - stamp); 17 | * }, _.now()); 18 | * // => logs the number of milliseconds it took for the deferred function to be invoked 19 | */ 20 | var now = nativeNow || function() { 21 | return new Date().getTime(); 22 | }; 23 | 24 | return now; 25 | }); 26 | -------------------------------------------------------------------------------- /modern/function/backflow.js: -------------------------------------------------------------------------------- 1 | define(["./flowRight"], function(flowRight) { 2 | return flowRight; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/function/compose.js: -------------------------------------------------------------------------------- 1 | define(["./flowRight"], function(flowRight) { 2 | return flowRight; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/function/defer.js: -------------------------------------------------------------------------------- 1 | define(['../internal/baseDelay', './restParam'], function(baseDelay, restParam) { 2 | 3 | /** 4 | * Defers invoking the `func` until the current call stack has cleared. Any 5 | * additional arguments are provided to `func` when it's invoked. 6 | * 7 | * @static 8 | * @memberOf _ 9 | * @category Function 10 | * @param {Function} func The function to defer. 11 | * @param {...*} [args] The arguments to invoke the function with. 12 | * @returns {number} Returns the timer id. 13 | * @example 14 | * 15 | * _.defer(function(text) { 16 | * console.log(text); 17 | * }, 'deferred'); 18 | * // logs 'deferred' after one or more milliseconds 19 | */ 20 | var defer = restParam(function(func, args) { 21 | return baseDelay(func, 1, args); 22 | }); 23 | 24 | return defer; 25 | }); 26 | -------------------------------------------------------------------------------- /modern/function/flow.js: -------------------------------------------------------------------------------- 1 | define(['../internal/createFlow'], function(createFlow) { 2 | 3 | /** 4 | * Creates a function that returns the result of invoking the provided 5 | * functions with the `this` binding of the created function, where each 6 | * successive invocation is supplied the return value of the previous. 7 | * 8 | * @static 9 | * @memberOf _ 10 | * @category Function 11 | * @param {...Function} [funcs] Functions to invoke. 12 | * @returns {Function} Returns the new function. 13 | * @example 14 | * 15 | * function square(n) { 16 | * return n * n; 17 | * } 18 | * 19 | * var addSquare = _.flow(_.add, square); 20 | * addSquare(1, 2); 21 | * // => 9 22 | */ 23 | var flow = createFlow(); 24 | 25 | return flow; 26 | }); 27 | -------------------------------------------------------------------------------- /modern/function/flowRight.js: -------------------------------------------------------------------------------- 1 | define(['../internal/createFlow'], function(createFlow) { 2 | 3 | /** 4 | * This method is like `_.flow` except that it creates a function that 5 | * invokes the provided functions from right to left. 6 | * 7 | * @static 8 | * @memberOf _ 9 | * @alias backflow, compose 10 | * @category Function 11 | * @param {...Function} [funcs] Functions to invoke. 12 | * @returns {Function} Returns the new function. 13 | * @example 14 | * 15 | * function square(n) { 16 | * return n * n; 17 | * } 18 | * 19 | * var addSquare = _.flowRight(square, _.add); 20 | * addSquare(1, 2); 21 | * // => 9 22 | */ 23 | var flowRight = createFlow(true); 24 | 25 | return flowRight; 26 | }); 27 | -------------------------------------------------------------------------------- /modern/function/once.js: -------------------------------------------------------------------------------- 1 | define(['./before'], function(before) { 2 | 3 | /** 4 | * Creates a function that is restricted to invoking `func` once. Repeat calls 5 | * to the function return the value of the first call. The `func` is invoked 6 | * with the `this` binding and arguments of the created function. 7 | * 8 | * @static 9 | * @memberOf _ 10 | * @category Function 11 | * @param {Function} func The function to restrict. 12 | * @returns {Function} Returns the new restricted function. 13 | * @example 14 | * 15 | * var initialize = _.once(createApplication); 16 | * initialize(); 17 | * initialize(); 18 | * // `initialize` invokes `createApplication` once 19 | */ 20 | function once(func) { 21 | return before(2, func); 22 | } 23 | 24 | return once; 25 | }); 26 | -------------------------------------------------------------------------------- /modern/internal/LazyWrapper.js: -------------------------------------------------------------------------------- 1 | define(['./baseCreate', './baseLodash'], function(baseCreate, baseLodash) { 2 | 3 | /** Used as references for `-Infinity` and `Infinity`. */ 4 | var POSITIVE_INFINITY = Number.POSITIVE_INFINITY; 5 | 6 | /** 7 | * Creates a lazy wrapper object which wraps `value` to enable lazy evaluation. 8 | * 9 | * @private 10 | * @param {*} value The value to wrap. 11 | */ 12 | function LazyWrapper(value) { 13 | this.__wrapped__ = value; 14 | this.__actions__ = []; 15 | this.__dir__ = 1; 16 | this.__filtered__ = false; 17 | this.__iteratees__ = []; 18 | this.__takeCount__ = POSITIVE_INFINITY; 19 | this.__views__ = []; 20 | } 21 | 22 | LazyWrapper.prototype = baseCreate(baseLodash.prototype); 23 | LazyWrapper.prototype.constructor = LazyWrapper; 24 | 25 | return LazyWrapper; 26 | }); 27 | -------------------------------------------------------------------------------- /modern/internal/LodashWrapper.js: -------------------------------------------------------------------------------- 1 | define(['./baseCreate', './baseLodash'], function(baseCreate, baseLodash) { 2 | 3 | /** 4 | * The base constructor for creating `lodash` wrapper objects. 5 | * 6 | * @private 7 | * @param {*} value The value to wrap. 8 | * @param {boolean} [chainAll] Enable chaining for all wrapper methods. 9 | * @param {Array} [actions=[]] Actions to peform to resolve the unwrapped value. 10 | */ 11 | function LodashWrapper(value, chainAll, actions) { 12 | this.__wrapped__ = value; 13 | this.__actions__ = actions || []; 14 | this.__chain__ = !!chainAll; 15 | } 16 | 17 | LodashWrapper.prototype = baseCreate(baseLodash.prototype); 18 | LodashWrapper.prototype.constructor = LodashWrapper; 19 | 20 | return LodashWrapper; 21 | }); 22 | -------------------------------------------------------------------------------- /modern/internal/MapCache.js: -------------------------------------------------------------------------------- 1 | define(['./mapDelete', './mapGet', './mapHas', './mapSet'], function(mapDelete, mapGet, mapHas, mapSet) { 2 | 3 | /** 4 | * Creates a cache object to store key/value pairs. 5 | * 6 | * @private 7 | * @static 8 | * @name Cache 9 | * @memberOf _.memoize 10 | */ 11 | function MapCache() { 12 | this.__data__ = {}; 13 | } 14 | 15 | // Add functions to the `Map` cache. 16 | MapCache.prototype['delete'] = mapDelete; 17 | MapCache.prototype.get = mapGet; 18 | MapCache.prototype.has = mapHas; 19 | MapCache.prototype.set = mapSet; 20 | 21 | return MapCache; 22 | }); 23 | -------------------------------------------------------------------------------- /modern/internal/arrayConcat.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Creates a new array joining `array` with `other`. 5 | * 6 | * @private 7 | * @param {Array} array The array to join. 8 | * @param {Array} other The other array to join. 9 | * @returns {Array} Returns the new concatenated array. 10 | */ 11 | function arrayConcat(array, other) { 12 | var index = -1, 13 | length = array.length, 14 | othIndex = -1, 15 | othLength = other.length, 16 | result = Array(length + othLength); 17 | 18 | while (++index < length) { 19 | result[index] = array[index]; 20 | } 21 | while (++othIndex < othLength) { 22 | result[index++] = other[othIndex]; 23 | } 24 | return result; 25 | } 26 | 27 | return arrayConcat; 28 | }); 29 | -------------------------------------------------------------------------------- /modern/internal/arrayCopy.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Copies the values of `source` to `array`. 5 | * 6 | * @private 7 | * @param {Array} source The array to copy values from. 8 | * @param {Array} [array=[]] The array to copy values to. 9 | * @returns {Array} Returns `array`. 10 | */ 11 | function arrayCopy(source, array) { 12 | var index = -1, 13 | length = source.length; 14 | 15 | array || (array = Array(length)); 16 | while (++index < length) { 17 | array[index] = source[index]; 18 | } 19 | return array; 20 | } 21 | 22 | return arrayCopy; 23 | }); 24 | -------------------------------------------------------------------------------- /modern/internal/arrayEach.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * A specialized version of `_.forEach` for arrays without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Array} array The array to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @returns {Array} Returns `array`. 11 | */ 12 | function arrayEach(array, iteratee) { 13 | var index = -1, 14 | length = array.length; 15 | 16 | while (++index < length) { 17 | if (iteratee(array[index], index, array) === false) { 18 | break; 19 | } 20 | } 21 | return array; 22 | } 23 | 24 | return arrayEach; 25 | }); 26 | -------------------------------------------------------------------------------- /modern/internal/arrayEachRight.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * A specialized version of `_.forEachRight` for arrays without support for 5 | * callback shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Array} array The array to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @returns {Array} Returns `array`. 11 | */ 12 | function arrayEachRight(array, iteratee) { 13 | var length = array.length; 14 | 15 | while (length--) { 16 | if (iteratee(array[length], length, array) === false) { 17 | break; 18 | } 19 | } 20 | return array; 21 | } 22 | 23 | return arrayEachRight; 24 | }); 25 | -------------------------------------------------------------------------------- /modern/internal/arrayEvery.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * A specialized version of `_.every` for arrays without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Array} array The array to iterate over. 9 | * @param {Function} predicate The function invoked per iteration. 10 | * @returns {boolean} Returns `true` if all elements pass the predicate check, 11 | * else `false`. 12 | */ 13 | function arrayEvery(array, predicate) { 14 | var index = -1, 15 | length = array.length; 16 | 17 | while (++index < length) { 18 | if (!predicate(array[index], index, array)) { 19 | return false; 20 | } 21 | } 22 | return true; 23 | } 24 | 25 | return arrayEvery; 26 | }); 27 | -------------------------------------------------------------------------------- /modern/internal/arrayFilter.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * A specialized version of `_.filter` for arrays without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Array} array The array to iterate over. 9 | * @param {Function} predicate The function invoked per iteration. 10 | * @returns {Array} Returns the new filtered array. 11 | */ 12 | function arrayFilter(array, predicate) { 13 | var index = -1, 14 | length = array.length, 15 | resIndex = -1, 16 | result = []; 17 | 18 | while (++index < length) { 19 | var value = array[index]; 20 | if (predicate(value, index, array)) { 21 | result[++resIndex] = value; 22 | } 23 | } 24 | return result; 25 | } 26 | 27 | return arrayFilter; 28 | }); 29 | -------------------------------------------------------------------------------- /modern/internal/arrayMap.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * A specialized version of `_.map` for arrays without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Array} array The array to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @returns {Array} Returns the new mapped array. 11 | */ 12 | function arrayMap(array, iteratee) { 13 | var index = -1, 14 | length = array.length, 15 | result = Array(length); 16 | 17 | while (++index < length) { 18 | result[index] = iteratee(array[index], index, array); 19 | } 20 | return result; 21 | } 22 | 23 | return arrayMap; 24 | }); 25 | -------------------------------------------------------------------------------- /modern/internal/arrayPush.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Appends the elements of `values` to `array`. 5 | * 6 | * @private 7 | * @param {Array} array The array to modify. 8 | * @param {Array} values The values to append. 9 | * @returns {Array} Returns `array`. 10 | */ 11 | function arrayPush(array, values) { 12 | var index = -1, 13 | length = values.length, 14 | offset = array.length; 15 | 16 | while (++index < length) { 17 | array[offset + index] = values[index]; 18 | } 19 | return array; 20 | } 21 | 22 | return arrayPush; 23 | }); 24 | -------------------------------------------------------------------------------- /modern/internal/arraySome.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * A specialized version of `_.some` for arrays without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Array} array The array to iterate over. 9 | * @param {Function} predicate The function invoked per iteration. 10 | * @returns {boolean} Returns `true` if any element passes the predicate check, 11 | * else `false`. 12 | */ 13 | function arraySome(array, predicate) { 14 | var index = -1, 15 | length = array.length; 16 | 17 | while (++index < length) { 18 | if (predicate(array[index], index, array)) { 19 | return true; 20 | } 21 | } 22 | return false; 23 | } 24 | 25 | return arraySome; 26 | }); 27 | -------------------------------------------------------------------------------- /modern/internal/arraySum.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * A specialized version of `_.sum` for arrays without support for callback 5 | * shorthands and `this` binding.. 6 | * 7 | * @private 8 | * @param {Array} array The array to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @returns {number} Returns the sum. 11 | */ 12 | function arraySum(array, iteratee) { 13 | var length = array.length, 14 | result = 0; 15 | 16 | while (length--) { 17 | result += +iteratee(array[length]) || 0; 18 | } 19 | return result; 20 | } 21 | 22 | return arraySum; 23 | }); 24 | -------------------------------------------------------------------------------- /modern/internal/assignDefaults.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * Used by `_.defaults` to customize its `_.assign` use. 8 | * 9 | * @private 10 | * @param {*} objectValue The destination object property value. 11 | * @param {*} sourceValue The source object property value. 12 | * @returns {*} Returns the value to assign to the destination object. 13 | */ 14 | function assignDefaults(objectValue, sourceValue) { 15 | return objectValue === undefined ? sourceValue : objectValue; 16 | } 17 | 18 | return assignDefaults; 19 | }); 20 | -------------------------------------------------------------------------------- /modern/internal/baseAssign.js: -------------------------------------------------------------------------------- 1 | define(['./baseCopy', '../object/keys'], function(baseCopy, keys) { 2 | 3 | /** 4 | * The base implementation of `_.assign` without support for argument juggling, 5 | * multiple sources, and `customizer` functions. 6 | * 7 | * @private 8 | * @param {Object} object The destination object. 9 | * @param {Object} source The source object. 10 | * @returns {Object} Returns `object`. 11 | */ 12 | function baseAssign(object, source) { 13 | return source == null 14 | ? object 15 | : baseCopy(source, keys(source), object); 16 | } 17 | 18 | return baseAssign; 19 | }); 20 | -------------------------------------------------------------------------------- /modern/internal/baseCopy.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Copies properties of `source` to `object`. 5 | * 6 | * @private 7 | * @param {Object} source The object to copy properties from. 8 | * @param {Array} props The property names to copy. 9 | * @param {Object} [object={}] The object to copy properties to. 10 | * @returns {Object} Returns `object`. 11 | */ 12 | function baseCopy(source, props, object) { 13 | object || (object = {}); 14 | 15 | var index = -1, 16 | length = props.length; 17 | 18 | while (++index < length) { 19 | var key = props[index]; 20 | object[key] = source[key]; 21 | } 22 | return object; 23 | } 24 | 25 | return baseCopy; 26 | }); 27 | -------------------------------------------------------------------------------- /modern/internal/baseCreate.js: -------------------------------------------------------------------------------- 1 | define(['../lang/isObject'], function(isObject) { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * The base implementation of `_.create` without support for assigning 8 | * properties to the created object. 9 | * 10 | * @private 11 | * @param {Object} prototype The object to inherit from. 12 | * @returns {Object} Returns the new object. 13 | */ 14 | var baseCreate = (function() { 15 | function object() {} 16 | return function(prototype) { 17 | if (isObject(prototype)) { 18 | object.prototype = prototype; 19 | var result = new object; 20 | object.prototype = undefined; 21 | } 22 | return result || {}; 23 | }; 24 | }()); 25 | 26 | return baseCreate; 27 | }); 28 | -------------------------------------------------------------------------------- /modern/internal/baseEach.js: -------------------------------------------------------------------------------- 1 | define(['./baseForOwn', './createBaseEach'], function(baseForOwn, createBaseEach) { 2 | 3 | /** 4 | * The base implementation of `_.forEach` without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Array|Object|string} collection The collection to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @returns {Array|Object|string} Returns `collection`. 11 | */ 12 | var baseEach = createBaseEach(baseForOwn); 13 | 14 | return baseEach; 15 | }); 16 | -------------------------------------------------------------------------------- /modern/internal/baseEachRight.js: -------------------------------------------------------------------------------- 1 | define(['./baseForOwnRight', './createBaseEach'], function(baseForOwnRight, createBaseEach) { 2 | 3 | /** 4 | * The base implementation of `_.forEachRight` without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Array|Object|string} collection The collection to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @returns {Array|Object|string} Returns `collection`. 11 | */ 12 | var baseEachRight = createBaseEach(baseForOwnRight, true); 13 | 14 | return baseEachRight; 15 | }); 16 | -------------------------------------------------------------------------------- /modern/internal/baseEvery.js: -------------------------------------------------------------------------------- 1 | define(['./baseEach'], function(baseEach) { 2 | 3 | /** 4 | * The base implementation of `_.every` without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Array|Object|string} collection The collection to iterate over. 9 | * @param {Function} predicate The function invoked per iteration. 10 | * @returns {boolean} Returns `true` if all elements pass the predicate check, 11 | * else `false` 12 | */ 13 | function baseEvery(collection, predicate) { 14 | var result = true; 15 | baseEach(collection, function(value, index, collection) { 16 | result = !!predicate(value, index, collection); 17 | return result; 18 | }); 19 | return result; 20 | } 21 | 22 | return baseEvery; 23 | }); 24 | -------------------------------------------------------------------------------- /modern/internal/baseFilter.js: -------------------------------------------------------------------------------- 1 | define(['./baseEach'], function(baseEach) { 2 | 3 | /** 4 | * The base implementation of `_.filter` without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Array|Object|string} collection The collection to iterate over. 9 | * @param {Function} predicate The function invoked per iteration. 10 | * @returns {Array} Returns the new filtered array. 11 | */ 12 | function baseFilter(collection, predicate) { 13 | var result = []; 14 | baseEach(collection, function(value, index, collection) { 15 | if (predicate(value, index, collection)) { 16 | result.push(value); 17 | } 18 | }); 19 | return result; 20 | } 21 | 22 | return baseFilter; 23 | }); 24 | -------------------------------------------------------------------------------- /modern/internal/baseFor.js: -------------------------------------------------------------------------------- 1 | define(['./createBaseFor'], function(createBaseFor) { 2 | 3 | /** 4 | * The base implementation of `baseForIn` and `baseForOwn` which iterates 5 | * over `object` properties returned by `keysFunc` invoking `iteratee` for 6 | * each property. Iteratee functions may exit iteration early by explicitly 7 | * returning `false`. 8 | * 9 | * @private 10 | * @param {Object} object The object to iterate over. 11 | * @param {Function} iteratee The function invoked per iteration. 12 | * @param {Function} keysFunc The function to get the keys of `object`. 13 | * @returns {Object} Returns `object`. 14 | */ 15 | var baseFor = createBaseFor(); 16 | 17 | return baseFor; 18 | }); 19 | -------------------------------------------------------------------------------- /modern/internal/baseForIn.js: -------------------------------------------------------------------------------- 1 | define(['./baseFor', '../object/keysIn'], function(baseFor, keysIn) { 2 | 3 | /** 4 | * The base implementation of `_.forIn` without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Object} object The object to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @returns {Object} Returns `object`. 11 | */ 12 | function baseForIn(object, iteratee) { 13 | return baseFor(object, iteratee, keysIn); 14 | } 15 | 16 | return baseForIn; 17 | }); 18 | -------------------------------------------------------------------------------- /modern/internal/baseForOwn.js: -------------------------------------------------------------------------------- 1 | define(['./baseFor', '../object/keys'], function(baseFor, keys) { 2 | 3 | /** 4 | * The base implementation of `_.forOwn` without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Object} object The object to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @returns {Object} Returns `object`. 11 | */ 12 | function baseForOwn(object, iteratee) { 13 | return baseFor(object, iteratee, keys); 14 | } 15 | 16 | return baseForOwn; 17 | }); 18 | -------------------------------------------------------------------------------- /modern/internal/baseForOwnRight.js: -------------------------------------------------------------------------------- 1 | define(['./baseForRight', '../object/keys'], function(baseForRight, keys) { 2 | 3 | /** 4 | * The base implementation of `_.forOwnRight` without support for callback 5 | * shorthands and `this` binding. 6 | * 7 | * @private 8 | * @param {Object} object The object to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @returns {Object} Returns `object`. 11 | */ 12 | function baseForOwnRight(object, iteratee) { 13 | return baseForRight(object, iteratee, keys); 14 | } 15 | 16 | return baseForOwnRight; 17 | }); 18 | -------------------------------------------------------------------------------- /modern/internal/baseForRight.js: -------------------------------------------------------------------------------- 1 | define(['./createBaseFor'], function(createBaseFor) { 2 | 3 | /** 4 | * This function is like `baseFor` except that it iterates over properties 5 | * in the opposite order. 6 | * 7 | * @private 8 | * @param {Object} object The object to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @param {Function} keysFunc The function to get the keys of `object`. 11 | * @returns {Object} Returns `object`. 12 | */ 13 | var baseForRight = createBaseFor(true); 14 | 15 | return baseForRight; 16 | }); 17 | -------------------------------------------------------------------------------- /modern/internal/baseIsFunction.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * The base implementation of `_.isFunction` without support for environments 5 | * with incorrect `typeof` results. 6 | * 7 | * @private 8 | * @param {*} value The value to check. 9 | * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. 10 | */ 11 | function baseIsFunction(value) { 12 | // Avoid a Chakra JIT bug in compatibility modes of IE 11. 13 | // See https://github.com/jashkenas/underscore/issues/1621 for more details. 14 | return typeof value == 'function' || false; 15 | } 16 | 17 | return baseIsFunction; 18 | }); 19 | -------------------------------------------------------------------------------- /modern/internal/baseLodash.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * The function whose prototype all chaining wrappers inherit from. 5 | * 6 | * @private 7 | */ 8 | function baseLodash() { 9 | // No operation performed. 10 | } 11 | 12 | return baseLodash; 13 | }); 14 | -------------------------------------------------------------------------------- /modern/internal/baseMap.js: -------------------------------------------------------------------------------- 1 | define(['./baseEach', './isArrayLike'], function(baseEach, isArrayLike) { 2 | 3 | /** 4 | * The base implementation of `_.map` without support for callback shorthands 5 | * and `this` binding. 6 | * 7 | * @private 8 | * @param {Array|Object|string} collection The collection to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @returns {Array} Returns the new mapped array. 11 | */ 12 | function baseMap(collection, iteratee) { 13 | var index = -1, 14 | result = isArrayLike(collection) ? Array(collection.length) : []; 15 | 16 | baseEach(collection, function(value, key, collection) { 17 | result[++index] = iteratee(value, key, collection); 18 | }); 19 | return result; 20 | } 21 | 22 | return baseMap; 23 | }); 24 | -------------------------------------------------------------------------------- /modern/internal/baseProperty.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * The base implementation of `_.property` without support for deep paths. 8 | * 9 | * @private 10 | * @param {string} key The key of the property to get. 11 | * @returns {Function} Returns the new function. 12 | */ 13 | function baseProperty(key) { 14 | return function(object) { 15 | return object == null ? undefined : object[key]; 16 | }; 17 | } 18 | 19 | return baseProperty; 20 | }); 21 | -------------------------------------------------------------------------------- /modern/internal/basePropertyDeep.js: -------------------------------------------------------------------------------- 1 | define(['./baseGet', './toPath'], function(baseGet, toPath) { 2 | 3 | /** 4 | * A specialized version of `baseProperty` which supports deep paths. 5 | * 6 | * @private 7 | * @param {Array|string} path The path of the property to get. 8 | * @returns {Function} Returns the new function. 9 | */ 10 | function basePropertyDeep(path) { 11 | var pathKey = (path + ''); 12 | path = toPath(path); 13 | return function(object) { 14 | return baseGet(object, path, pathKey); 15 | }; 16 | } 17 | 18 | return basePropertyDeep; 19 | }); 20 | -------------------------------------------------------------------------------- /modern/internal/baseRandom.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /* Native method references for those with the same name as other `lodash` methods. */ 4 | var nativeFloor = Math.floor, 5 | nativeRandom = Math.random; 6 | 7 | /** 8 | * The base implementation of `_.random` without support for argument juggling 9 | * and returning floating-point numbers. 10 | * 11 | * @private 12 | * @param {number} min The minimum possible value. 13 | * @param {number} max The maximum possible value. 14 | * @returns {number} Returns the random number. 15 | */ 16 | function baseRandom(min, max) { 17 | return min + nativeFloor(nativeRandom() * (max - min + 1)); 18 | } 19 | 20 | return baseRandom; 21 | }); 22 | -------------------------------------------------------------------------------- /modern/internal/baseSetData.js: -------------------------------------------------------------------------------- 1 | define(['../utility/identity', './metaMap'], function(identity, metaMap) { 2 | 3 | /** 4 | * The base implementation of `setData` without support for hot loop detection. 5 | * 6 | * @private 7 | * @param {Function} func The function to associate metadata with. 8 | * @param {*} data The metadata. 9 | * @returns {Function} Returns `func`. 10 | */ 11 | var baseSetData = !metaMap ? identity : function(func, data) { 12 | metaMap.set(func, data); 13 | return func; 14 | }; 15 | 16 | return baseSetData; 17 | }); 18 | -------------------------------------------------------------------------------- /modern/internal/baseSome.js: -------------------------------------------------------------------------------- 1 | define(['./baseEach'], function(baseEach) { 2 | 3 | /** 4 | * The base implementation of `_.some` without support for callback shorthands 5 | * and `this` binding. 6 | * 7 | * @private 8 | * @param {Array|Object|string} collection The collection to iterate over. 9 | * @param {Function} predicate The function invoked per iteration. 10 | * @returns {boolean} Returns `true` if any element passes the predicate check, 11 | * else `false`. 12 | */ 13 | function baseSome(collection, predicate) { 14 | var result; 15 | 16 | baseEach(collection, function(value, index, collection) { 17 | result = predicate(value, index, collection); 18 | return !result; 19 | }); 20 | return !!result; 21 | } 22 | 23 | return baseSome; 24 | }); 25 | -------------------------------------------------------------------------------- /modern/internal/baseSortBy.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * The base implementation of `_.sortBy` which uses `comparer` to define 5 | * the sort order of `array` and replaces criteria objects with their 6 | * corresponding values. 7 | * 8 | * @private 9 | * @param {Array} array The array to sort. 10 | * @param {Function} comparer The function to define sort order. 11 | * @returns {Array} Returns `array`. 12 | */ 13 | function baseSortBy(array, comparer) { 14 | var length = array.length; 15 | 16 | array.sort(comparer); 17 | while (length--) { 18 | array[length] = array[length].value; 19 | } 20 | return array; 21 | } 22 | 23 | return baseSortBy; 24 | }); 25 | -------------------------------------------------------------------------------- /modern/internal/baseSum.js: -------------------------------------------------------------------------------- 1 | define(['./baseEach'], function(baseEach) { 2 | 3 | /** 4 | * The base implementation of `_.sum` without support for callback shorthands 5 | * and `this` binding. 6 | * 7 | * @private 8 | * @param {Array|Object|string} collection The collection to iterate over. 9 | * @param {Function} iteratee The function invoked per iteration. 10 | * @returns {number} Returns the sum. 11 | */ 12 | function baseSum(collection, iteratee) { 13 | var result = 0; 14 | baseEach(collection, function(value, index, collection) { 15 | result += +iteratee(value, index, collection) || 0; 16 | }); 17 | return result; 18 | } 19 | 20 | return baseSum; 21 | }); 22 | -------------------------------------------------------------------------------- /modern/internal/baseToString.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Converts `value` to a string if it's not one. An empty string is returned 5 | * for `null` or `undefined` values. 6 | * 7 | * @private 8 | * @param {*} value The value to process. 9 | * @returns {string} Returns the string. 10 | */ 11 | function baseToString(value) { 12 | return value == null ? '' : (value + ''); 13 | } 14 | 15 | return baseToString; 16 | }); 17 | -------------------------------------------------------------------------------- /modern/internal/baseValues.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * The base implementation of `_.values` and `_.valuesIn` which creates an 5 | * array of `object` property values corresponding to the property names 6 | * of `props`. 7 | * 8 | * @private 9 | * @param {Object} object The object to query. 10 | * @param {Array} props The property names to get values for. 11 | * @returns {Object} Returns the array of property values. 12 | */ 13 | function baseValues(object, props) { 14 | var index = -1, 15 | length = props.length, 16 | result = Array(length); 17 | 18 | while (++index < length) { 19 | result[index] = object[props[index]]; 20 | } 21 | return result; 22 | } 23 | 24 | return baseValues; 25 | }); 26 | -------------------------------------------------------------------------------- /modern/internal/bufferClone.js: -------------------------------------------------------------------------------- 1 | define(['./root'], function(root) { 2 | 3 | /** Native method references. */ 4 | var ArrayBuffer = root.ArrayBuffer, 5 | Uint8Array = root.Uint8Array; 6 | 7 | /** 8 | * Creates a clone of the given array buffer. 9 | * 10 | * @private 11 | * @param {ArrayBuffer} buffer The array buffer to clone. 12 | * @returns {ArrayBuffer} Returns the cloned array buffer. 13 | */ 14 | function bufferClone(buffer) { 15 | var result = new ArrayBuffer(buffer.byteLength), 16 | view = new Uint8Array(result); 17 | 18 | view.set(new Uint8Array(buffer)); 19 | return result; 20 | } 21 | 22 | return bufferClone; 23 | }); 24 | -------------------------------------------------------------------------------- /modern/internal/cacheIndexOf.js: -------------------------------------------------------------------------------- 1 | define(['../lang/isObject'], function(isObject) { 2 | 3 | /** 4 | * Checks if `value` is in `cache` mimicking the return signature of 5 | * `_.indexOf` by returning `0` if the value is found, else `-1`. 6 | * 7 | * @private 8 | * @param {Object} cache The cache to search. 9 | * @param {*} value The value to search for. 10 | * @returns {number} Returns `0` if `value` is found, else `-1`. 11 | */ 12 | function cacheIndexOf(cache, value) { 13 | var data = cache.data, 14 | result = (typeof value == 'string' || isObject(value)) ? data.set.has(value) : data.hash[value]; 15 | 16 | return result ? 0 : -1; 17 | } 18 | 19 | return cacheIndexOf; 20 | }); 21 | -------------------------------------------------------------------------------- /modern/internal/cachePush.js: -------------------------------------------------------------------------------- 1 | define(['../lang/isObject'], function(isObject) { 2 | 3 | /** 4 | * Adds `value` to the cache. 5 | * 6 | * @private 7 | * @name push 8 | * @memberOf SetCache 9 | * @param {*} value The value to cache. 10 | */ 11 | function cachePush(value) { 12 | var data = this.data; 13 | if (typeof value == 'string' || isObject(value)) { 14 | data.set.add(value); 15 | } else { 16 | data.hash[value] = true; 17 | } 18 | } 19 | 20 | return cachePush; 21 | }); 22 | -------------------------------------------------------------------------------- /modern/internal/charsLeftIndex.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Used by `_.trim` and `_.trimLeft` to get the index of the first character 5 | * of `string` that is not found in `chars`. 6 | * 7 | * @private 8 | * @param {string} string The string to inspect. 9 | * @param {string} chars The characters to find. 10 | * @returns {number} Returns the index of the first character not found in `chars`. 11 | */ 12 | function charsLeftIndex(string, chars) { 13 | var index = -1, 14 | length = string.length; 15 | 16 | while (++index < length && chars.indexOf(string.charAt(index)) > -1) {} 17 | return index; 18 | } 19 | 20 | return charsLeftIndex; 21 | }); 22 | -------------------------------------------------------------------------------- /modern/internal/charsRightIndex.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Used by `_.trim` and `_.trimRight` to get the index of the last character 5 | * of `string` that is not found in `chars`. 6 | * 7 | * @private 8 | * @param {string} string The string to inspect. 9 | * @param {string} chars The characters to find. 10 | * @returns {number} Returns the index of the last character not found in `chars`. 11 | */ 12 | function charsRightIndex(string, chars) { 13 | var index = string.length; 14 | 15 | while (index-- && chars.indexOf(string.charAt(index)) > -1) {} 16 | return index; 17 | } 18 | 19 | return charsRightIndex; 20 | }); 21 | -------------------------------------------------------------------------------- /modern/internal/compareAscending.js: -------------------------------------------------------------------------------- 1 | define(['./baseCompareAscending'], function(baseCompareAscending) { 2 | 3 | /** 4 | * Used by `_.sortBy` to compare transformed elements of a collection and stable 5 | * sort them in ascending order. 6 | * 7 | * @private 8 | * @param {Object} object The object to compare. 9 | * @param {Object} other The other object to compare. 10 | * @returns {number} Returns the sort order indicator for `object`. 11 | */ 12 | function compareAscending(object, other) { 13 | return baseCompareAscending(object.criteria, other.criteria) || (object.index - other.index); 14 | } 15 | 16 | return compareAscending; 17 | }); 18 | -------------------------------------------------------------------------------- /modern/internal/createBindWrapper.js: -------------------------------------------------------------------------------- 1 | define(['./createCtorWrapper', './root'], function(createCtorWrapper, root) { 2 | 3 | /** 4 | * Creates a function that wraps `func` and invokes it with the `this` 5 | * binding of `thisArg`. 6 | * 7 | * @private 8 | * @param {Function} func The function to bind. 9 | * @param {*} [thisArg] The `this` binding of `func`. 10 | * @returns {Function} Returns the new bound function. 11 | */ 12 | function createBindWrapper(func, thisArg) { 13 | var Ctor = createCtorWrapper(func); 14 | 15 | function wrapper() { 16 | var fn = (this && this !== root && this instanceof wrapper) ? Ctor : func; 17 | return fn.apply(thisArg, arguments); 18 | } 19 | return wrapper; 20 | } 21 | 22 | return createBindWrapper; 23 | }); 24 | -------------------------------------------------------------------------------- /modern/internal/createCache.js: -------------------------------------------------------------------------------- 1 | define(['./SetCache', './getNative', './root'], function(SetCache, getNative, root) { 2 | 3 | /** Native method references. */ 4 | var Set = getNative(root, 'Set'); 5 | 6 | /* Native method references for those with the same name as other `lodash` methods. */ 7 | var nativeCreate = getNative(Object, 'create'); 8 | 9 | /** 10 | * Creates a `Set` cache object to optimize linear searches of large arrays. 11 | * 12 | * @private 13 | * @param {Array} [values] The values to cache. 14 | * @returns {null|Object} Returns the new cache object if `Set` is supported, else `null`. 15 | */ 16 | function createCache(values) { 17 | return (nativeCreate && Set) ? new SetCache(values) : null; 18 | } 19 | 20 | return createCache; 21 | }); 22 | -------------------------------------------------------------------------------- /modern/internal/createCompounder.js: -------------------------------------------------------------------------------- 1 | define(['../string/deburr', '../string/words'], function(deburr, words) { 2 | 3 | /** 4 | * Creates a function that produces compound words out of the words in a 5 | * given string. 6 | * 7 | * @private 8 | * @param {Function} callback The function to combine each word. 9 | * @returns {Function} Returns the new compounder function. 10 | */ 11 | function createCompounder(callback) { 12 | return function(string) { 13 | var index = -1, 14 | array = words(deburr(string)), 15 | length = array.length, 16 | result = ''; 17 | 18 | while (++index < length) { 19 | result = callback(result, array[index], index); 20 | } 21 | return result; 22 | }; 23 | } 24 | 25 | return createCompounder; 26 | }); 27 | -------------------------------------------------------------------------------- /modern/internal/createFindIndex.js: -------------------------------------------------------------------------------- 1 | define(['./baseCallback', './baseFindIndex'], function(baseCallback, baseFindIndex) { 2 | 3 | /** 4 | * Creates a `_.findIndex` or `_.findLastIndex` function. 5 | * 6 | * @private 7 | * @param {boolean} [fromRight] Specify iterating from right to left. 8 | * @returns {Function} Returns the new find function. 9 | */ 10 | function createFindIndex(fromRight) { 11 | return function(array, predicate, thisArg) { 12 | if (!(array && array.length)) { 13 | return -1; 14 | } 15 | predicate = baseCallback(predicate, thisArg, 3); 16 | return baseFindIndex(array, predicate, fromRight); 17 | }; 18 | } 19 | 20 | return createFindIndex; 21 | }); 22 | -------------------------------------------------------------------------------- /modern/internal/createFindKey.js: -------------------------------------------------------------------------------- 1 | define(['./baseCallback', './baseFind'], function(baseCallback, baseFind) { 2 | 3 | /** 4 | * Creates a `_.findKey` or `_.findLastKey` function. 5 | * 6 | * @private 7 | * @param {Function} objectFunc The function to iterate over an object. 8 | * @returns {Function} Returns the new find function. 9 | */ 10 | function createFindKey(objectFunc) { 11 | return function(object, predicate, thisArg) { 12 | predicate = baseCallback(predicate, thisArg, 3); 13 | return baseFind(object, predicate, objectFunc, true); 14 | }; 15 | } 16 | 17 | return createFindKey; 18 | }); 19 | -------------------------------------------------------------------------------- /modern/internal/createForIn.js: -------------------------------------------------------------------------------- 1 | define(['./bindCallback', '../object/keysIn'], function(bindCallback, keysIn) { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * Creates a function for `_.forIn` or `_.forInRight`. 8 | * 9 | * @private 10 | * @param {Function} objectFunc The function to iterate over an object. 11 | * @returns {Function} Returns the new each function. 12 | */ 13 | function createForIn(objectFunc) { 14 | return function(object, iteratee, thisArg) { 15 | if (typeof iteratee != 'function' || thisArg !== undefined) { 16 | iteratee = bindCallback(iteratee, thisArg, 3); 17 | } 18 | return objectFunc(object, iteratee, keysIn); 19 | }; 20 | } 21 | 22 | return createForIn; 23 | }); 24 | -------------------------------------------------------------------------------- /modern/internal/createForOwn.js: -------------------------------------------------------------------------------- 1 | define(['./bindCallback'], function(bindCallback) { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * Creates a function for `_.forOwn` or `_.forOwnRight`. 8 | * 9 | * @private 10 | * @param {Function} objectFunc The function to iterate over an object. 11 | * @returns {Function} Returns the new each function. 12 | */ 13 | function createForOwn(objectFunc) { 14 | return function(object, iteratee, thisArg) { 15 | if (typeof iteratee != 'function' || thisArg !== undefined) { 16 | iteratee = bindCallback(iteratee, thisArg, 3); 17 | } 18 | return objectFunc(object, iteratee); 19 | }; 20 | } 21 | 22 | return createForOwn; 23 | }); 24 | -------------------------------------------------------------------------------- /modern/internal/createPadDir.js: -------------------------------------------------------------------------------- 1 | define(['./baseToString', './createPadding'], function(baseToString, createPadding) { 2 | 3 | /** 4 | * Creates a function for `_.padLeft` or `_.padRight`. 5 | * 6 | * @private 7 | * @param {boolean} [fromRight] Specify padding from the right. 8 | * @returns {Function} Returns the new pad function. 9 | */ 10 | function createPadDir(fromRight) { 11 | return function(string, length, chars) { 12 | string = baseToString(string); 13 | return (fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string); 14 | }; 15 | } 16 | 17 | return createPadDir; 18 | }); 19 | -------------------------------------------------------------------------------- /modern/internal/createPartial.js: -------------------------------------------------------------------------------- 1 | define(['./createWrapper', './replaceHolders', '../function/restParam'], function(createWrapper, replaceHolders, restParam) { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * Creates a `_.partial` or `_.partialRight` function. 8 | * 9 | * @private 10 | * @param {boolean} flag The partial bit flag. 11 | * @returns {Function} Returns the new partial function. 12 | */ 13 | function createPartial(flag) { 14 | var partialFunc = restParam(function(func, partials) { 15 | var holders = replaceHolders(partials, partialFunc.placeholder); 16 | return createWrapper(func, flag, undefined, partials, holders); 17 | }); 18 | return partialFunc; 19 | } 20 | 21 | return createPartial; 22 | }); 23 | -------------------------------------------------------------------------------- /modern/internal/createSortedIndex.js: -------------------------------------------------------------------------------- 1 | define(['./baseCallback', './binaryIndex', './binaryIndexBy'], function(baseCallback, binaryIndex, binaryIndexBy) { 2 | 3 | /** 4 | * Creates a `_.sortedIndex` or `_.sortedLastIndex` function. 5 | * 6 | * @private 7 | * @param {boolean} [retHighest] Specify returning the highest qualified index. 8 | * @returns {Function} Returns the new index function. 9 | */ 10 | function createSortedIndex(retHighest) { 11 | return function(array, value, iteratee, thisArg) { 12 | return iteratee == null 13 | ? binaryIndex(array, value, retHighest) 14 | : binaryIndexBy(array, value, baseCallback(iteratee, thisArg, 1), retHighest); 15 | }; 16 | } 17 | 18 | return createSortedIndex; 19 | }); 20 | -------------------------------------------------------------------------------- /modern/internal/escapeHtmlChar.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used to map characters to HTML entities. */ 4 | var htmlEscapes = { 5 | '&': '&', 6 | '<': '<', 7 | '>': '>', 8 | '"': '"', 9 | "'": ''', 10 | '`': '`' 11 | }; 12 | 13 | /** 14 | * Used by `_.escape` to convert characters to HTML entities. 15 | * 16 | * @private 17 | * @param {string} chr The matched character to escape. 18 | * @returns {string} Returns the escaped character. 19 | */ 20 | function escapeHtmlChar(chr) { 21 | return htmlEscapes[chr]; 22 | } 23 | 24 | return escapeHtmlChar; 25 | }); 26 | -------------------------------------------------------------------------------- /modern/internal/escapeStringChar.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used to escape characters for inclusion in compiled string literals. */ 4 | var stringEscapes = { 5 | '\\': '\\', 6 | "'": "'", 7 | '\n': 'n', 8 | '\r': 'r', 9 | '\u2028': 'u2028', 10 | '\u2029': 'u2029' 11 | }; 12 | 13 | /** 14 | * Used by `_.template` to escape characters for inclusion in compiled string literals. 15 | * 16 | * @private 17 | * @param {string} chr The matched character to escape. 18 | * @returns {string} Returns the escaped character. 19 | */ 20 | function escapeStringChar(chr) { 21 | return '\\' + stringEscapes[chr]; 22 | } 23 | 24 | return escapeStringChar; 25 | }); 26 | -------------------------------------------------------------------------------- /modern/internal/getData.js: -------------------------------------------------------------------------------- 1 | define(['./metaMap', '../utility/noop'], function(metaMap, noop) { 2 | 3 | /** 4 | * Gets metadata for `func`. 5 | * 6 | * @private 7 | * @param {Function} func The function to query. 8 | * @returns {*} Returns the metadata for `func`. 9 | */ 10 | var getData = !metaMap ? noop : function(func) { 11 | return metaMap.get(func); 12 | }; 13 | 14 | return getData; 15 | }); 16 | -------------------------------------------------------------------------------- /modern/internal/getFuncName.js: -------------------------------------------------------------------------------- 1 | define(['./realNames'], function(realNames) { 2 | 3 | /** 4 | * Gets the name of `func`. 5 | * 6 | * @private 7 | * @param {Function} func The function to query. 8 | * @returns {string} Returns the function name. 9 | */ 10 | function getFuncName(func) { 11 | var result = (func.name + ''), 12 | array = realNames[result], 13 | length = array ? array.length : 0; 14 | 15 | while (length--) { 16 | var data = array[length], 17 | otherFunc = data.func; 18 | if (otherFunc == null || otherFunc == func) { 19 | return data.name; 20 | } 21 | } 22 | return result; 23 | } 24 | 25 | return getFuncName; 26 | }); 27 | -------------------------------------------------------------------------------- /modern/internal/getLength.js: -------------------------------------------------------------------------------- 1 | define(['./baseProperty'], function(baseProperty) { 2 | 3 | /** 4 | * Gets the "length" property value of `object`. 5 | * 6 | * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) 7 | * that affects Safari on at least iOS 8.1-8.3 ARM64. 8 | * 9 | * @private 10 | * @param {Object} object The object to query. 11 | * @returns {*} Returns the "length" value. 12 | */ 13 | var getLength = baseProperty('length'); 14 | 15 | return getLength; 16 | }); 17 | -------------------------------------------------------------------------------- /modern/internal/getMatchData.js: -------------------------------------------------------------------------------- 1 | define(['./isStrictComparable', '../object/pairs'], function(isStrictComparable, pairs) { 2 | 3 | /** 4 | * Gets the propery names, values, and compare flags of `object`. 5 | * 6 | * @private 7 | * @param {Object} object The object to query. 8 | * @returns {Array} Returns the match data of `object`. 9 | */ 10 | function getMatchData(object) { 11 | var result = pairs(object), 12 | length = result.length; 13 | 14 | while (length--) { 15 | result[length][2] = isStrictComparable(result[length][1]); 16 | } 17 | return result; 18 | } 19 | 20 | return getMatchData; 21 | }); 22 | -------------------------------------------------------------------------------- /modern/internal/getNative.js: -------------------------------------------------------------------------------- 1 | define(['../lang/isNative'], function(isNative) { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * Gets the native function at `key` of `object`. 8 | * 9 | * @private 10 | * @param {Object} object The object to query. 11 | * @param {string} key The key of the method to get. 12 | * @returns {*} Returns the function if it's native, else `undefined`. 13 | */ 14 | function getNative(object, key) { 15 | var value = object == null ? undefined : object[key]; 16 | return isNative(value) ? value : undefined; 17 | } 18 | 19 | return getNative; 20 | }); 21 | -------------------------------------------------------------------------------- /modern/internal/indexOfNaN.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Gets the index at which the first occurrence of `NaN` is found in `array`. 5 | * 6 | * @private 7 | * @param {Array} array The array to search. 8 | * @param {number} fromIndex The index to search from. 9 | * @param {boolean} [fromRight] Specify iterating from right to left. 10 | * @returns {number} Returns the index of the matched `NaN`, else `-1`. 11 | */ 12 | function indexOfNaN(array, fromIndex, fromRight) { 13 | var length = array.length, 14 | index = fromIndex + (fromRight ? 0 : -1); 15 | 16 | while ((fromRight ? index-- : ++index < length)) { 17 | var other = array[index]; 18 | if (other !== other) { 19 | return index; 20 | } 21 | } 22 | return -1; 23 | } 24 | 25 | return indexOfNaN; 26 | }); 27 | -------------------------------------------------------------------------------- /modern/internal/initCloneObject.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Initializes an object clone. 5 | * 6 | * @private 7 | * @param {Object} object The object to clone. 8 | * @returns {Object} Returns the initialized clone. 9 | */ 10 | function initCloneObject(object) { 11 | var Ctor = object.constructor; 12 | if (!(typeof Ctor == 'function' && Ctor instanceof Ctor)) { 13 | Ctor = Object; 14 | } 15 | return new Ctor; 16 | } 17 | 18 | return initCloneObject; 19 | }); 20 | -------------------------------------------------------------------------------- /modern/internal/isArrayLike.js: -------------------------------------------------------------------------------- 1 | define(['./getLength', './isLength'], function(getLength, isLength) { 2 | 3 | /** 4 | * Checks if `value` is array-like. 5 | * 6 | * @private 7 | * @param {*} value The value to check. 8 | * @returns {boolean} Returns `true` if `value` is array-like, else `false`. 9 | */ 10 | function isArrayLike(value) { 11 | return value != null && isLength(getLength(value)); 12 | } 13 | 14 | return isArrayLike; 15 | }); 16 | -------------------------------------------------------------------------------- /modern/internal/isLaziable.js: -------------------------------------------------------------------------------- 1 | define(['./LazyWrapper', './getData', './getFuncName', '../chain/lodash'], function(LazyWrapper, getData, getFuncName, lodash) { 2 | 3 | /** 4 | * Checks if `func` has a lazy counterpart. 5 | * 6 | * @private 7 | * @param {Function} func The function to check. 8 | * @returns {boolean} Returns `true` if `func` has a lazy counterpart, else `false`. 9 | */ 10 | function isLaziable(func) { 11 | var funcName = getFuncName(func), 12 | other = lodash[funcName]; 13 | 14 | if (typeof other != 'function' || !(funcName in LazyWrapper.prototype)) { 15 | return false; 16 | } 17 | if (func === other) { 18 | return true; 19 | } 20 | var data = getData(other); 21 | return !!data && func === data[0]; 22 | } 23 | 24 | return isLaziable; 25 | }); 26 | -------------------------------------------------------------------------------- /modern/internal/isLength.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) 5 | * of an array-like value. 6 | */ 7 | var MAX_SAFE_INTEGER = 9007199254740991; 8 | 9 | /** 10 | * Checks if `value` is a valid array-like length. 11 | * 12 | * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). 13 | * 14 | * @private 15 | * @param {*} value The value to check. 16 | * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. 17 | */ 18 | function isLength(value) { 19 | return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; 20 | } 21 | 22 | return isLength; 23 | }); 24 | -------------------------------------------------------------------------------- /modern/internal/isObjectLike.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Checks if `value` is object-like. 5 | * 6 | * @private 7 | * @param {*} value The value to check. 8 | * @returns {boolean} Returns `true` if `value` is object-like, else `false`. 9 | */ 10 | function isObjectLike(value) { 11 | return !!value && typeof value == 'object'; 12 | } 13 | 14 | return isObjectLike; 15 | }); 16 | -------------------------------------------------------------------------------- /modern/internal/isSpace.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Used by `trimmedLeftIndex` and `trimmedRightIndex` to determine if a 5 | * character code is whitespace. 6 | * 7 | * @private 8 | * @param {number} charCode The character code to inspect. 9 | * @returns {boolean} Returns `true` if `charCode` is whitespace, else `false`. 10 | */ 11 | function isSpace(charCode) { 12 | return ((charCode <= 160 && (charCode >= 9 && charCode <= 13) || charCode == 32 || charCode == 160) || charCode == 5760 || charCode == 6158 || 13 | (charCode >= 8192 && (charCode <= 8202 || charCode == 8232 || charCode == 8233 || charCode == 8239 || charCode == 8287 || charCode == 12288 || charCode == 65279))); 14 | } 15 | 16 | return isSpace; 17 | }); 18 | -------------------------------------------------------------------------------- /modern/internal/isStrictComparable.js: -------------------------------------------------------------------------------- 1 | define(['../lang/isObject'], function(isObject) { 2 | 3 | /** 4 | * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. 5 | * 6 | * @private 7 | * @param {*} value The value to check. 8 | * @returns {boolean} Returns `true` if `value` if suitable for strict 9 | * equality comparisons, else `false`. 10 | */ 11 | function isStrictComparable(value) { 12 | return value === value && !isObject(value); 13 | } 14 | 15 | return isStrictComparable; 16 | }); 17 | -------------------------------------------------------------------------------- /modern/internal/lazyClone.js: -------------------------------------------------------------------------------- 1 | define(['./LazyWrapper', './arrayCopy'], function(LazyWrapper, arrayCopy) { 2 | 3 | /** 4 | * Creates a clone of the lazy wrapper object. 5 | * 6 | * @private 7 | * @name clone 8 | * @memberOf LazyWrapper 9 | * @returns {Object} Returns the cloned `LazyWrapper` object. 10 | */ 11 | function lazyClone() { 12 | var result = new LazyWrapper(this.__wrapped__); 13 | result.__actions__ = arrayCopy(this.__actions__); 14 | result.__dir__ = this.__dir__; 15 | result.__filtered__ = this.__filtered__; 16 | result.__iteratees__ = arrayCopy(this.__iteratees__); 17 | result.__takeCount__ = this.__takeCount__; 18 | result.__views__ = arrayCopy(this.__views__); 19 | return result; 20 | } 21 | 22 | return lazyClone; 23 | }); 24 | -------------------------------------------------------------------------------- /modern/internal/lazyReverse.js: -------------------------------------------------------------------------------- 1 | define(['./LazyWrapper'], function(LazyWrapper) { 2 | 3 | /** 4 | * Reverses the direction of lazy iteration. 5 | * 6 | * @private 7 | * @name reverse 8 | * @memberOf LazyWrapper 9 | * @returns {Object} Returns the new reversed `LazyWrapper` object. 10 | */ 11 | function lazyReverse() { 12 | if (this.__filtered__) { 13 | var result = new LazyWrapper(this); 14 | result.__dir__ = -1; 15 | result.__filtered__ = true; 16 | } else { 17 | result = this.clone(); 18 | result.__dir__ *= -1; 19 | } 20 | return result; 21 | } 22 | 23 | return lazyReverse; 24 | }); 25 | -------------------------------------------------------------------------------- /modern/internal/mapDelete.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Removes `key` and its value from the cache. 5 | * 6 | * @private 7 | * @name delete 8 | * @memberOf _.memoize.Cache 9 | * @param {string} key The key of the value to remove. 10 | * @returns {boolean} Returns `true` if the entry was removed successfully, else `false`. 11 | */ 12 | function mapDelete(key) { 13 | return this.has(key) && delete this.__data__[key]; 14 | } 15 | 16 | return mapDelete; 17 | }); 18 | -------------------------------------------------------------------------------- /modern/internal/mapGet.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * Gets the cached value for `key`. 8 | * 9 | * @private 10 | * @name get 11 | * @memberOf _.memoize.Cache 12 | * @param {string} key The key of the value to get. 13 | * @returns {*} Returns the cached value. 14 | */ 15 | function mapGet(key) { 16 | return key == '__proto__' ? undefined : this.__data__[key]; 17 | } 18 | 19 | return mapGet; 20 | }); 21 | -------------------------------------------------------------------------------- /modern/internal/mapHas.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used for native method references. */ 4 | var objectProto = Object.prototype; 5 | 6 | /** Used to check objects for own properties. */ 7 | var hasOwnProperty = objectProto.hasOwnProperty; 8 | 9 | /** 10 | * Checks if a cached value for `key` exists. 11 | * 12 | * @private 13 | * @name has 14 | * @memberOf _.memoize.Cache 15 | * @param {string} key The key of the entry to check. 16 | * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. 17 | */ 18 | function mapHas(key) { 19 | return key != '__proto__' && hasOwnProperty.call(this.__data__, key); 20 | } 21 | 22 | return mapHas; 23 | }); 24 | -------------------------------------------------------------------------------- /modern/internal/mapSet.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Sets `value` to `key` of the cache. 5 | * 6 | * @private 7 | * @name set 8 | * @memberOf _.memoize.Cache 9 | * @param {string} key The key of the value to cache. 10 | * @param {*} value The value to cache. 11 | * @returns {Object} Returns the cache object. 12 | */ 13 | function mapSet(key, value) { 14 | if (key != '__proto__') { 15 | this.__data__[key] = value; 16 | } 17 | return this; 18 | } 19 | 20 | return mapSet; 21 | }); 22 | -------------------------------------------------------------------------------- /modern/internal/mergeDefaults.js: -------------------------------------------------------------------------------- 1 | define(['../object/merge'], function(merge) { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * Used by `_.defaultsDeep` to customize its `_.merge` use. 8 | * 9 | * @private 10 | * @param {*} objectValue The destination object property value. 11 | * @param {*} sourceValue The source object property value. 12 | * @returns {*} Returns the value to assign to the destination object. 13 | */ 14 | function mergeDefaults(objectValue, sourceValue) { 15 | return objectValue === undefined ? sourceValue : merge(objectValue, sourceValue, mergeDefaults); 16 | } 17 | 18 | return mergeDefaults; 19 | }); 20 | -------------------------------------------------------------------------------- /modern/internal/metaMap.js: -------------------------------------------------------------------------------- 1 | define(['./getNative', './root'], function(getNative, root) { 2 | 3 | /** Native method references. */ 4 | var WeakMap = getNative(root, 'WeakMap'); 5 | 6 | /** Used to store function metadata. */ 7 | var metaMap = WeakMap && new WeakMap; 8 | 9 | return metaMap; 10 | }); 11 | -------------------------------------------------------------------------------- /modern/internal/pickByArray.js: -------------------------------------------------------------------------------- 1 | define(['./toObject'], function(toObject) { 2 | 3 | /** 4 | * A specialized version of `_.pick` which picks `object` properties specified 5 | * by `props`. 6 | * 7 | * @private 8 | * @param {Object} object The source object. 9 | * @param {string[]} props The property names to pick. 10 | * @returns {Object} Returns the new object. 11 | */ 12 | function pickByArray(object, props) { 13 | object = toObject(object); 14 | 15 | var index = -1, 16 | length = props.length, 17 | result = {}; 18 | 19 | while (++index < length) { 20 | var key = props[index]; 21 | if (key in object) { 22 | result[key] = object[key]; 23 | } 24 | } 25 | return result; 26 | } 27 | 28 | return pickByArray; 29 | }); 30 | -------------------------------------------------------------------------------- /modern/internal/pickByCallback.js: -------------------------------------------------------------------------------- 1 | define(['./baseForIn'], function(baseForIn) { 2 | 3 | /** 4 | * A specialized version of `_.pick` which picks `object` properties `predicate` 5 | * returns truthy for. 6 | * 7 | * @private 8 | * @param {Object} object The source object. 9 | * @param {Function} predicate The function invoked per iteration. 10 | * @returns {Object} Returns the new object. 11 | */ 12 | function pickByCallback(object, predicate) { 13 | var result = {}; 14 | baseForIn(object, function(value, key, object) { 15 | if (predicate(value, key, object)) { 16 | result[key] = value; 17 | } 18 | }); 19 | return result; 20 | } 21 | 22 | return pickByCallback; 23 | }); 24 | -------------------------------------------------------------------------------- /modern/internal/reEscape.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used to match template delimiters. */ 4 | var reEscape = /<%-([\s\S]+?)%>/g; 5 | 6 | return reEscape; 7 | }); 8 | -------------------------------------------------------------------------------- /modern/internal/reEvaluate.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used to match template delimiters. */ 4 | var reEvaluate = /<%([\s\S]+?)%>/g; 5 | 6 | return reEvaluate; 7 | }); 8 | -------------------------------------------------------------------------------- /modern/internal/reInterpolate.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used to match template delimiters. */ 4 | var reInterpolate = /<%=([\s\S]+?)%>/g; 5 | 6 | return reInterpolate; 7 | }); 8 | -------------------------------------------------------------------------------- /modern/internal/realNames.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used to lookup unminified function names. */ 4 | var realNames = {}; 5 | 6 | return realNames; 7 | }); 8 | -------------------------------------------------------------------------------- /modern/internal/toIterable.js: -------------------------------------------------------------------------------- 1 | define(['./isArrayLike', '../lang/isObject', '../object/values'], function(isArrayLike, isObject, values) { 2 | 3 | /** 4 | * Converts `value` to an array-like object if it's not one. 5 | * 6 | * @private 7 | * @param {*} value The value to process. 8 | * @returns {Array|Object} Returns the array-like object. 9 | */ 10 | function toIterable(value) { 11 | if (value == null) { 12 | return []; 13 | } 14 | if (!isArrayLike(value)) { 15 | return values(value); 16 | } 17 | return isObject(value) ? value : Object(value); 18 | } 19 | 20 | return toIterable; 21 | }); 22 | -------------------------------------------------------------------------------- /modern/internal/toObject.js: -------------------------------------------------------------------------------- 1 | define(['../lang/isObject'], function(isObject) { 2 | 3 | /** 4 | * Converts `value` to an object if it's not one. 5 | * 6 | * @private 7 | * @param {*} value The value to process. 8 | * @returns {Object} Returns the object. 9 | */ 10 | function toObject(value) { 11 | return isObject(value) ? value : Object(value); 12 | } 13 | 14 | return toObject; 15 | }); 16 | -------------------------------------------------------------------------------- /modern/internal/trimmedLeftIndex.js: -------------------------------------------------------------------------------- 1 | define(['./isSpace'], function(isSpace) { 2 | 3 | /** 4 | * Used by `_.trim` and `_.trimLeft` to get the index of the first non-whitespace 5 | * character of `string`. 6 | * 7 | * @private 8 | * @param {string} string The string to inspect. 9 | * @returns {number} Returns the index of the first non-whitespace character. 10 | */ 11 | function trimmedLeftIndex(string) { 12 | var index = -1, 13 | length = string.length; 14 | 15 | while (++index < length && isSpace(string.charCodeAt(index))) {} 16 | return index; 17 | } 18 | 19 | return trimmedLeftIndex; 20 | }); 21 | -------------------------------------------------------------------------------- /modern/internal/trimmedRightIndex.js: -------------------------------------------------------------------------------- 1 | define(['./isSpace'], function(isSpace) { 2 | 3 | /** 4 | * Used by `_.trim` and `_.trimRight` to get the index of the last non-whitespace 5 | * character of `string`. 6 | * 7 | * @private 8 | * @param {string} string The string to inspect. 9 | * @returns {number} Returns the index of the last non-whitespace character. 10 | */ 11 | function trimmedRightIndex(string) { 12 | var index = string.length; 13 | 14 | while (index-- && isSpace(string.charCodeAt(index))) {} 15 | return index; 16 | } 17 | 18 | return trimmedRightIndex; 19 | }); 20 | -------------------------------------------------------------------------------- /modern/internal/unescapeHtmlChar.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used to map HTML entities to characters. */ 4 | var htmlUnescapes = { 5 | '&': '&', 6 | '<': '<', 7 | '>': '>', 8 | '"': '"', 9 | ''': "'", 10 | '`': '`' 11 | }; 12 | 13 | /** 14 | * Used by `_.unescape` to convert HTML entities to characters. 15 | * 16 | * @private 17 | * @param {string} chr The matched character to unescape. 18 | * @returns {string} Returns the unescaped character. 19 | */ 20 | function unescapeHtmlChar(chr) { 21 | return htmlUnescapes[chr]; 22 | } 23 | 24 | return unescapeHtmlChar; 25 | }); 26 | -------------------------------------------------------------------------------- /modern/internal/wrapperClone.js: -------------------------------------------------------------------------------- 1 | define(['./LazyWrapper', './LodashWrapper', './arrayCopy'], function(LazyWrapper, LodashWrapper, arrayCopy) { 2 | 3 | /** 4 | * Creates a clone of `wrapper`. 5 | * 6 | * @private 7 | * @param {Object} wrapper The wrapper to clone. 8 | * @returns {Object} Returns the cloned wrapper. 9 | */ 10 | function wrapperClone(wrapper) { 11 | return wrapper instanceof LazyWrapper 12 | ? wrapper.clone() 13 | : new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__, arrayCopy(wrapper.__actions__)); 14 | } 15 | 16 | return wrapperClone; 17 | }); 18 | -------------------------------------------------------------------------------- /modern/lang/eq.js: -------------------------------------------------------------------------------- 1 | define(["./isEqual"], function(isEqual) { 2 | return isEqual; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/lang/gt.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Checks if `value` is greater than `other`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Lang 9 | * @param {*} value The value to compare. 10 | * @param {*} other The other value to compare. 11 | * @returns {boolean} Returns `true` if `value` is greater than `other`, else `false`. 12 | * @example 13 | * 14 | * _.gt(3, 1); 15 | * // => true 16 | * 17 | * _.gt(3, 3); 18 | * // => false 19 | * 20 | * _.gt(1, 3); 21 | * // => false 22 | */ 23 | function gt(value, other) { 24 | return value > other; 25 | } 26 | 27 | return gt; 28 | }); 29 | -------------------------------------------------------------------------------- /modern/lang/gte.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Checks if `value` is greater than or equal to `other`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Lang 9 | * @param {*} value The value to compare. 10 | * @param {*} other The other value to compare. 11 | * @returns {boolean} Returns `true` if `value` is greater than or equal to `other`, else `false`. 12 | * @example 13 | * 14 | * _.gte(3, 1); 15 | * // => true 16 | * 17 | * _.gte(3, 3); 18 | * // => true 19 | * 20 | * _.gte(1, 3); 21 | * // => false 22 | */ 23 | function gte(value, other) { 24 | return value >= other; 25 | } 26 | 27 | return gte; 28 | }); 29 | -------------------------------------------------------------------------------- /modern/lang/isElement.js: -------------------------------------------------------------------------------- 1 | define(['../internal/isObjectLike', './isPlainObject'], function(isObjectLike, isPlainObject) { 2 | 3 | /** 4 | * Checks if `value` is a DOM element. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Lang 9 | * @param {*} value The value to check. 10 | * @returns {boolean} Returns `true` if `value` is a DOM element, else `false`. 11 | * @example 12 | * 13 | * _.isElement(document.body); 14 | * // => true 15 | * 16 | * _.isElement(''); 17 | * // => false 18 | */ 19 | function isElement(value) { 20 | return !!value && value.nodeType === 1 && isObjectLike(value) && !isPlainObject(value); 21 | } 22 | 23 | return isElement; 24 | }); 25 | -------------------------------------------------------------------------------- /modern/lang/isNull.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Checks if `value` is `null`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Lang 9 | * @param {*} value The value to check. 10 | * @returns {boolean} Returns `true` if `value` is `null`, else `false`. 11 | * @example 12 | * 13 | * _.isNull(null); 14 | * // => true 15 | * 16 | * _.isNull(void 0); 17 | * // => false 18 | */ 19 | function isNull(value) { 20 | return value === null; 21 | } 22 | 23 | return isNull; 24 | }); 25 | -------------------------------------------------------------------------------- /modern/lang/isUndefined.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** Used as a safe reference for `undefined` in pre-ES5 environments. */ 4 | var undefined; 5 | 6 | /** 7 | * Checks if `value` is `undefined`. 8 | * 9 | * @static 10 | * @memberOf _ 11 | * @category Lang 12 | * @param {*} value The value to check. 13 | * @returns {boolean} Returns `true` if `value` is `undefined`, else `false`. 14 | * @example 15 | * 16 | * _.isUndefined(void 0); 17 | * // => true 18 | * 19 | * _.isUndefined(null); 20 | * // => false 21 | */ 22 | function isUndefined(value) { 23 | return value === undefined; 24 | } 25 | 26 | return isUndefined; 27 | }); 28 | -------------------------------------------------------------------------------- /modern/lang/lt.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Checks if `value` is less than `other`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Lang 9 | * @param {*} value The value to compare. 10 | * @param {*} other The other value to compare. 11 | * @returns {boolean} Returns `true` if `value` is less than `other`, else `false`. 12 | * @example 13 | * 14 | * _.lt(1, 3); 15 | * // => true 16 | * 17 | * _.lt(3, 3); 18 | * // => false 19 | * 20 | * _.lt(3, 1); 21 | * // => false 22 | */ 23 | function lt(value, other) { 24 | return value < other; 25 | } 26 | 27 | return lt; 28 | }); 29 | -------------------------------------------------------------------------------- /modern/lang/lte.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Checks if `value` is less than or equal to `other`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Lang 9 | * @param {*} value The value to compare. 10 | * @param {*} other The other value to compare. 11 | * @returns {boolean} Returns `true` if `value` is less than or equal to `other`, else `false`. 12 | * @example 13 | * 14 | * _.lte(1, 3); 15 | * // => true 16 | * 17 | * _.lte(3, 3); 18 | * // => true 19 | * 20 | * _.lte(3, 1); 21 | * // => false 22 | */ 23 | function lte(value, other) { 24 | return value <= other; 25 | } 26 | 27 | return lte; 28 | }); 29 | -------------------------------------------------------------------------------- /modern/lang/toArray.js: -------------------------------------------------------------------------------- 1 | define(['../internal/arrayCopy', '../internal/getLength', '../internal/isLength', '../object/values'], function(arrayCopy, getLength, isLength, values) { 2 | 3 | /** 4 | * Converts `value` to an array. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Lang 9 | * @param {*} value The value to convert. 10 | * @returns {Array} Returns the converted array. 11 | * @example 12 | * 13 | * (function() { 14 | * return _.toArray(arguments).slice(1); 15 | * }(1, 2, 3)); 16 | * // => [2, 3] 17 | */ 18 | function toArray(value) { 19 | var length = value ? getLength(value) : 0; 20 | if (!isLength(length)) { 21 | return values(value); 22 | } 23 | if (!length) { 24 | return []; 25 | } 26 | return arrayCopy(value); 27 | } 28 | 29 | return toArray; 30 | }); 31 | -------------------------------------------------------------------------------- /modern/math.js: -------------------------------------------------------------------------------- 1 | define(['./math/add', './math/ceil', './math/floor', './math/max', './math/min', './math/round', './math/sum'], function(add, ceil, floor, max, min, round, sum) { 2 | return { 3 | 'add': add, 4 | 'ceil': ceil, 5 | 'floor': floor, 6 | 'max': max, 7 | 'min': min, 8 | 'round': round, 9 | 'sum': sum 10 | }; 11 | }); 12 | -------------------------------------------------------------------------------- /modern/math/add.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Adds two numbers. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Math 9 | * @param {number} augend The first number to add. 10 | * @param {number} addend The second number to add. 11 | * @returns {number} Returns the sum. 12 | * @example 13 | * 14 | * _.add(6, 4); 15 | * // => 10 16 | */ 17 | function add(augend, addend) { 18 | return (+augend || 0) + (+addend || 0); 19 | } 20 | 21 | return add; 22 | }); 23 | -------------------------------------------------------------------------------- /modern/math/ceil.js: -------------------------------------------------------------------------------- 1 | define(['../internal/createRound'], function(createRound) { 2 | 3 | /** 4 | * Calculates `n` rounded up to `precision`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Math 9 | * @param {number} n The number to round up. 10 | * @param {number} [precision=0] The precision to round up to. 11 | * @returns {number} Returns the rounded up number. 12 | * @example 13 | * 14 | * _.ceil(4.006); 15 | * // => 5 16 | * 17 | * _.ceil(6.004, 2); 18 | * // => 6.01 19 | * 20 | * _.ceil(6040, -2); 21 | * // => 6100 22 | */ 23 | var ceil = createRound('ceil'); 24 | 25 | return ceil; 26 | }); 27 | -------------------------------------------------------------------------------- /modern/math/floor.js: -------------------------------------------------------------------------------- 1 | define(['../internal/createRound'], function(createRound) { 2 | 3 | /** 4 | * Calculates `n` rounded down to `precision`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Math 9 | * @param {number} n The number to round down. 10 | * @param {number} [precision=0] The precision to round down to. 11 | * @returns {number} Returns the rounded down number. 12 | * @example 13 | * 14 | * _.floor(4.006); 15 | * // => 4 16 | * 17 | * _.floor(0.046, 2); 18 | * // => 0.04 19 | * 20 | * _.floor(4060, -2); 21 | * // => 4000 22 | */ 23 | var floor = createRound('floor'); 24 | 25 | return floor; 26 | }); 27 | -------------------------------------------------------------------------------- /modern/math/round.js: -------------------------------------------------------------------------------- 1 | define(['../internal/createRound'], function(createRound) { 2 | 3 | /** 4 | * Calculates `n` rounded to `precision`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Math 9 | * @param {number} n The number to round. 10 | * @param {number} [precision=0] The precision to round to. 11 | * @returns {number} Returns the rounded number. 12 | * @example 13 | * 14 | * _.round(4.006); 15 | * // => 4 16 | * 17 | * _.round(4.006, 2); 18 | * // => 4.01 19 | * 20 | * _.round(4060, -2); 21 | * // => 4100 22 | */ 23 | var round = createRound('round'); 24 | 25 | return round; 26 | }); 27 | -------------------------------------------------------------------------------- /modern/number.js: -------------------------------------------------------------------------------- 1 | define(['./number/inRange', './number/random'], function(inRange, random) { 2 | return { 3 | 'inRange': inRange, 4 | 'random': random 5 | }; 6 | }); 7 | -------------------------------------------------------------------------------- /modern/object/extend.js: -------------------------------------------------------------------------------- 1 | define(["./assign"], function(assign) { 2 | return assign; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/object/functions.js: -------------------------------------------------------------------------------- 1 | define(['../internal/baseFunctions', './keysIn'], function(baseFunctions, keysIn) { 2 | 3 | /** 4 | * Creates an array of function property names from all enumerable properties, 5 | * own and inherited, of `object`. 6 | * 7 | * @static 8 | * @memberOf _ 9 | * @alias methods 10 | * @category Object 11 | * @param {Object} object The object to inspect. 12 | * @returns {Array} Returns the new array of property names. 13 | * @example 14 | * 15 | * _.functions(_); 16 | * // => ['after', 'ary', 'assign', ...] 17 | */ 18 | function functions(object) { 19 | return baseFunctions(object, keysIn(object)); 20 | } 21 | 22 | return functions; 23 | }); 24 | -------------------------------------------------------------------------------- /modern/object/methods.js: -------------------------------------------------------------------------------- 1 | define(["./functions"], function(functions) { 2 | return functions; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/string/capitalize.js: -------------------------------------------------------------------------------- 1 | define(['../internal/baseToString'], function(baseToString) { 2 | 3 | /** 4 | * Capitalizes the first character of `string`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category String 9 | * @param {string} [string=''] The string to capitalize. 10 | * @returns {string} Returns the capitalized string. 11 | * @example 12 | * 13 | * _.capitalize('fred'); 14 | * // => 'Fred' 15 | */ 16 | function capitalize(string) { 17 | string = baseToString(string); 18 | return string && (string.charAt(0).toUpperCase() + string.slice(1)); 19 | } 20 | 21 | return capitalize; 22 | }); 23 | -------------------------------------------------------------------------------- /modern/string/kebabCase.js: -------------------------------------------------------------------------------- 1 | define(['../internal/createCompounder'], function(createCompounder) { 2 | 3 | /** 4 | * Converts `string` to [kebab case](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles). 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category String 9 | * @param {string} [string=''] The string to convert. 10 | * @returns {string} Returns the kebab cased string. 11 | * @example 12 | * 13 | * _.kebabCase('Foo Bar'); 14 | * // => 'foo-bar' 15 | * 16 | * _.kebabCase('fooBar'); 17 | * // => 'foo-bar' 18 | * 19 | * _.kebabCase('__foo_bar__'); 20 | * // => 'foo-bar' 21 | */ 22 | var kebabCase = createCompounder(function(result, word, index) { 23 | return result + (index ? '-' : '') + word.toLowerCase(); 24 | }); 25 | 26 | return kebabCase; 27 | }); 28 | -------------------------------------------------------------------------------- /modern/string/padLeft.js: -------------------------------------------------------------------------------- 1 | define(['../internal/createPadDir'], function(createPadDir) { 2 | 3 | /** 4 | * Pads `string` on the left side if it's shorter than `length`. Padding 5 | * characters are truncated if they exceed `length`. 6 | * 7 | * @static 8 | * @memberOf _ 9 | * @category String 10 | * @param {string} [string=''] The string to pad. 11 | * @param {number} [length=0] The padding length. 12 | * @param {string} [chars=' '] The string used as padding. 13 | * @returns {string} Returns the padded string. 14 | * @example 15 | * 16 | * _.padLeft('abc', 6); 17 | * // => ' abc' 18 | * 19 | * _.padLeft('abc', 6, '_-'); 20 | * // => '_-_abc' 21 | * 22 | * _.padLeft('abc', 3); 23 | * // => 'abc' 24 | */ 25 | var padLeft = createPadDir(); 26 | 27 | return padLeft; 28 | }); 29 | -------------------------------------------------------------------------------- /modern/string/padRight.js: -------------------------------------------------------------------------------- 1 | define(['../internal/createPadDir'], function(createPadDir) { 2 | 3 | /** 4 | * Pads `string` on the right side if it's shorter than `length`. Padding 5 | * characters are truncated if they exceed `length`. 6 | * 7 | * @static 8 | * @memberOf _ 9 | * @category String 10 | * @param {string} [string=''] The string to pad. 11 | * @param {number} [length=0] The padding length. 12 | * @param {string} [chars=' '] The string used as padding. 13 | * @returns {string} Returns the padded string. 14 | * @example 15 | * 16 | * _.padRight('abc', 6); 17 | * // => 'abc ' 18 | * 19 | * _.padRight('abc', 6, '_-'); 20 | * // => 'abc_-_' 21 | * 22 | * _.padRight('abc', 3); 23 | * // => 'abc' 24 | */ 25 | var padRight = createPadDir(true); 26 | 27 | return padRight; 28 | }); 29 | -------------------------------------------------------------------------------- /modern/string/snakeCase.js: -------------------------------------------------------------------------------- 1 | define(['../internal/createCompounder'], function(createCompounder) { 2 | 3 | /** 4 | * Converts `string` to [snake case](https://en.wikipedia.org/wiki/Snake_case). 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category String 9 | * @param {string} [string=''] The string to convert. 10 | * @returns {string} Returns the snake cased string. 11 | * @example 12 | * 13 | * _.snakeCase('Foo Bar'); 14 | * // => 'foo_bar' 15 | * 16 | * _.snakeCase('fooBar'); 17 | * // => 'foo_bar' 18 | * 19 | * _.snakeCase('--foo-bar'); 20 | * // => 'foo_bar' 21 | */ 22 | var snakeCase = createCompounder(function(result, word, index) { 23 | return result + (index ? '_' : '') + word.toLowerCase(); 24 | }); 25 | 26 | return snakeCase; 27 | }); 28 | -------------------------------------------------------------------------------- /modern/support.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * An object environment feature flags. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @type Object 9 | */ 10 | var support = {}; 11 | 12 | return support; 13 | }); 14 | -------------------------------------------------------------------------------- /modern/utility/constant.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * Creates a function that returns `value`. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Utility 9 | * @param {*} value The value to return from the new function. 10 | * @returns {Function} Returns the new function. 11 | * @example 12 | * 13 | * var object = { 'user': 'fred' }; 14 | * var getter = _.constant(object); 15 | * 16 | * getter() === object; 17 | * // => true 18 | */ 19 | function constant(value) { 20 | return function() { 21 | return value; 22 | }; 23 | } 24 | 25 | return constant; 26 | }); 27 | -------------------------------------------------------------------------------- /modern/utility/identity.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * This method returns the first argument provided to it. 5 | * 6 | * @static 7 | * @memberOf _ 8 | * @category Utility 9 | * @param {*} value Any value. 10 | * @returns {*} Returns `value`. 11 | * @example 12 | * 13 | * var object = { 'user': 'fred' }; 14 | * 15 | * _.identity(object) === object; 16 | * // => true 17 | */ 18 | function identity(value) { 19 | return value; 20 | } 21 | 22 | return identity; 23 | }); 24 | -------------------------------------------------------------------------------- /modern/utility/iteratee.js: -------------------------------------------------------------------------------- 1 | define(["./callback"], function(callback) { 2 | return callback; 3 | }); 4 | -------------------------------------------------------------------------------- /modern/utility/noop.js: -------------------------------------------------------------------------------- 1 | define([], function() { 2 | 3 | /** 4 | * A no-operation function that returns `undefined` regardless of the 5 | * arguments it receives. 6 | * 7 | * @static 8 | * @memberOf _ 9 | * @category Utility 10 | * @example 11 | * 12 | * var object = { 'user': 'fred' }; 13 | * 14 | * _.noop(object) === undefined; 15 | * // => true 16 | */ 17 | function noop() { 18 | // No operation performed. 19 | } 20 | 21 | return noop; 22 | }); 23 | -------------------------------------------------------------------------------- /modern/utility/uniqueId.js: -------------------------------------------------------------------------------- 1 | define(['../internal/baseToString'], function(baseToString) { 2 | 3 | /** Used to generate unique IDs. */ 4 | var idCounter = 0; 5 | 6 | /** 7 | * Generates a unique ID. If `prefix` is provided the ID is appended to it. 8 | * 9 | * @static 10 | * @memberOf _ 11 | * @category Utility 12 | * @param {string} [prefix] The value to prefix the ID with. 13 | * @returns {string} Returns the unique ID. 14 | * @example 15 | * 16 | * _.uniqueId('contact_'); 17 | * // => 'contact_104' 18 | * 19 | * _.uniqueId(); 20 | * // => '105' 21 | */ 22 | function uniqueId(prefix) { 23 | var id = ++idCounter; 24 | return baseToString(prefix) + id; 25 | } 26 | 27 | return uniqueId; 28 | }); 29 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lodash-amd", 3 | "version": "3.10.2", 4 | "description": "Lodash module bundles for AMD.", 5 | "homepage": "https://lodash.com/", 6 | "icon": "https://lodash.com/icon.svg", 7 | "license": "MIT", 8 | "main": "modern/main.js", 9 | "author": "John-David Dalton