Rebuild lodash and docs.

This commit is contained in:
John-David Dalton
2016-01-24 16:48:21 -08:00
parent 9d2d4f39bc
commit 59de939c1d
10 changed files with 912 additions and 798 deletions

195
dist/lodash.fp.js vendored
View File

@@ -57,10 +57,10 @@ return /******/ (function(modules) { // webpackBootstrap
var baseConvert = __webpack_require__(1);
/**
* Converts `lodash` to an auto-curried iteratee-first data-last version.
* Converts `lodash` to an immutable auto-curried iteratee-first data-last version.
*
* @param {Function} lodash The lodash function.
* @returns {Function} Returns the converted lodash function.
* @returns {Function} Returns the converted `lodash`.
*/
function browserConvert(lodash) {
return baseConvert(lodash, lodash);
@@ -74,7 +74,8 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ function(module, exports, __webpack_require__) {
var mapping = __webpack_require__(2),
mutateMap = mapping.mutateMap;
mutateMap = mapping.mutate,
placeholder = {};
/**
* The base implementation of `convert` which accepts a `util` object of methods
@@ -114,21 +115,16 @@ return /******/ (function(modules) { // webpackBootstrap
keys = _.keys,
rearg = _.rearg;
var baseAry = function(func, n) {
return function() {
var args = arguments,
length = Math.min(args.length, n);
var baseArity = function(func, n) {
return n == 2
? function(a, b) { return func.apply(undefined, arguments); }
: function(a) { return func.apply(undefined, arguments); };
};
switch (length) {
case 1: return func(args[0]);
case 2: return func(args[0], args[1]);
}
args = Array(length);
while (length--) {
args[length] = arguments[length];
}
return func.apply(undefined, args);
};
var baseAry = function(func, n) {
return n == 2
? function(a, b) { return func(a, b); }
: function(a) { return func(a); };
};
var cloneArray = function(array) {
@@ -157,6 +153,13 @@ return /******/ (function(modules) { // webpackBootstrap
});
};
var iterateeRearg = function(func, indexes) {
return overArg(func, function(func) {
var n = indexes.length;
return baseArity(rearg(baseAry(func, n), indexes), n);
});
};
var overArg = function(func, iteratee, retArg) {
return function() {
var length = arguments.length,
@@ -173,7 +176,10 @@ return /******/ (function(modules) { // webpackBootstrap
var wrappers = {
'iteratee': function(iteratee) {
return function(func, arity) {
return function() {
var func = arguments[0],
arity = arguments[1];
arity = arity > 2 ? (arity - 2) : 1;
func = iteratee(func);
var length = func.length;
@@ -233,14 +239,18 @@ return /******/ (function(modules) { // webpackBootstrap
}
var result;
each(mapping.caps, function(cap) {
each(mapping.aryMethodMap[cap], function(otherName) {
each(mapping.aryMethod[cap], function(otherName) {
if (name == otherName) {
var indexes = mapping.iterateeRearg[name],
n = !isLib && mapping.aryIteratee[name];
result = ary(func, cap);
if (cap > 1 && !mapping.skipReargMap[name]) {
result = rearg(result, mapping.methodReargMap[name] || mapping.aryReargMap[cap]);
if (cap > 1 && !mapping.skipRearg[name]) {
result = rearg(result, mapping.methodRearg[name] || mapping.aryRearg[cap]);
}
var n = !isLib && mapping.aryIterateeMap[name];
if (n) {
if (indexes) {
result = iterateeRearg(result, indexes);
} else if (n) {
result = iterateeAry(result, n);
}
if (cap > 1) {
@@ -251,7 +261,12 @@ return /******/ (function(modules) { // webpackBootstrap
});
return !result;
});
return result || func;
result || (result = func);
if (mapping.placeholder[name]) {
result.placeholder = placeholder;
}
return result;
};
if (!isLib) {
@@ -260,8 +275,8 @@ return /******/ (function(modules) { // webpackBootstrap
// Iterate over methods for the current ary cap.
var pairs = [];
each(mapping.caps, function(cap) {
each(mapping.aryMethodMap[cap], function(key) {
var func = _[mapping.keyMap[key] || key];
each(mapping.aryMethod[cap], function(key) {
var func = _[mapping.key[key] || key];
if (func) {
pairs.push([key, wrap(key, func)]);
}
@@ -275,7 +290,7 @@ return /******/ (function(modules) { // webpackBootstrap
// Wrap the lodash method and its aliases.
each(keys(_), function(key) {
each(mapping.aliasMap[key] || [], function(alias) {
each(mapping.alias[key] || [], function(alias) {
_[alias] = _[key];
});
});
@@ -293,28 +308,29 @@ return /******/ (function(modules) { // webpackBootstrap
module.exports = {
/** Used to map method names to their aliases. */
'aliasMap': {
'alias': {
'ary': ['nAry'],
'overEvery': ['allPass'],
'overSome': ['somePass'],
'assignIn': ['extend'],
'assignInWith': ['extendWith'],
'filter': ['whereEq'],
'flatten': ['unnest'],
'flow': ['pipe'],
'flowRight': ['compose'],
'forEach': ['each'],
'forEachRight': ['eachRight'],
'get': ['path'],
'getOr': ['pathOr'],
'get': ['path', 'prop'],
'getOr': ['pathOr', 'propOr'],
'head': ['first'],
'includes': ['contains'],
'initial': ['init'],
'isEqual': ['equals'],
'mapValues': ['mapObj'],
'matchesProperty': ['pathEq'],
'overArgs': ['useWith'],
'omit': ['dissoc', 'omitAll'],
'overArgs': ['useWith'],
'overEvery': ['allPass'],
'overSome': ['somePass'],
'pick': ['pickAll'],
'property': ['prop'],
'propertyOf': ['propOf'],
'rest': ['unapply'],
'some': ['all'],
@@ -323,14 +339,14 @@ return /******/ (function(modules) { // webpackBootstrap
},
/** Used to map method names to their iteratee ary. */
'aryIterateeMap': {
'aryIteratee': {
'assignWith': 2,
'assignInWith': 2,
'cloneDeepWith': 1,
'cloneWith': 1,
'dropRightWhile': 1,
'dropWhile': 1,
'every': 1,
'extendWith': 2,
'filter': 1,
'find': 1,
'findIndex': 1,
@@ -363,61 +379,82 @@ return /******/ (function(modules) { // webpackBootstrap
},
/** Used to map ary to method names. */
'aryMethodMap': {
1: (
'attempt,ceil,create,curry,curryRight,floor,fromPairs,iteratee,invert,over,' +
'overEvery,overSome,memoize,method,methodOf,mixin,rest,reverse,round,' +
'runInContext,template,trim,trimLeft,trimRight,uniqueId,words').split(','),
2: (
'add,ary,assign,at,bind,bindKey,cloneDeepWith,cloneWith,concat,countBy,curryN,' +
'curryRightN,debounce,defaults,defaultsDeep,delay,difference,drop,dropRight,' +
'dropRightWhile,dropWhile,endsWith,eq,every,extend,filter,find,find,findIndex,' +
'findKey,findLast,findLastIndex,findLastKey,flatMap,forEach,forEachRight,' +
'forIn,forInRight,forOwn,forOwnRight,get,groupBy,includes,indexBy,indexOf,' +
'intersection,invoke,invokeMap,isMatch,lastIndexOf,map,mapKeys,mapValues,' +
'matchesProperty,maxBy,mean,minBy,merge,omit,orderBy,overArgs,pad,padLeft,' +
'padRight,parseInt,partition,pick,pull,pullAll,pullAt,random,range,rangeRight,' +
'rearg,reject,remove,repeat,result,sampleSize,some,sortBy,sortedIndexBy,' +
'sortedLastIndexBy,sortedUniqBy,startsWith,subtract,sumBy,take,takeRight,' +
'takeRightWhile,takeWhile,throttle,times,truncate,union,uniqBy,without,wrap,' +
'xor,zip,zipObject').split(','),
3: (
'assignWith,clamp,differenceBy,extendWith,getOr,inRange,intersectionBy,' +
'isEqualWith,isMatchWith,mergeWith,omitBy,pickBy,pullAllBy,reduce,' +
'reduceRight,set,slice,transform,unionBy,xorBy,zipWith').split(','),
4:
['fill', 'setWith']
'aryMethod': {
1:[
'attempt', 'ceil', 'create', 'curry', 'curryRight', 'floor', 'fromPairs',
'invert', 'iteratee', 'memoize', 'method', 'methodOf', 'mixin', 'over',
'overEvery', 'overSome', 'rest', 'reverse', 'round', 'runInContext',
'template', 'trim', 'trimEnd', 'trimStart', 'uniqueId', 'words'
],
2:[
'add', 'after', 'ary', 'assign', 'at', 'before', 'bind', 'bindKey',
'chunk', 'cloneDeepWith', 'cloneWith', 'concat', 'countBy', 'curryN',
'curryRightN', 'debounce', 'defaults', 'defaultsDeep', 'delay', 'difference',
'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith', 'eq',
'every', 'extend', 'filter', 'find', 'find', 'findIndex', 'findKey',
'findLast', 'findLastIndex', 'findLastKey', 'flatMap', 'forEach',
'forEachRight', 'forIn', 'forInRight', 'forOwn', 'forOwnRight', 'get',
'groupBy', 'gt', 'gte', 'has', 'hasIn', 'includes', 'indexOf', 'intersection',
'invoke', 'invokeMap', 'isEqual', 'isMatch', 'join', 'keyBy', 'lastIndexOf',
'lt', 'lte', 'map', 'mapKeys', 'mapValues', 'matchesProperty', 'maxBy',
'merge', 'minBy', 'omit', 'omitBy', 'orderBy', 'overArgs', 'pad', 'padEnd',
'padStart', 'parseInt', 'partition', 'pick', 'pickBy', 'pull', 'pullAll',
'pullAt', 'random', 'range', 'rangeRight', 'rearg', 'reject', 'remove',
'repeat', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex',
'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy',
'split', 'startsWith', 'subtract', 'sumBy', 'take', 'takeRight', 'takeRightWhile',
'takeWhile', 'tap', 'throttle', 'thru', 'times', 'truncate', 'union', 'uniqBy',
'uniqWith', 'unset', 'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject'
],
3:[
'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith',
'getOr', 'inRange', 'intersectionBy', 'intersectionWith', 'isEqualWith',
'isMatchWith', 'mergeWith', 'pullAllBy', 'reduce', 'reduceRight', 'replace',
'set', 'slice', 'sortedIndexBy', 'sortedLastIndexBy', 'transform', 'unionBy',
'unionWith', 'xorBy', 'xorWith', 'zipWith'
],
4:[
'fill', 'setWith'
]
},
/** Used to map ary to rearg configs by method ary. */
'aryReargMap': {
/** Used to map ary to rearg configs. */
'aryRearg': {
2: [1, 0],
3: [2, 1, 0],
4: [3, 2, 0, 1]
},
/** Used to map ary to rearg configs by method names. */
'methodReargMap': {
/** Used to map method names to iteratee rearg configs. */
'iterateeRearg': {
'findKey': [1],
'findLastKey': [1],
'mapKeys': [1]
},
/** Used to map method names to rearg configs. */
'methodRearg': {
'clamp': [2, 0, 1],
'reduce': [2, 0, 1],
'reduceRight': [2, 0, 1],
'setWith': [3, 2, 1, 0],
'set': [2, 0, 1],
'setWith': [3, 1, 2, 0],
'slice': [2, 0, 1],
'transform': [2, 0, 1]
},
/** Used to iterate `mapping.aryMethodMap` keys. */
/** Used to iterate `mapping.aryMethod` keys. */
'caps': [1, 2, 3, 4],
/** Used to map keys to other keys. */
'keyMap': {
'key': {
'curryN': 'curry',
'curryRightN': 'curryRight',
'getOr': 'get'
},
/** Used to identify methods which mutate arrays or objects. */
'mutateMap': {
'mutate': {
'array': {
'fill': true,
'pull': true,
@@ -429,11 +466,11 @@ return /******/ (function(modules) { // webpackBootstrap
},
'object': {
'assign': true,
'assignIn': true,
'assignInWith': true,
'assignWith': true,
'defaults': true,
'defaultsDeep': true,
'extend': true,
'extendWith': true,
'merge': true,
'mergeWith': true
},
@@ -443,10 +480,26 @@ return /******/ (function(modules) { // webpackBootstrap
}
},
/** Used to track methods with placeholder support */
'placeholder': {
'bind': true,
'bindKey': true,
'curry': true,
'curryRight': true,
'partial': true,
'partialRight': true
},
/** Used to track methods that skip `_.rearg`. */
'skipReargMap': {
'skipRearg': {
'assign': true,
'assignIn': true,
'concat': true,
'defaults': true,
'defaultsDeep': true,
'difference': true,
'matchesProperty': true,
'merge': true,
'random': true,
'range': true,
'rangeRight': true,