Make fp tests browser runnable.

This commit is contained in:
John-David Dalton
2015-12-05 23:36:02 -08:00
parent 769f78a2b7
commit 42c077de02
7 changed files with 1020 additions and 654 deletions

92
dist/lodash.fp.js vendored
View File

@@ -86,14 +86,14 @@ return /******/ (function(modules) { // webpackBootstrap
* @returns {Function|Object} Returns the converted function or object.
*/
function baseConvert(util, name, func) {
if (!func) {
if (typeof func != 'function') {
func = name;
name = null;
name = undefined;
}
if (func == null) {
throw new TypeError;
}
var isLib = name == null && typeof func.VERSION == 'string';
var isLib = name === undefined && typeof func.VERSION == 'string';
var _ = isLib ? func : {
'ary': util.ary,
@@ -264,19 +264,26 @@ return /******/ (function(modules) { // webpackBootstrap
// Iterate over methods for the current ary cap.
var pairs = [];
each(mapping.caps, function(cap) {
each(mapping.aryMethodMap[cap], function(name) {
var func = _[mapping.keyMap[name] || name];
each(mapping.aryMethodMap[cap], function(key) {
var func = _[mapping.keyMap[key] || key];
if (func) {
// Wrap the lodash method and its aliases.
var wrapped = wrap(name, func);
pairs.push([name, wrapped]);
each(mapping.aliasMap[name] || [], function(alias) { pairs.push([alias, wrapped]); });
pairs.push([key, wrap(key, func)]);
}
});
});
// Assign to `_` leaving `_.prototype` unchanged to allow chaining.
each(pairs, function(pair) { _[pair[0]] = pair[1]; });
each(pairs, function(pair) {
_[pair[0]] = pair[1];
});
// Wrap the lodash method and its aliases.
each(keys(_), function(key) {
each(mapping.aliasMap[key] || [], function(alias) {
_[alias] = _[key];
});
});
return _;
}
@@ -291,9 +298,33 @@ return /******/ (function(modules) { // webpackBootstrap
/** Used to map method names to their aliases. */
'aliasMap': {
'ary': ['nAry'],
'conj': ['allPass'],
'disj': ['somePass'],
'filter': ['whereEq'],
'flatten': ['unnest'],
'flow': ['pipe'],
'flowRight': ['compose'],
'forEach': ['each'],
'forEachRight': ['eachRight'],
'head': ['first']
'get': ['path'],
'getOr': ['pathOr'],
'head': ['first'],
'includes': ['contains'],
'initial': ['init'],
'isEqual': ['equals'],
'mapValues': ['mapObj'],
'matchesProperty': ['pathEq'],
'modArgs': ['useWith'],
'modArgsSet': ['converge'],
'omit': ['dissoc', 'omitAll'],
'pick': ['pickAll'],
'property': ['prop'],
'propertyOf': ['propOf'],
'rest': ['unapply'],
'some': ['all'],
'spread': ['apply'],
'zipObject': ['zipObj']
},
/** Used to map method names to their iteratee ary. */
@@ -312,6 +343,7 @@ return /******/ (function(modules) { // webpackBootstrap
'findLast': 1,
'findLastIndex': 1,
'findLastKey': 1,
'flatMap': 1,
'forEach': 1,
'forEachRight': 1,
'forIn': 1,
@@ -338,24 +370,26 @@ return /******/ (function(modules) { // webpackBootstrap
/** Used to map ary to method names. */
'aryMethodMap': {
1: (
'attempt,ceil,create,curry,floor,iteratee,invert,memoize,method,methodOf,' +
'mixin,rest,reverse,round,runInContext,template,trim,trimLeft,trimRight,' +
'words,zipObject').split(','),
'attempt,ceil,create,curry,floor,fromPairs,iteratee,invert,over,overEvery,' +
'overSome,memoize,method,methodOf,mixin,rest,reverse,round,runInContext,template,' +
'trim,trimLeft,trimRight,uniqueId,words').split(','),
2: (
'ary,assign,at,bind,bindKey,cloneDeepWith,cloneWith,countBy,curryN,debounce,' +
'defaults,defaultsDeep,delay,difference,drop,dropRight,dropRightWhile,' +
'add,ary,assign,at,bind,bindKey,cloneDeepWith,cloneWith,concat,countBy,curryN,' +
'debounce,defaults,defaultsDeep,delay,difference,drop,dropRight,dropRightWhile,' +
'dropWhile,endsWith,every,extend,filter,find,find,findIndex,findKey,findLast,' +
'findLastIndex,findLastKey,forEach,forEachRight,forIn,forInRight,forOwn,' +
'forOwnRight,get,groupBy,includes,indexBy,indexOf,intersection,invoke,' +
'isMatch,lastIndexOf,map,mapKeys,mapValues,maxBy,minBy,merge,omit,pad,padLeft,' +
'padRight,parseInt,partition,pick,pull,pullAll,pullAt,random,range,rearg,reject,' +
'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,modArgs,modArgsSet,omit,pad,padLeft,padRight,parseInt,' +
'partition,pick,pull,pullAll,pullAt,random,range,rangeRight,rearg,reject,' +
'remove,repeat,result,sampleSize,set,some,sortBy,sortByOrder,sortedIndexBy,' +
'sortedLastIndexBy,sortedUniqBy,startsWith,sumBy,take,takeRight,takeRightWhile,' +
'takeWhile,throttle,times,trunc,union,uniqBy,uniqueId,without,wrap,xor,zip').split(','),
'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,inRange,intersectionBy,isEqualWith,' +
'isMatchWith,mergeWith,omitBy,pickBy,pullAllBy,reduce,reduceRight,slice,' +
'transform,unionBy,xorBy,zipWith').split(','),
'assignWith,clamp,differenceBy,extendWith,getOr,inRange,intersectionBy,' +
'isEqualWith,isMatchWith,mergeWith,omitBy,pickBy,pullAllBy,reduce,' +
'reduceRight,slice,transform,unionBy,xorBy,zipWith').split(','),
4:
['fill']
},
@@ -377,14 +411,13 @@ return /******/ (function(modules) { // webpackBootstrap
},
/** Used to iterate `mapping.aryMethodMap` keys. */
'caps': ['1', '2', '3', '4'],
'caps': [1, 2, 3, 4],
/** Used to map keys to other keys. */
'keyMap': {
'curryN': 'curry',
'curryRightN': 'curryRight',
'debounceOpt': 'debounce',
'throttleOpt': 'throttle'
'getOr': 'get'
},
/** Used to identify methods which mutate arrays or objects. */
@@ -413,8 +446,11 @@ return /******/ (function(modules) { // webpackBootstrap
/** Used to track methods that skip `_.rearg`. */
'skipReargMap': {
'difference': true,
'matchesProperty': true,
'random': true,
'range': true,
'rangeRight': true,
'zip': true,
'zipObject': true
}
};