mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Rebuild lodash and docs.
This commit is contained in:
75
dist/lodash.fp.js
vendored
75
dist/lodash.fp.js
vendored
@@ -60,10 +60,11 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
* Converts `lodash` to an immutable auto-curried iteratee-first data-last version.
|
||||
*
|
||||
* @param {Function} lodash The lodash function.
|
||||
* @param {Object} [options] The options object. See `baseConvert` for more details.
|
||||
* @returns {Function} Returns the converted `lodash`.
|
||||
*/
|
||||
function browserConvert(lodash) {
|
||||
return baseConvert(lodash, lodash);
|
||||
function browserConvert(lodash, options) {
|
||||
return baseConvert(lodash, lodash, undefined, options);
|
||||
}
|
||||
|
||||
module.exports = browserConvert;
|
||||
@@ -84,9 +85,17 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
* @param {Object} util The util object.
|
||||
* @param {string} name The name of the function to wrap.
|
||||
* @param {Function} func The function to wrap.
|
||||
* @param {Object} [options] The options object.
|
||||
* @param {boolean} [options.cap=true] Specify capping iteratee arguments.
|
||||
* @param {boolean} [options.curry=true] Specify currying.
|
||||
* @param {boolean} [options.fixed=true] Specify fixed arity.
|
||||
* @param {boolean} [options.immutable=true] Specify immutable operations.
|
||||
* @param {boolean} [options.rearg=true] Specify rearranging arguments.
|
||||
* @returns {Function|Object} Returns the converted function or object.
|
||||
*/
|
||||
function baseConvert(util, name, func) {
|
||||
function baseConvert(util, name, func, options) {
|
||||
options || (options = {});
|
||||
|
||||
if (typeof func != 'function') {
|
||||
func = name;
|
||||
name = undefined;
|
||||
@@ -94,6 +103,16 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
if (func == null) {
|
||||
throw new TypeError;
|
||||
}
|
||||
var config = {
|
||||
'cap': 'cap' in options ? options.cap : true,
|
||||
'curry': 'curry' in options ? options.curry : true,
|
||||
'fixed': 'fixed' in options ? options.fixed : true,
|
||||
'immutable': 'immutable' in options ? options.immutable : true,
|
||||
'rearg': 'rearg' in options ? options.rearg : true
|
||||
};
|
||||
|
||||
var forceRearg = ('rearg' in options) && options.rearg;
|
||||
|
||||
var isLib = name === undefined && typeof func.VERSION == 'string';
|
||||
|
||||
var _ = isLib ? func : {
|
||||
@@ -182,6 +201,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
var func = arguments[0],
|
||||
arity = arguments[1];
|
||||
|
||||
if (!config.cap) {
|
||||
return iteratee(func, arity);
|
||||
}
|
||||
arity = arity > 2 ? (arity - 2) : 1;
|
||||
func = iteratee(func);
|
||||
var length = func.length;
|
||||
@@ -220,7 +242,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
},
|
||||
'runInContext': function(runInContext) {
|
||||
return function(context) {
|
||||
return baseConvert(util, runInContext(context));
|
||||
return baseConvert(util, runInContext(context), undefined, options);
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -232,14 +254,16 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
return wrapper(func);
|
||||
}
|
||||
var wrapped = func;
|
||||
if (mutateMap.array[name]) {
|
||||
wrapped = immutWrap(func, cloneArray);
|
||||
}
|
||||
else if (mutateMap.object[name]) {
|
||||
wrapped = immutWrap(func, createCloner(func));
|
||||
}
|
||||
else if (mutateMap.set[name]) {
|
||||
wrapped = immutWrap(func, cloneDeep);
|
||||
if (config.immutable) {
|
||||
if (mutateMap.array[name]) {
|
||||
wrapped = immutWrap(func, cloneArray);
|
||||
}
|
||||
else if (mutateMap.object[name]) {
|
||||
wrapped = immutWrap(func, createCloner(func));
|
||||
}
|
||||
else if (mutateMap.set[name]) {
|
||||
wrapped = immutWrap(func, cloneDeep);
|
||||
}
|
||||
}
|
||||
var result;
|
||||
each(mapping.caps, function(cap) {
|
||||
@@ -249,19 +273,22 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
reargIndexes = mapping.iterateeRearg[name],
|
||||
spreadStart = mapping.methodSpread[name];
|
||||
|
||||
result = spreadStart === undefined
|
||||
? ary(wrapped, cap)
|
||||
: spread(wrapped, spreadStart);
|
||||
|
||||
if (cap > 1 && !mapping.skipRearg[name]) {
|
||||
if (config.fixed) {
|
||||
result = spreadStart === undefined
|
||||
? ary(wrapped, cap)
|
||||
: spread(wrapped, spreadStart);
|
||||
}
|
||||
if (config.rearg && cap > 1 && (forceRearg || !mapping.skipRearg[name])) {
|
||||
result = rearg(result, mapping.methodRearg[name] || mapping.aryRearg[cap]);
|
||||
}
|
||||
if (reargIndexes) {
|
||||
result = iterateeRearg(result, reargIndexes);
|
||||
} else if (aryN) {
|
||||
result = iterateeAry(result, aryN);
|
||||
if (config.cap) {
|
||||
if (reargIndexes) {
|
||||
result = iterateeRearg(result, reargIndexes);
|
||||
} else if (aryN) {
|
||||
result = iterateeAry(result, aryN);
|
||||
}
|
||||
}
|
||||
if (cap > 1) {
|
||||
if (config.curry && cap > 1) {
|
||||
result = curry(result, cap);
|
||||
}
|
||||
return false;
|
||||
@@ -544,6 +571,10 @@ return /******/ (function(modules) { // webpackBootstrap
|
||||
'assignIn': true,
|
||||
'concat': true,
|
||||
'difference': true,
|
||||
'gt': true,
|
||||
'gte': true,
|
||||
'lt': true,
|
||||
'lte': true,
|
||||
'matchesProperty': true,
|
||||
'merge': true,
|
||||
'partial': true,
|
||||
|
||||
Reference in New Issue
Block a user