mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Apply arrow function transform.
This commit is contained in:
@@ -32,13 +32,12 @@ function arrayLikeKeys(value, inherited) {
|
|||||||
if ((inherited || hasOwnProperty.call(value, key)) &&
|
if ((inherited || hasOwnProperty.call(value, key)) &&
|
||||||
!(skipIndexes && (
|
!(skipIndexes && (
|
||||||
// Safari 9 has enumerable `arguments.length` in strict mode.
|
// Safari 9 has enumerable `arguments.length` in strict mode.
|
||||||
key == 'length' ||
|
(key == 'length' ||
|
||||||
// Node.js 0.10 has enumerable non-index properties on buffers.
|
// Node.js 0.10 has enumerable non-index properties on buffers.
|
||||||
(isBuff && (key == 'offset' || key == 'parent')) ||
|
(isBuff && (key == 'offset' || key == 'parent')) ||
|
||||||
// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
||||||
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || // Skip index properties.
|
||||||
// Skip index properties.
|
isIndex(key, length))
|
||||||
isIndex(key, length)
|
|
||||||
))) {
|
))) {
|
||||||
result.push(key);
|
result.push(key);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ function baseClone(value, bitmask, customizer, key, object, stack) {
|
|||||||
: (isFlat ? keysIn : keys);
|
: (isFlat ? keysIn : keys);
|
||||||
|
|
||||||
var props = isArr ? undefined : keysFunc(value);
|
var props = isArr ? undefined : keysFunc(value);
|
||||||
arrayEach(props || value, function(subValue, key) {
|
arrayEach(props || value, (subValue, key) => {
|
||||||
if (props) {
|
if (props) {
|
||||||
key = subValue;
|
key = subValue;
|
||||||
subValue = value[key];
|
subValue = value[key];
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import baseForOwn from './_baseForOwn.js';
|
|||||||
* @returns {Function} Returns `accumulator`.
|
* @returns {Function} Returns `accumulator`.
|
||||||
*/
|
*/
|
||||||
function baseInverter(object, setter, iteratee, accumulator) {
|
function baseInverter(object, setter, iteratee, accumulator) {
|
||||||
baseForOwn(object, function(value, key, object) {
|
baseForOwn(object, (value, key, object) => {
|
||||||
setter(accumulator, iteratee(value), key, object);
|
setter(accumulator, iteratee(value), key, object);
|
||||||
});
|
});
|
||||||
return accumulator;
|
return accumulator;
|
||||||
|
|||||||
@@ -14,9 +14,7 @@ function baseMatches(source) {
|
|||||||
if (matchData.length == 1 && matchData[0][2]) {
|
if (matchData.length == 1 && matchData[0][2]) {
|
||||||
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
|
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
|
||||||
}
|
}
|
||||||
return function(object) {
|
return object => object === source || baseIsMatch(object, source, matchData);
|
||||||
return object === source || baseIsMatch(object, source, matchData);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default baseMatches;
|
export default baseMatches;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ function baseMatchesProperty(path, srcValue) {
|
|||||||
if (isKey(path) && isStrictComparable(srcValue)) {
|
if (isKey(path) && isStrictComparable(srcValue)) {
|
||||||
return matchesStrictComparable(toKey(path), srcValue);
|
return matchesStrictComparable(toKey(path), srcValue);
|
||||||
}
|
}
|
||||||
return function(object) {
|
return object => {
|
||||||
var objValue = get(object, path);
|
var objValue = get(object, path);
|
||||||
return (objValue === undefined && objValue === srcValue)
|
return (objValue === undefined && objValue === srcValue)
|
||||||
? hasIn(object, path)
|
? hasIn(object, path)
|
||||||
|
|||||||
@@ -19,16 +19,12 @@ function baseOrderBy(collection, iteratees, orders) {
|
|||||||
var index = -1;
|
var index = -1;
|
||||||
iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(baseIteratee));
|
iteratees = arrayMap(iteratees.length ? iteratees : [identity], baseUnary(baseIteratee));
|
||||||
|
|
||||||
var result = baseMap(collection, function(value, key, collection) {
|
var result = baseMap(collection, (value, key, collection) => {
|
||||||
var criteria = arrayMap(iteratees, function(iteratee) {
|
var criteria = arrayMap(iteratees, iteratee => iteratee(value));
|
||||||
return iteratee(value);
|
|
||||||
});
|
|
||||||
return { 'criteria': criteria, 'index': ++index, 'value': value };
|
return { 'criteria': criteria, 'index': ++index, 'value': value };
|
||||||
});
|
});
|
||||||
|
|
||||||
return baseSortBy(result, function(object, other) {
|
return baseSortBy(result, (object, other) => compareMultiple(object, other, orders));
|
||||||
return compareMultiple(object, other, orders);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default baseOrderBy;
|
export default baseOrderBy;
|
||||||
|
|||||||
@@ -11,9 +11,7 @@ import hasIn from './hasIn.js';
|
|||||||
* @returns {Object} Returns the new object.
|
* @returns {Object} Returns the new object.
|
||||||
*/
|
*/
|
||||||
function basePick(object, paths) {
|
function basePick(object, paths) {
|
||||||
return basePickBy(object, paths, function(value, path) {
|
return basePickBy(object, paths, (value, path) => hasIn(object, path));
|
||||||
return hasIn(object, path);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default basePick;
|
export default basePick;
|
||||||
|
|||||||
@@ -6,9 +6,7 @@
|
|||||||
* @returns {Function} Returns the new accessor function.
|
* @returns {Function} Returns the new accessor function.
|
||||||
*/
|
*/
|
||||||
function baseProperty(key) {
|
function baseProperty(key) {
|
||||||
return function(object) {
|
return object => object == null ? undefined : object[key];
|
||||||
return object == null ? undefined : object[key];
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default baseProperty;
|
export default baseProperty;
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ import baseGet from './_baseGet.js';
|
|||||||
* @returns {Function} Returns the new accessor function.
|
* @returns {Function} Returns the new accessor function.
|
||||||
*/
|
*/
|
||||||
function basePropertyDeep(path) {
|
function basePropertyDeep(path) {
|
||||||
return function(object) {
|
return object => baseGet(object, path);
|
||||||
return baseGet(object, path);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default basePropertyDeep;
|
export default basePropertyDeep;
|
||||||
|
|||||||
@@ -6,9 +6,7 @@
|
|||||||
* @returns {Function} Returns the new accessor function.
|
* @returns {Function} Returns the new accessor function.
|
||||||
*/
|
*/
|
||||||
function basePropertyOf(object) {
|
function basePropertyOf(object) {
|
||||||
return function(key) {
|
return key => object == null ? undefined : object[key];
|
||||||
return object == null ? undefined : object[key];
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default basePropertyOf;
|
export default basePropertyOf;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
* @returns {*} Returns the accumulated value.
|
* @returns {*} Returns the accumulated value.
|
||||||
*/
|
*/
|
||||||
function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
|
function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
|
||||||
eachFunc(collection, function(value, index, collection) {
|
eachFunc(collection, (value, index, collection) => {
|
||||||
accumulator = initAccum
|
accumulator = initAccum
|
||||||
? (initAccum = false, value)
|
? (initAccum = false, value)
|
||||||
: iteratee(accumulator, value, index, collection);
|
: iteratee(accumulator, value, index, collection);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import metaMap from './_metaMap.js';
|
|||||||
* @param {*} data The metadata.
|
* @param {*} data The metadata.
|
||||||
* @returns {Function} Returns `func`.
|
* @returns {Function} Returns `func`.
|
||||||
*/
|
*/
|
||||||
var baseSetData = !metaMap ? identity : function(func, data) {
|
var baseSetData = !metaMap ? identity : (func, data) => {
|
||||||
metaMap.set(func, data);
|
metaMap.set(func, data);
|
||||||
return func;
|
return func;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,13 +10,11 @@ import identity from './identity.js';
|
|||||||
* @param {Function} string The `toString` result.
|
* @param {Function} string The `toString` result.
|
||||||
* @returns {Function} Returns `func`.
|
* @returns {Function} Returns `func`.
|
||||||
*/
|
*/
|
||||||
var baseSetToString = !defineProperty ? identity : function(func, string) {
|
var baseSetToString = !defineProperty ? identity : (func, string) => defineProperty(func, 'toString', {
|
||||||
return defineProperty(func, 'toString', {
|
'configurable': true,
|
||||||
'configurable': true,
|
'enumerable': false,
|
||||||
'enumerable': false,
|
'value': constant(string),
|
||||||
'value': constant(string),
|
'writable': true
|
||||||
'writable': true
|
});
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
export default baseSetToString;
|
export default baseSetToString;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import baseEach from './_baseEach.js';
|
|||||||
function baseSome(collection, predicate) {
|
function baseSome(collection, predicate) {
|
||||||
var result;
|
var result;
|
||||||
|
|
||||||
baseEach(collection, function(value, index, collection) {
|
baseEach(collection, (value, index, collection) => {
|
||||||
result = predicate(value, index, collection);
|
result = predicate(value, index, collection);
|
||||||
return !result;
|
return !result;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -10,9 +10,7 @@ import arrayMap from './_arrayMap.js';
|
|||||||
* @returns {Object} Returns the key-value pairs.
|
* @returns {Object} Returns the key-value pairs.
|
||||||
*/
|
*/
|
||||||
function baseToPairs(object, props) {
|
function baseToPairs(object, props) {
|
||||||
return arrayMap(props, function(key) {
|
return arrayMap(props, key => [key, object[key]]);
|
||||||
return [key, object[key]];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default baseToPairs;
|
export default baseToPairs;
|
||||||
|
|||||||
@@ -6,9 +6,7 @@
|
|||||||
* @returns {Function} Returns the new capped function.
|
* @returns {Function} Returns the new capped function.
|
||||||
*/
|
*/
|
||||||
function baseUnary(func) {
|
function baseUnary(func) {
|
||||||
return function(value) {
|
return value => func(value);
|
||||||
return func(value);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default baseUnary;
|
export default baseUnary;
|
||||||
|
|||||||
@@ -11,9 +11,7 @@ import arrayMap from './_arrayMap.js';
|
|||||||
* @returns {Object} Returns the array of property values.
|
* @returns {Object} Returns the array of property values.
|
||||||
*/
|
*/
|
||||||
function baseValues(object, props) {
|
function baseValues(object, props) {
|
||||||
return arrayMap(props, function(key) {
|
return arrayMap(props, key => object[key]);
|
||||||
return object[key];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default baseValues;
|
export default baseValues;
|
||||||
|
|||||||
@@ -17,9 +17,7 @@ function baseWrapperValue(value, actions) {
|
|||||||
if (result instanceof LazyWrapper) {
|
if (result instanceof LazyWrapper) {
|
||||||
result = result.value();
|
result = result.value();
|
||||||
}
|
}
|
||||||
return arrayReduce(actions, function(result, action) {
|
return arrayReduce(actions, (result, action) => action.func.apply(action.thisArg, arrayPush([result], action.args)), result);
|
||||||
return action.func.apply(action.thisArg, arrayPush([result], action.args));
|
|
||||||
}, result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default baseWrapperValue;
|
export default baseWrapperValue;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import isArray from './isArray.js';
|
|||||||
* @returns {Function} Returns the new aggregator function.
|
* @returns {Function} Returns the new aggregator function.
|
||||||
*/
|
*/
|
||||||
function createAggregator(setter, initializer) {
|
function createAggregator(setter, initializer) {
|
||||||
return function(collection, iteratee) {
|
return (collection, iteratee) => {
|
||||||
var func = isArray(collection) ? arrayAggregator : baseAggregator,
|
var func = isArray(collection) ? arrayAggregator : baseAggregator,
|
||||||
accumulator = initializer ? initializer() : {};
|
accumulator = initializer ? initializer() : {};
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import isIterateeCall from './_isIterateeCall.js';
|
|||||||
* @returns {Function} Returns the new assigner function.
|
* @returns {Function} Returns the new assigner function.
|
||||||
*/
|
*/
|
||||||
function createAssigner(assigner) {
|
function createAssigner(assigner) {
|
||||||
return baseRest(function(object, sources) {
|
return baseRest((object, sources) => {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
length = sources.length,
|
length = sources.length,
|
||||||
customizer = length > 1 ? sources[length - 1] : undefined,
|
customizer = length > 1 ? sources[length - 1] : undefined,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import isArrayLike from './isArrayLike.js';
|
|||||||
* @returns {Function} Returns the new base function.
|
* @returns {Function} Returns the new base function.
|
||||||
*/
|
*/
|
||||||
function createBaseEach(eachFunc, fromRight) {
|
function createBaseEach(eachFunc, fromRight) {
|
||||||
return function(collection, iteratee) {
|
return (collection, iteratee) => {
|
||||||
if (collection == null) {
|
if (collection == null) {
|
||||||
return collection;
|
return collection;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
* @returns {Function} Returns the new base function.
|
* @returns {Function} Returns the new base function.
|
||||||
*/
|
*/
|
||||||
function createBaseFor(fromRight) {
|
function createBaseFor(fromRight) {
|
||||||
return function(object, iteratee, keysFunc) {
|
return (object, iteratee, keysFunc) => {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
iterable = Object(object),
|
iterable = Object(object),
|
||||||
props = keysFunc(object),
|
props = keysFunc(object),
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import toString from './toString.js';
|
|||||||
* @returns {Function} Returns the new case function.
|
* @returns {Function} Returns the new case function.
|
||||||
*/
|
*/
|
||||||
function createCaseFirst(methodName) {
|
function createCaseFirst(methodName) {
|
||||||
return function(string) {
|
return string => {
|
||||||
string = toString(string);
|
string = toString(string);
|
||||||
|
|
||||||
var strSymbols = hasUnicode(string)
|
var strSymbols = hasUnicode(string)
|
||||||
|
|||||||
@@ -16,9 +16,7 @@ var reApos = RegExp(rsApos, 'g');
|
|||||||
* @returns {Function} Returns the new compounder function.
|
* @returns {Function} Returns the new compounder function.
|
||||||
*/
|
*/
|
||||||
function createCompounder(callback) {
|
function createCompounder(callback) {
|
||||||
return function(string) {
|
return string => arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
|
||||||
return arrayReduce(words(deburr(string).replace(reApos, '')), callback, '');
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default createCompounder;
|
export default createCompounder;
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ import keys from './keys.js';
|
|||||||
* @returns {Function} Returns the new find function.
|
* @returns {Function} Returns the new find function.
|
||||||
*/
|
*/
|
||||||
function createFind(findIndexFunc) {
|
function createFind(findIndexFunc) {
|
||||||
return function(collection, predicate, fromIndex) {
|
return (collection, predicate, fromIndex) => {
|
||||||
var iterable = Object(collection);
|
var iterable = Object(collection);
|
||||||
if (!isArrayLike(collection)) {
|
if (!isArrayLike(collection)) {
|
||||||
var iteratee = baseIteratee(predicate, 3);
|
var iteratee = baseIteratee(predicate, 3);
|
||||||
collection = keys(collection);
|
collection = keys(collection);
|
||||||
predicate = function(key) { return iteratee(iterable[key], key, iterable); };
|
predicate = key => iteratee(iterable[key], key, iterable);
|
||||||
}
|
}
|
||||||
var index = findIndexFunc(collection, predicate, fromIndex);
|
var index = findIndexFunc(collection, predicate, fromIndex);
|
||||||
return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
|
return index > -1 ? iterable[iteratee ? collection[index] : index] : undefined;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ var WRAP_CURRY_FLAG = 8,
|
|||||||
* @returns {Function} Returns the new flow function.
|
* @returns {Function} Returns the new flow function.
|
||||||
*/
|
*/
|
||||||
function createFlow(fromRight) {
|
function createFlow(fromRight) {
|
||||||
return flatRest(function(funcs) {
|
return flatRest(funcs => {
|
||||||
var length = funcs.length,
|
var length = funcs.length,
|
||||||
index = length,
|
index = length,
|
||||||
prereq = LodashWrapper.prototype.thru;
|
prereq = LodashWrapper.prototype.thru;
|
||||||
|
|||||||
@@ -9,9 +9,7 @@ import baseInverter from './_baseInverter.js';
|
|||||||
* @returns {Function} Returns the new inverter function.
|
* @returns {Function} Returns the new inverter function.
|
||||||
*/
|
*/
|
||||||
function createInverter(setter, toIteratee) {
|
function createInverter(setter, toIteratee) {
|
||||||
return function(object, iteratee) {
|
return (object, iteratee) => baseInverter(object, setter, toIteratee(iteratee), {});
|
||||||
return baseInverter(object, setter, toIteratee(iteratee), {});
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default createInverter;
|
export default createInverter;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import baseToString from './_baseToString.js';
|
|||||||
* @returns {Function} Returns the new mathematical operation function.
|
* @returns {Function} Returns the new mathematical operation function.
|
||||||
*/
|
*/
|
||||||
function createMathOperation(operator, defaultValue) {
|
function createMathOperation(operator, defaultValue) {
|
||||||
return function(value, other) {
|
return (value, other) => {
|
||||||
var result;
|
var result;
|
||||||
if (value === undefined && other === undefined) {
|
if (value === undefined && other === undefined) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
|||||||
@@ -13,13 +13,11 @@ import flatRest from './_flatRest.js';
|
|||||||
* @returns {Function} Returns the new over function.
|
* @returns {Function} Returns the new over function.
|
||||||
*/
|
*/
|
||||||
function createOver(arrayFunc) {
|
function createOver(arrayFunc) {
|
||||||
return flatRest(function(iteratees) {
|
return flatRest(iteratees => {
|
||||||
iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
|
iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
|
||||||
return baseRest(function(args) {
|
return baseRest(function(args) {
|
||||||
var thisArg = this;
|
var thisArg = this;
|
||||||
return arrayFunc(iteratees, function(iteratee) {
|
return arrayFunc(iteratees, iteratee => apply(iteratee, thisArg, args));
|
||||||
return apply(iteratee, thisArg, args);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import toFinite from './toFinite.js';
|
|||||||
* @returns {Function} Returns the new range function.
|
* @returns {Function} Returns the new range function.
|
||||||
*/
|
*/
|
||||||
function createRange(fromRight) {
|
function createRange(fromRight) {
|
||||||
return function(start, end, step) {
|
return (start, end, step) => {
|
||||||
if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
|
if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
|
||||||
end = step = undefined;
|
end = step = undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import toNumber from './toNumber.js';
|
|||||||
* @returns {Function} Returns the new relational operation function.
|
* @returns {Function} Returns the new relational operation function.
|
||||||
*/
|
*/
|
||||||
function createRelationalOperation(operator) {
|
function createRelationalOperation(operator) {
|
||||||
return function(value, other) {
|
return (value, other) => {
|
||||||
if (!(typeof value == 'string' && typeof other == 'string')) {
|
if (!(typeof value == 'string' && typeof other == 'string')) {
|
||||||
value = toNumber(value);
|
value = toNumber(value);
|
||||||
other = toNumber(other);
|
other = toNumber(other);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ var nativeMin = Math.min;
|
|||||||
*/
|
*/
|
||||||
function createRound(methodName) {
|
function createRound(methodName) {
|
||||||
var func = Math[methodName];
|
var func = Math[methodName];
|
||||||
return function(number, precision) {
|
return (number, precision) => {
|
||||||
number = toNumber(number);
|
number = toNumber(number);
|
||||||
precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
|
precision = precision == null ? 0 : nativeMin(toInteger(precision), 292);
|
||||||
if (precision) {
|
if (precision) {
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ var INFINITY = 1 / 0;
|
|||||||
* @param {Array} values The values to add to the set.
|
* @param {Array} values The values to add to the set.
|
||||||
* @returns {Object} Returns the new set.
|
* @returns {Object} Returns the new set.
|
||||||
*/
|
*/
|
||||||
var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : function(values) {
|
var createSet = !(Set && (1 / setToArray(new Set([,-0]))[1]) == INFINITY) ? noop : values => new Set(values);
|
||||||
return new Set(values);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default createSet;
|
export default createSet;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ var mapTag = '[object Map]',
|
|||||||
* @returns {Function} Returns the new pairs function.
|
* @returns {Function} Returns the new pairs function.
|
||||||
*/
|
*/
|
||||||
function createToPairs(keysFunc) {
|
function createToPairs(keysFunc) {
|
||||||
return function(object) {
|
return object => {
|
||||||
var tag = getTag(object);
|
var tag = getTag(object);
|
||||||
if (tag == mapTag) {
|
if (tag == mapTag) {
|
||||||
return mapToArray(object);
|
return mapToArray(object);
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import getNative from './_getNative.js';
|
import getNative from './_getNative.js';
|
||||||
|
|
||||||
var defineProperty = (function() {
|
var defineProperty = ((() => {
|
||||||
try {
|
try {
|
||||||
var func = getNative(Object, 'defineProperty');
|
var func = getNative(Object, 'defineProperty');
|
||||||
func({}, '', {});
|
func({}, '', {});
|
||||||
return func;
|
return func;
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}());
|
})());
|
||||||
|
|
||||||
export default defineProperty;
|
export default defineProperty;
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|||||||
}
|
}
|
||||||
// Recursively compare arrays (susceptible to call stack limits).
|
// Recursively compare arrays (susceptible to call stack limits).
|
||||||
if (seen) {
|
if (seen) {
|
||||||
if (!arraySome(other, function(othValue, othIndex) {
|
if (!arraySome(other, (othValue, othIndex) => {
|
||||||
if (!cacheHas(seen, othIndex) &&
|
if (!cacheHas(seen, othIndex) &&
|
||||||
(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
||||||
return seen.push(othIndex);
|
return seen.push(othIndex);
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import noop from './noop.js';
|
|||||||
* @param {Function} func The function to query.
|
* @param {Function} func The function to query.
|
||||||
* @returns {*} Returns the metadata for `func`.
|
* @returns {*} Returns the metadata for `func`.
|
||||||
*/
|
*/
|
||||||
var getData = !metaMap ? noop : function(func) {
|
var getData = !metaMap ? noop : func => metaMap.get(func);
|
||||||
return metaMap.get(func);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default getData;
|
export default getData;
|
||||||
|
|||||||
@@ -17,14 +17,12 @@ var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|||||||
* @param {Object} object The object to query.
|
* @param {Object} object The object to query.
|
||||||
* @returns {Array} Returns the array of symbols.
|
* @returns {Array} Returns the array of symbols.
|
||||||
*/
|
*/
|
||||||
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
var getSymbols = !nativeGetSymbols ? stubArray : object => {
|
||||||
if (object == null) {
|
if (object == null) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
object = Object(object);
|
object = Object(object);
|
||||||
return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
return arrayFilter(nativeGetSymbols(object), symbol => propertyIsEnumerable.call(object, symbol));
|
||||||
return propertyIsEnumerable.call(object, symbol);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default getSymbols;
|
export default getSymbols;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|||||||
* @param {Object} object The object to query.
|
* @param {Object} object The object to query.
|
||||||
* @returns {Array} Returns the array of symbols.
|
* @returns {Array} Returns the array of symbols.
|
||||||
*/
|
*/
|
||||||
var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
|
var getSymbolsIn = !nativeGetSymbols ? stubArray : object => {
|
||||||
var result = [];
|
var result = [];
|
||||||
while (object) {
|
while (object) {
|
||||||
arrayPush(result, getSymbols(object));
|
arrayPush(result, getSymbols(object));
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
|||||||
(Promise && getTag(Promise.resolve()) != promiseTag) ||
|
(Promise && getTag(Promise.resolve()) != promiseTag) ||
|
||||||
(Set && getTag(new Set) != setTag) ||
|
(Set && getTag(new Set) != setTag) ||
|
||||||
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
||||||
getTag = function(value) {
|
getTag = value => {
|
||||||
var result = baseGetTag(value),
|
var result = baseGetTag(value),
|
||||||
Ctor = result == objectTag ? value.constructor : undefined,
|
Ctor = result == objectTag ? value.constructor : undefined,
|
||||||
ctorString = Ctor ? toSource(Ctor) : '';
|
ctorString = Ctor ? toSource(Ctor) : '';
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import coreJsData from './_coreJsData.js';
|
import coreJsData from './_coreJsData.js';
|
||||||
|
|
||||||
/** Used to detect methods masquerading as native. */
|
/** Used to detect methods masquerading as native. */
|
||||||
var maskSrcKey = (function() {
|
var maskSrcKey = ((() => {
|
||||||
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
||||||
return uid ? ('Symbol(src)_1.' + uid) : '';
|
return uid ? ('Symbol(src)_1.' + uid) : '';
|
||||||
}());
|
})());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if `func` has its source masked.
|
* Checks if `func` has its source masked.
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ function mapToArray(map) {
|
|||||||
var index = -1,
|
var index = -1,
|
||||||
result = Array(map.size);
|
result = Array(map.size);
|
||||||
|
|
||||||
map.forEach(function(value, key) {
|
map.forEach((value, key) => {
|
||||||
result[++index] = [key, value];
|
result[++index] = [key, value];
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
* @returns {Function} Returns the new spec function.
|
* @returns {Function} Returns the new spec function.
|
||||||
*/
|
*/
|
||||||
function matchesStrictComparable(key, srcValue) {
|
function matchesStrictComparable(key, srcValue) {
|
||||||
return function(object) {
|
return object => {
|
||||||
if (object == null) {
|
if (object == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ var MAX_MEMOIZE_SIZE = 500;
|
|||||||
* @returns {Function} Returns the new memoized function.
|
* @returns {Function} Returns the new memoized function.
|
||||||
*/
|
*/
|
||||||
function memoizeCapped(func) {
|
function memoizeCapped(func) {
|
||||||
var result = memoize(func, function(key) {
|
var result = memoize(func, key => {
|
||||||
if (cache.size === MAX_MEMOIZE_SIZE) {
|
if (cache.size === MAX_MEMOIZE_SIZE) {
|
||||||
cache.clear();
|
cache.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ var moduleExports = freeModule && freeModule.exports === freeExports;
|
|||||||
var freeProcess = moduleExports && freeGlobal.process;
|
var freeProcess = moduleExports && freeGlobal.process;
|
||||||
|
|
||||||
/** Used to access faster Node.js helpers. */
|
/** Used to access faster Node.js helpers. */
|
||||||
var nodeUtil = (function() {
|
var nodeUtil = ((() => {
|
||||||
try {
|
try {
|
||||||
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
}());
|
})());
|
||||||
|
|
||||||
export default nodeUtil;
|
export default nodeUtil;
|
||||||
|
|||||||
@@ -7,9 +7,7 @@
|
|||||||
* @returns {Function} Returns the new function.
|
* @returns {Function} Returns the new function.
|
||||||
*/
|
*/
|
||||||
function overArg(func, transform) {
|
function overArg(func, transform) {
|
||||||
return function(arg) {
|
return arg => func(transform(arg));
|
||||||
return func(transform(arg));
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default overArg;
|
export default overArg;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ function setToArray(set) {
|
|||||||
var index = -1,
|
var index = -1,
|
||||||
result = Array(set.size);
|
result = Array(set.size);
|
||||||
|
|
||||||
set.forEach(function(value) {
|
set.forEach(value => {
|
||||||
result[++index] = value;
|
result[++index] = value;
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ var reEscapeChar = /\\(\\)?/g;
|
|||||||
* @param {string} string The string to convert.
|
* @param {string} string The string to convert.
|
||||||
* @returns {Array} Returns the property path array.
|
* @returns {Array} Returns the property path array.
|
||||||
*/
|
*/
|
||||||
var stringToPath = memoizeCapped(function(string) {
|
var stringToPath = memoizeCapped(string => {
|
||||||
var result = [];
|
var result = [];
|
||||||
if (reLeadingDot.test(string)) {
|
if (reLeadingDot.test(string)) {
|
||||||
result.push('');
|
result.push('');
|
||||||
}
|
}
|
||||||
string.replace(rePropName, function(match, number, quote, string) {
|
string.replace(rePropName, (match, number, quote, string) => {
|
||||||
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
|
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ var wrapFlags = [
|
|||||||
* @returns {Array} Returns `details`.
|
* @returns {Array} Returns `details`.
|
||||||
*/
|
*/
|
||||||
function updateWrapDetails(details, bitmask) {
|
function updateWrapDetails(details, bitmask) {
|
||||||
arrayEach(wrapFlags, function(pair) {
|
arrayEach(wrapFlags, pair => {
|
||||||
var value = '_.' + pair[0];
|
var value = '_.' + pair[0];
|
||||||
if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
|
if ((bitmask & pair[1]) && !arrayIncludes(details, value)) {
|
||||||
details.push(value);
|
details.push(value);
|
||||||
|
|||||||
4
add.js
4
add.js
@@ -15,8 +15,6 @@ import createMathOperation from './_createMathOperation.js';
|
|||||||
* _.add(6, 4);
|
* _.add(6, 4);
|
||||||
* // => 10
|
* // => 10
|
||||||
*/
|
*/
|
||||||
var add = createMathOperation(function(augend, addend) {
|
var add = createMathOperation((augend, addend) => augend + addend, 0);
|
||||||
return augend + addend;
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
export default add;
|
export default add;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ import keysIn from './keysIn.js';
|
|||||||
* _.assignIn({ 'a': 0 }, new Foo, new Bar);
|
* _.assignIn({ 'a': 0 }, new Foo, new Bar);
|
||||||
* // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
|
* // => { 'a': 1, 'b': 2, 'c': 3, 'd': 4 }
|
||||||
*/
|
*/
|
||||||
var assignIn = createAssigner(function(object, source) {
|
var assignIn = createAssigner((object, source) => {
|
||||||
copyObject(source, keysIn(source), object);
|
copyObject(source, keysIn(source), object);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import keysIn from './keysIn.js';
|
|||||||
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
||||||
* // => { 'a': 1, 'b': 2 }
|
* // => { 'a': 1, 'b': 2 }
|
||||||
*/
|
*/
|
||||||
var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
|
var assignInWith = createAssigner((object, source, srcIndex, customizer) => {
|
||||||
copyObject(source, keysIn(source), object, customizer);
|
copyObject(source, keysIn(source), object, customizer);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import keys from './keys.js';
|
|||||||
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
* defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
||||||
* // => { 'a': 1, 'b': 2 }
|
* // => { 'a': 1, 'b': 2 }
|
||||||
*/
|
*/
|
||||||
var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
|
var assignWith = createAssigner((object, source, srcIndex, customizer) => {
|
||||||
copyObject(source, keys(source), object, customizer);
|
copyObject(source, keys(source), object, customizer);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import isError from './isError.js';
|
|||||||
* elements = [];
|
* elements = [];
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
var attempt = baseRest(function(func, args) {
|
var attempt = baseRest((func, args) => {
|
||||||
try {
|
try {
|
||||||
return apply(func, undefined, args);
|
return apply(func, undefined, args);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
2
bind.js
2
bind.js
@@ -42,7 +42,7 @@ var WRAP_BIND_FLAG = 1,
|
|||||||
* bound('hi');
|
* bound('hi');
|
||||||
* // => 'hi fred!'
|
* // => 'hi fred!'
|
||||||
*/
|
*/
|
||||||
var bind = baseRest(function(func, thisArg, partials) {
|
var bind = baseRest((func, thisArg, partials) => {
|
||||||
var bitmask = WRAP_BIND_FLAG;
|
var bitmask = WRAP_BIND_FLAG;
|
||||||
if (partials.length) {
|
if (partials.length) {
|
||||||
var holders = replaceHolders(partials, getHolder(bind));
|
var holders = replaceHolders(partials, getHolder(bind));
|
||||||
|
|||||||
@@ -30,8 +30,8 @@ import toKey from './_toKey.js';
|
|||||||
* jQuery(element).on('click', view.click);
|
* jQuery(element).on('click', view.click);
|
||||||
* // => Logs 'clicked docs' when clicked.
|
* // => Logs 'clicked docs' when clicked.
|
||||||
*/
|
*/
|
||||||
var bindAll = flatRest(function(object, methodNames) {
|
var bindAll = flatRest((object, methodNames) => {
|
||||||
arrayEach(methodNames, function(key) {
|
arrayEach(methodNames, key => {
|
||||||
key = toKey(key);
|
key = toKey(key);
|
||||||
baseAssignValue(object, key, bind(object[key], object));
|
baseAssignValue(object, key, bind(object[key], object));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ var WRAP_BIND_FLAG = 1,
|
|||||||
* bound('hi');
|
* bound('hi');
|
||||||
* // => 'hiya fred!'
|
* // => 'hiya fred!'
|
||||||
*/
|
*/
|
||||||
var bindKey = baseRest(function(object, key, partials) {
|
var bindKey = baseRest((object, key, partials) => {
|
||||||
var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
|
var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG;
|
||||||
if (partials.length) {
|
if (partials.length) {
|
||||||
var holders = replaceHolders(partials, getHolder(bindKey));
|
var holders = replaceHolders(partials, getHolder(bindKey));
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import createCompounder from './_createCompounder.js';
|
|||||||
* _.camelCase('__FOO_BAR__');
|
* _.camelCase('__FOO_BAR__');
|
||||||
* // => 'fooBar'
|
* // => 'fooBar'
|
||||||
*/
|
*/
|
||||||
var camelCase = createCompounder(function(result, word, index) {
|
var camelCase = createCompounder((result, word, index) => {
|
||||||
word = word.toLowerCase();
|
word = word.toLowerCase();
|
||||||
return result + (index ? capitalize(word) : word);
|
return result + (index ? capitalize(word) : word);
|
||||||
});
|
});
|
||||||
|
|||||||
2
cond.js
2
cond.js
@@ -39,7 +39,7 @@ function cond(pairs) {
|
|||||||
var length = pairs == null ? 0 : pairs.length,
|
var length = pairs == null ? 0 : pairs.length,
|
||||||
toIteratee = baseIteratee;
|
toIteratee = baseIteratee;
|
||||||
|
|
||||||
pairs = !length ? [] : arrayMap(pairs, function(pair) {
|
pairs = !length ? [] : arrayMap(pairs, pair => {
|
||||||
if (typeof pair[1] != 'function') {
|
if (typeof pair[1] != 'function') {
|
||||||
throw new TypeError(FUNC_ERROR_TEXT);
|
throw new TypeError(FUNC_ERROR_TEXT);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,7 @@
|
|||||||
* // => true
|
* // => true
|
||||||
*/
|
*/
|
||||||
function constant(value) {
|
function constant(value) {
|
||||||
return function() {
|
return () => value;
|
||||||
return value;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default constant;
|
export default constant;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
|||||||
* _.countBy(['one', 'two', 'three'], 'length');
|
* _.countBy(['one', 'two', 'three'], 'length');
|
||||||
* // => { '3': 2, '5': 1 }
|
* // => { '3': 2, '5': 1 }
|
||||||
*/
|
*/
|
||||||
var countBy = createAggregator(function(result, value, key) {
|
var countBy = createAggregator((result, value, key) => {
|
||||||
if (hasOwnProperty.call(result, key)) {
|
if (hasOwnProperty.call(result, key)) {
|
||||||
++result[key];
|
++result[key];
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import customDefaultsAssignIn from './_customDefaultsAssignIn.js';
|
|||||||
* _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
* _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });
|
||||||
* // => { 'a': 1, 'b': 2 }
|
* // => { 'a': 1, 'b': 2 }
|
||||||
*/
|
*/
|
||||||
var defaults = baseRest(function(args) {
|
var defaults = baseRest(args => {
|
||||||
args.push(undefined, customDefaultsAssignIn);
|
args.push(undefined, customDefaultsAssignIn);
|
||||||
return apply(assignInWith, undefined, args);
|
return apply(assignInWith, undefined, args);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import mergeWith from './mergeWith.js';
|
|||||||
* _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
|
* _.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } });
|
||||||
* // => { 'a': { 'b': 2, 'c': 3 } }
|
* // => { 'a': { 'b': 2, 'c': 3 } }
|
||||||
*/
|
*/
|
||||||
var defaultsDeep = baseRest(function(args) {
|
var defaultsDeep = baseRest(args => {
|
||||||
args.push(undefined, customDefaultsMerge);
|
args.push(undefined, customDefaultsMerge);
|
||||||
return apply(mergeWith, undefined, args);
|
return apply(mergeWith, undefined, args);
|
||||||
});
|
});
|
||||||
|
|||||||
4
defer.js
4
defer.js
@@ -19,8 +19,6 @@ import baseRest from './_baseRest.js';
|
|||||||
* }, 'deferred');
|
* }, 'deferred');
|
||||||
* // => Logs 'deferred' after one millisecond.
|
* // => Logs 'deferred' after one millisecond.
|
||||||
*/
|
*/
|
||||||
var defer = baseRest(function(func, args) {
|
var defer = baseRest((func, args) => baseDelay(func, 1, args));
|
||||||
return baseDelay(func, 1, args);
|
|
||||||
});
|
|
||||||
|
|
||||||
export default defer;
|
export default defer;
|
||||||
|
|||||||
4
delay.js
4
delay.js
@@ -21,8 +21,6 @@ import toNumber from './toNumber.js';
|
|||||||
* }, 1000, 'later');
|
* }, 1000, 'later');
|
||||||
* // => Logs 'later' after one second.
|
* // => Logs 'later' after one second.
|
||||||
*/
|
*/
|
||||||
var delay = baseRest(function(func, wait, args) {
|
var delay = baseRest((func, wait, args) => baseDelay(func, toNumber(wait) || 0, args));
|
||||||
return baseDelay(func, toNumber(wait) || 0, args);
|
|
||||||
});
|
|
||||||
|
|
||||||
export default delay;
|
export default delay;
|
||||||
|
|||||||
@@ -24,10 +24,8 @@ import isArrayLikeObject from './isArrayLikeObject.js';
|
|||||||
* _.difference([2, 1], [2, 3]);
|
* _.difference([2, 1], [2, 3]);
|
||||||
* // => [1]
|
* // => [1]
|
||||||
*/
|
*/
|
||||||
var difference = baseRest(function(array, values) {
|
var difference = baseRest((array, values) => isArrayLikeObject(array)
|
||||||
return isArrayLikeObject(array)
|
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
|
||||||
? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true))
|
: []);
|
||||||
: [];
|
|
||||||
});
|
|
||||||
|
|
||||||
export default difference;
|
export default difference;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ import last from './last.js';
|
|||||||
* _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
|
* _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
|
||||||
* // => [{ 'x': 2 }]
|
* // => [{ 'x': 2 }]
|
||||||
*/
|
*/
|
||||||
var differenceBy = baseRest(function(array, values) {
|
var differenceBy = baseRest((array, values) => {
|
||||||
var iteratee = last(values);
|
var iteratee = last(values);
|
||||||
if (isArrayLikeObject(iteratee)) {
|
if (isArrayLikeObject(iteratee)) {
|
||||||
iteratee = undefined;
|
iteratee = undefined;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import last from './last.js';
|
|||||||
* _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
|
* _.differenceWith(objects, [{ 'x': 1, 'y': 2 }], _.isEqual);
|
||||||
* // => [{ 'x': 2, 'y': 1 }]
|
* // => [{ 'x': 2, 'y': 1 }]
|
||||||
*/
|
*/
|
||||||
var differenceWith = baseRest(function(array, values) {
|
var differenceWith = baseRest((array, values) => {
|
||||||
var comparator = last(values);
|
var comparator = last(values);
|
||||||
if (isArrayLikeObject(comparator)) {
|
if (isArrayLikeObject(comparator)) {
|
||||||
comparator = undefined;
|
comparator = undefined;
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ import createMathOperation from './_createMathOperation.js';
|
|||||||
* _.divide(6, 4);
|
* _.divide(6, 4);
|
||||||
* // => 1.5
|
* // => 1.5
|
||||||
*/
|
*/
|
||||||
var divide = createMathOperation(function(dividend, divisor) {
|
var divide = createMathOperation((dividend, divisor) => dividend / divisor, 1);
|
||||||
return dividend / divisor;
|
|
||||||
}, 1);
|
|
||||||
|
|
||||||
export default divide;
|
export default divide;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
|||||||
* _.groupBy(['one', 'two', 'three'], 'length');
|
* _.groupBy(['one', 'two', 'three'], 'length');
|
||||||
* // => { '3': ['one', 'two'], '5': ['three'] }
|
* // => { '3': ['one', 'two'], '5': ['three'] }
|
||||||
*/
|
*/
|
||||||
var groupBy = createAggregator(function(result, value, key) {
|
var groupBy = createAggregator((result, value, key) => {
|
||||||
if (hasOwnProperty.call(result, key)) {
|
if (hasOwnProperty.call(result, key)) {
|
||||||
result[key].push(value);
|
result[key].push(value);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
4
gte.js
4
gte.js
@@ -23,8 +23,6 @@ import createRelationalOperation from './_createRelationalOperation.js';
|
|||||||
* _.gte(1, 3);
|
* _.gte(1, 3);
|
||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
var gte = createRelationalOperation(function(value, other) {
|
var gte = createRelationalOperation((value, other) => value >= other);
|
||||||
return value >= other;
|
|
||||||
});
|
|
||||||
|
|
||||||
export default gte;
|
export default gte;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import castArrayLikeObject from './_castArrayLikeObject.js';
|
|||||||
* _.intersection([2, 1], [2, 3]);
|
* _.intersection([2, 1], [2, 3]);
|
||||||
* // => [2]
|
* // => [2]
|
||||||
*/
|
*/
|
||||||
var intersection = baseRest(function(arrays) {
|
var intersection = baseRest(arrays => {
|
||||||
var mapped = arrayMap(arrays, castArrayLikeObject);
|
var mapped = arrayMap(arrays, castArrayLikeObject);
|
||||||
return (mapped.length && mapped[0] === arrays[0])
|
return (mapped.length && mapped[0] === arrays[0])
|
||||||
? baseIntersection(mapped)
|
? baseIntersection(mapped)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import last from './last.js';
|
|||||||
* _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
* _.intersectionBy([{ 'x': 1 }], [{ 'x': 2 }, { 'x': 1 }], 'x');
|
||||||
* // => [{ 'x': 1 }]
|
* // => [{ 'x': 1 }]
|
||||||
*/
|
*/
|
||||||
var intersectionBy = baseRest(function(arrays) {
|
var intersectionBy = baseRest(arrays => {
|
||||||
var iteratee = last(arrays),
|
var iteratee = last(arrays),
|
||||||
mapped = arrayMap(arrays, castArrayLikeObject);
|
mapped = arrayMap(arrays, castArrayLikeObject);
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import last from './last.js';
|
|||||||
* _.intersectionWith(objects, others, _.isEqual);
|
* _.intersectionWith(objects, others, _.isEqual);
|
||||||
* // => [{ 'x': 1, 'y': 2 }]
|
* // => [{ 'x': 1, 'y': 2 }]
|
||||||
*/
|
*/
|
||||||
var intersectionWith = baseRest(function(arrays) {
|
var intersectionWith = baseRest(arrays => {
|
||||||
var comparator = last(arrays),
|
var comparator = last(arrays),
|
||||||
mapped = arrayMap(arrays, castArrayLikeObject);
|
mapped = arrayMap(arrays, castArrayLikeObject);
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import identity from './identity.js';
|
|||||||
* _.invert(object);
|
* _.invert(object);
|
||||||
* // => { '1': 'c', '2': 'b' }
|
* // => { '1': 'c', '2': 'b' }
|
||||||
*/
|
*/
|
||||||
var invert = createInverter(function(result, value, key) {
|
var invert = createInverter((result, value, key) => {
|
||||||
result[value] = key;
|
result[value] = key;
|
||||||
}, constant(identity));
|
}, constant(identity));
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ var hasOwnProperty = objectProto.hasOwnProperty;
|
|||||||
* });
|
* });
|
||||||
* // => { 'group1': ['a', 'c'], 'group2': ['b'] }
|
* // => { 'group1': ['a', 'c'], 'group2': ['b'] }
|
||||||
*/
|
*/
|
||||||
var invertBy = createInverter(function(result, value, key) {
|
var invertBy = createInverter((result, value, key) => {
|
||||||
if (hasOwnProperty.call(result, value)) {
|
if (hasOwnProperty.call(result, value)) {
|
||||||
result[value].push(key);
|
result[value].push(key);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ import isArrayLike from './isArrayLike.js';
|
|||||||
* _.invokeMap([123, 456], String.prototype.split, '');
|
* _.invokeMap([123, 456], String.prototype.split, '');
|
||||||
* // => [['1', '2', '3'], ['4', '5', '6']]
|
* // => [['1', '2', '3'], ['4', '5', '6']]
|
||||||
*/
|
*/
|
||||||
var invokeMap = baseRest(function(collection, path, args) {
|
var invokeMap = baseRest((collection, path, args) => {
|
||||||
var index = -1,
|
var index = -1,
|
||||||
isFunc = typeof path == 'function',
|
isFunc = typeof path == 'function',
|
||||||
result = isArrayLike(collection) ? Array(collection.length) : [];
|
result = isArrayLike(collection) ? Array(collection.length) : [];
|
||||||
|
|
||||||
baseEach(collection, function(value) {
|
baseEach(collection, value => {
|
||||||
result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
|
result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -28,9 +28,7 @@ var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
|||||||
* _.isArguments([1, 2, 3]);
|
* _.isArguments([1, 2, 3]);
|
||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : value => isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
|
||||||
return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
|
!propertyIsEnumerable.call(value, 'callee');
|
||||||
!propertyIsEnumerable.call(value, 'callee');
|
|
||||||
};
|
|
||||||
|
|
||||||
export default isArguments;
|
export default isArguments;
|
||||||
|
|||||||
@@ -21,8 +21,6 @@ import createCompounder from './_createCompounder.js';
|
|||||||
* _.kebabCase('__FOO_BAR__');
|
* _.kebabCase('__FOO_BAR__');
|
||||||
* // => 'foo-bar'
|
* // => 'foo-bar'
|
||||||
*/
|
*/
|
||||||
var kebabCase = createCompounder(function(result, word, index) {
|
var kebabCase = createCompounder((result, word, index) => result + (index ? '-' : '') + word.toLowerCase());
|
||||||
return result + (index ? '-' : '') + word.toLowerCase();
|
|
||||||
});
|
|
||||||
|
|
||||||
export default kebabCase;
|
export default kebabCase;
|
||||||
|
|||||||
2
keyBy.js
2
keyBy.js
@@ -29,7 +29,7 @@ import createAggregator from './_createAggregator.js';
|
|||||||
* _.keyBy(array, 'dir');
|
* _.keyBy(array, 'dir');
|
||||||
* // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
|
* // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } }
|
||||||
*/
|
*/
|
||||||
var keyBy = createAggregator(function(result, value, key) {
|
var keyBy = createAggregator((result, value, key) => {
|
||||||
baseAssignValue(result, key, value);
|
baseAssignValue(result, key, value);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -72,22 +72,20 @@ var nativeMax = Math.max,
|
|||||||
nativeMin = Math.min;
|
nativeMin = Math.min;
|
||||||
|
|
||||||
// wrap `_.mixin` so it works when provided only one argument
|
// wrap `_.mixin` so it works when provided only one argument
|
||||||
var mixin = (function(func) {
|
var mixin = ((func => function(object, source, options) {
|
||||||
return function(object, source, options) {
|
if (options == null) {
|
||||||
if (options == null) {
|
var isObj = isObject(source),
|
||||||
var isObj = isObject(source),
|
props = isObj && keys(source),
|
||||||
props = isObj && keys(source),
|
methodNames = props && props.length && baseFunctions(source, props);
|
||||||
methodNames = props && props.length && baseFunctions(source, props);
|
|
||||||
|
|
||||||
if (!(methodNames ? methodNames.length : isObj)) {
|
if (!(methodNames ? methodNames.length : isObj)) {
|
||||||
options = source;
|
options = source;
|
||||||
source = object;
|
source = object;
|
||||||
object = this;
|
object = this;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return func(object, source, options);
|
}
|
||||||
};
|
return func(object, source, options);
|
||||||
}(_mixin));
|
})(_mixin));
|
||||||
|
|
||||||
// Add methods that return wrapped values in chain sequences.
|
// Add methods that return wrapped values in chain sequences.
|
||||||
lodash.after = func.after;
|
lodash.after = func.after;
|
||||||
@@ -403,15 +401,15 @@ lodash.each = collection.forEach;
|
|||||||
lodash.eachRight = collection.forEachRight;
|
lodash.eachRight = collection.forEachRight;
|
||||||
lodash.first = array.head;
|
lodash.first = array.head;
|
||||||
|
|
||||||
mixin(lodash, (function() {
|
mixin(lodash, ((() => {
|
||||||
var source = {};
|
var source = {};
|
||||||
baseForOwn(lodash, function(func, methodName) {
|
baseForOwn(lodash, (func, methodName) => {
|
||||||
if (!hasOwnProperty.call(lodash.prototype, methodName)) {
|
if (!hasOwnProperty.call(lodash.prototype, methodName)) {
|
||||||
source[methodName] = func;
|
source[methodName] = func;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return source;
|
return source;
|
||||||
}()), { 'chain': false });
|
})()), { 'chain': false });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The semantic version number.
|
* The semantic version number.
|
||||||
@@ -424,12 +422,12 @@ lodash.VERSION = VERSION;
|
|||||||
(lodash.templateSettings = string.templateSettings).imports._ = lodash;
|
(lodash.templateSettings = string.templateSettings).imports._ = lodash;
|
||||||
|
|
||||||
// Assign default placeholders.
|
// Assign default placeholders.
|
||||||
arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], function(methodName) {
|
arrayEach(['bind', 'bindKey', 'curry', 'curryRight', 'partial', 'partialRight'], methodName => {
|
||||||
lodash[methodName].placeholder = lodash;
|
lodash[methodName].placeholder = lodash;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
|
// Add `LazyWrapper` methods for `_.drop` and `_.take` variants.
|
||||||
arrayEach(['drop', 'take'], function(methodName, index) {
|
arrayEach(['drop', 'take'], (methodName, index) => {
|
||||||
LazyWrapper.prototype[methodName] = function(n) {
|
LazyWrapper.prototype[methodName] = function(n) {
|
||||||
n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
|
n = n === undefined ? 1 : nativeMax(toInteger(n), 0);
|
||||||
|
|
||||||
@@ -454,7 +452,7 @@ arrayEach(['drop', 'take'], function(methodName, index) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Add `LazyWrapper` methods that accept an `iteratee` value.
|
// Add `LazyWrapper` methods that accept an `iteratee` value.
|
||||||
arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
|
arrayEach(['filter', 'map', 'takeWhile'], (methodName, index) => {
|
||||||
var type = index + 1,
|
var type = index + 1,
|
||||||
isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
|
isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
|
||||||
|
|
||||||
@@ -470,7 +468,7 @@ arrayEach(['filter', 'map', 'takeWhile'], function(methodName, index) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Add `LazyWrapper` methods for `_.head` and `_.last`.
|
// Add `LazyWrapper` methods for `_.head` and `_.last`.
|
||||||
arrayEach(['head', 'last'], function(methodName, index) {
|
arrayEach(['head', 'last'], (methodName, index) => {
|
||||||
var takeName = 'take' + (index ? 'Right' : '');
|
var takeName = 'take' + (index ? 'Right' : '');
|
||||||
|
|
||||||
LazyWrapper.prototype[methodName] = function() {
|
LazyWrapper.prototype[methodName] = function() {
|
||||||
@@ -479,7 +477,7 @@ arrayEach(['head', 'last'], function(methodName, index) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Add `LazyWrapper` methods for `_.initial` and `_.tail`.
|
// Add `LazyWrapper` methods for `_.initial` and `_.tail`.
|
||||||
arrayEach(['initial', 'tail'], function(methodName, index) {
|
arrayEach(['initial', 'tail'], (methodName, index) => {
|
||||||
var dropName = 'drop' + (index ? '' : 'Right');
|
var dropName = 'drop' + (index ? '' : 'Right');
|
||||||
|
|
||||||
LazyWrapper.prototype[methodName] = function() {
|
LazyWrapper.prototype[methodName] = function() {
|
||||||
@@ -503,9 +501,7 @@ LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
|
|||||||
if (typeof path == 'function') {
|
if (typeof path == 'function') {
|
||||||
return new LazyWrapper(this);
|
return new LazyWrapper(this);
|
||||||
}
|
}
|
||||||
return this.map(function(value) {
|
return this.map(value => baseInvoke(value, path, args));
|
||||||
return baseInvoke(value, path, args);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
LazyWrapper.prototype.reject = function(predicate) {
|
LazyWrapper.prototype.reject = function(predicate) {
|
||||||
@@ -540,7 +536,7 @@ LazyWrapper.prototype.toArray = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Add `LazyWrapper` methods to `lodash.prototype`.
|
// Add `LazyWrapper` methods to `lodash.prototype`.
|
||||||
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
|
baseForOwn(LazyWrapper.prototype, (func, methodName) => {
|
||||||
var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
|
var checkIteratee = /^(?:filter|find|map|reject)|While$/.test(methodName),
|
||||||
isTaker = /^(?:head|last)$/.test(methodName),
|
isTaker = /^(?:head|last)$/.test(methodName),
|
||||||
lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
|
lodashFunc = lodash[isTaker ? ('take' + (methodName == 'last' ? 'Right' : '')) : methodName],
|
||||||
@@ -556,7 +552,7 @@ baseForOwn(LazyWrapper.prototype, function(func, methodName) {
|
|||||||
iteratee = args[0],
|
iteratee = args[0],
|
||||||
useLazy = isLazy || isArray(value);
|
useLazy = isLazy || isArray(value);
|
||||||
|
|
||||||
var interceptor = function(value) {
|
var interceptor = value => {
|
||||||
var result = lodashFunc.apply(lodash, arrayPush([value], args));
|
var result = lodashFunc.apply(lodash, arrayPush([value], args));
|
||||||
return (isTaker && chainAll) ? result[0] : result;
|
return (isTaker && chainAll) ? result[0] : result;
|
||||||
};
|
};
|
||||||
@@ -585,7 +581,7 @@ baseForOwn(LazyWrapper.prototype, function(func, methodName) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Add `Array` methods to `lodash.prototype`.
|
// Add `Array` methods to `lodash.prototype`.
|
||||||
arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {
|
arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], methodName => {
|
||||||
var func = arrayProto[methodName],
|
var func = arrayProto[methodName],
|
||||||
chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
|
chainName = /^(?:push|sort|unshift)$/.test(methodName) ? 'tap' : 'thru',
|
||||||
retUnwrapped = /^(?:pop|shift)$/.test(methodName);
|
retUnwrapped = /^(?:pop|shift)$/.test(methodName);
|
||||||
@@ -596,14 +592,12 @@ arrayEach(['pop', 'push', 'shift', 'sort', 'splice', 'unshift'], function(method
|
|||||||
var value = this.value();
|
var value = this.value();
|
||||||
return func.apply(isArray(value) ? value : [], args);
|
return func.apply(isArray(value) ? value : [], args);
|
||||||
}
|
}
|
||||||
return this[chainName](function(value) {
|
return this[chainName](value => func.apply(isArray(value) ? value : [], args));
|
||||||
return func.apply(isArray(value) ? value : [], args);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// Map minified method names to their real names.
|
// Map minified method names to their real names.
|
||||||
baseForOwn(LazyWrapper.prototype, function(func, methodName) {
|
baseForOwn(LazyWrapper.prototype, (func, methodName) => {
|
||||||
var lodashFunc = lodash[methodName];
|
var lodashFunc = lodash[methodName];
|
||||||
if (lodashFunc) {
|
if (lodashFunc) {
|
||||||
var key = (lodashFunc.name + ''),
|
var key = (lodashFunc.name + ''),
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ import createCompounder from './_createCompounder.js';
|
|||||||
* _.lowerCase('__FOO_BAR__');
|
* _.lowerCase('__FOO_BAR__');
|
||||||
* // => 'foo bar'
|
* // => 'foo bar'
|
||||||
*/
|
*/
|
||||||
var lowerCase = createCompounder(function(result, word, index) {
|
var lowerCase = createCompounder((result, word, index) => result + (index ? ' ' : '') + word.toLowerCase());
|
||||||
return result + (index ? ' ' : '') + word.toLowerCase();
|
|
||||||
});
|
|
||||||
|
|
||||||
export default lowerCase;
|
export default lowerCase;
|
||||||
|
|||||||
4
lte.js
4
lte.js
@@ -23,8 +23,6 @@ import createRelationalOperation from './_createRelationalOperation.js';
|
|||||||
* _.lte(3, 1);
|
* _.lte(3, 1);
|
||||||
* // => false
|
* // => false
|
||||||
*/
|
*/
|
||||||
var lte = createRelationalOperation(function(value, other) {
|
var lte = createRelationalOperation((value, other) => value <= other);
|
||||||
return value <= other;
|
|
||||||
});
|
|
||||||
|
|
||||||
export default lte;
|
export default lte;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ function mapKeys(object, iteratee) {
|
|||||||
var result = {};
|
var result = {};
|
||||||
iteratee = baseIteratee(iteratee, 3);
|
iteratee = baseIteratee(iteratee, 3);
|
||||||
|
|
||||||
baseForOwn(object, function(value, key, object) {
|
baseForOwn(object, (value, key, object) => {
|
||||||
baseAssignValue(result, iteratee(value, key, object), value);
|
baseAssignValue(result, iteratee(value, key, object), value);
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ function mapValues(object, iteratee) {
|
|||||||
var result = {};
|
var result = {};
|
||||||
iteratee = baseIteratee(iteratee, 3);
|
iteratee = baseIteratee(iteratee, 3);
|
||||||
|
|
||||||
baseForOwn(object, function(value, key, object) {
|
baseForOwn(object, (value, key, object) => {
|
||||||
baseAssignValue(result, key, iteratee(value, key, object));
|
baseAssignValue(result, key, iteratee(value, key, object));
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
2
merge.js
2
merge.js
@@ -32,7 +32,7 @@ import createAssigner from './_createAssigner.js';
|
|||||||
* _.merge(object, other);
|
* _.merge(object, other);
|
||||||
* // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
|
* // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] }
|
||||||
*/
|
*/
|
||||||
var merge = createAssigner(function(object, source, srcIndex) {
|
var merge = createAssigner((object, source, srcIndex) => {
|
||||||
baseMerge(object, source, srcIndex);
|
baseMerge(object, source, srcIndex);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import createAssigner from './_createAssigner.js';
|
|||||||
* _.mergeWith(object, other, customizer);
|
* _.mergeWith(object, other, customizer);
|
||||||
* // => { 'a': [1, 3], 'b': [2, 4] }
|
* // => { 'a': [1, 3], 'b': [2, 4] }
|
||||||
*/
|
*/
|
||||||
var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
|
var mergeWith = createAssigner((object, source, srcIndex, customizer) => {
|
||||||
baseMerge(object, source, srcIndex, customizer);
|
baseMerge(object, source, srcIndex, customizer);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -25,10 +25,6 @@ import baseRest from './_baseRest.js';
|
|||||||
* _.map(objects, _.method(['a', 'b']));
|
* _.map(objects, _.method(['a', 'b']));
|
||||||
* // => [2, 1]
|
* // => [2, 1]
|
||||||
*/
|
*/
|
||||||
var method = baseRest(function(path, args) {
|
var method = baseRest((path, args) => object => baseInvoke(object, path, args));
|
||||||
return function(object) {
|
|
||||||
return baseInvoke(object, path, args);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
export default method;
|
export default method;
|
||||||
|
|||||||
@@ -24,10 +24,6 @@ import baseRest from './_baseRest.js';
|
|||||||
* _.map([['a', '2'], ['c', '0']], _.methodOf(object));
|
* _.map([['a', '2'], ['c', '0']], _.methodOf(object));
|
||||||
* // => [2, 0]
|
* // => [2, 0]
|
||||||
*/
|
*/
|
||||||
var methodOf = baseRest(function(object, args) {
|
var methodOf = baseRest((object, args) => path => baseInvoke(object, path, args));
|
||||||
return function(path) {
|
|
||||||
return baseInvoke(object, path, args);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
export default methodOf;
|
export default methodOf;
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ import createMathOperation from './_createMathOperation.js';
|
|||||||
* _.multiply(6, 4);
|
* _.multiply(6, 4);
|
||||||
* // => 24
|
* // => 24
|
||||||
*/
|
*/
|
||||||
var multiply = createMathOperation(function(multiplier, multiplicand) {
|
var multiply = createMathOperation((multiplier, multiplicand) => multiplier * multiplicand, 1);
|
||||||
return multiplier * multiplicand;
|
|
||||||
}, 1);
|
|
||||||
|
|
||||||
export default multiply;
|
export default multiply;
|
||||||
|
|||||||
4
now.js
4
now.js
@@ -16,8 +16,6 @@ import root from './_root.js';
|
|||||||
* }, _.now());
|
* }, _.now());
|
||||||
* // => Logs the number of milliseconds it took for the deferred invocation.
|
* // => Logs the number of milliseconds it took for the deferred invocation.
|
||||||
*/
|
*/
|
||||||
var now = function() {
|
var now = () => root.Date.now();
|
||||||
return root.Date.now();
|
|
||||||
};
|
|
||||||
|
|
||||||
export default now;
|
export default now;
|
||||||
|
|||||||
@@ -24,9 +24,7 @@ import toInteger from './toInteger.js';
|
|||||||
*/
|
*/
|
||||||
function nthArg(n) {
|
function nthArg(n) {
|
||||||
n = toInteger(n);
|
n = toInteger(n);
|
||||||
return baseRest(function(args) {
|
return baseRest(args => baseNth(args, n));
|
||||||
return baseNth(args, n);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default nthArg;
|
export default nthArg;
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ var nativeMin = Math.min;
|
|||||||
* func(10, 5);
|
* func(10, 5);
|
||||||
* // => [100, 10]
|
* // => [100, 10]
|
||||||
*/
|
*/
|
||||||
var overArgs = castRest(function(func, transforms) {
|
var overArgs = castRest((func, transforms) => {
|
||||||
transforms = (transforms.length == 1 && isArray(transforms[0]))
|
transforms = (transforms.length == 1 && isArray(transforms[0]))
|
||||||
? arrayMap(transforms[0], baseUnary(baseIteratee))
|
? arrayMap(transforms[0], baseUnary(baseIteratee))
|
||||||
: arrayMap(baseFlatten(transforms, 1), baseUnary(baseIteratee));
|
: arrayMap(baseFlatten(transforms, 1), baseUnary(baseIteratee));
|
||||||
|
|||||||
4
pick.js
4
pick.js
@@ -18,8 +18,6 @@ import flatRest from './_flatRest.js';
|
|||||||
* _.pick(object, ['a', 'c']);
|
* _.pick(object, ['a', 'c']);
|
||||||
* // => { 'a': 1, 'c': 3 }
|
* // => { 'a': 1, 'c': 3 }
|
||||||
*/
|
*/
|
||||||
var pick = flatRest(function(object, paths) {
|
var pick = flatRest((object, paths) => object == null ? {} : basePick(object, paths));
|
||||||
return object == null ? {} : basePick(object, paths);
|
|
||||||
});
|
|
||||||
|
|
||||||
export default pick;
|
export default pick;
|
||||||
|
|||||||
@@ -25,13 +25,9 @@ function pickBy(object, predicate) {
|
|||||||
if (object == null) {
|
if (object == null) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
var props = arrayMap(getAllKeysIn(object), function(prop) {
|
var props = arrayMap(getAllKeysIn(object), prop => [prop]);
|
||||||
return [prop];
|
|
||||||
});
|
|
||||||
predicate = baseIteratee(predicate);
|
predicate = baseIteratee(predicate);
|
||||||
return basePickBy(object, props, function(value, path) {
|
return basePickBy(object, props, (value, path) => predicate(value, path[0]));
|
||||||
return predicate(value, path[0]);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default pickBy;
|
export default pickBy;
|
||||||
|
|||||||
@@ -22,9 +22,7 @@ import baseGet from './_baseGet.js';
|
|||||||
* // => [2, 0]
|
* // => [2, 0]
|
||||||
*/
|
*/
|
||||||
function propertyOf(object) {
|
function propertyOf(object) {
|
||||||
return function(path) {
|
return path => object == null ? undefined : baseGet(object, path);
|
||||||
return object == null ? undefined : baseGet(object, path);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default propertyOf;
|
export default propertyOf;
|
||||||
|
|||||||
@@ -29,13 +29,11 @@ import isIndex from './_isIndex.js';
|
|||||||
* console.log(pulled);
|
* console.log(pulled);
|
||||||
* // => ['b', 'd']
|
* // => ['b', 'd']
|
||||||
*/
|
*/
|
||||||
var pullAt = flatRest(function(array, indexes) {
|
var pullAt = flatRest((array, indexes) => {
|
||||||
var length = array == null ? 0 : array.length,
|
var length = array == null ? 0 : array.length,
|
||||||
result = baseAt(array, indexes);
|
result = baseAt(array, indexes);
|
||||||
|
|
||||||
basePullAt(array, arrayMap(indexes, function(index) {
|
basePullAt(array, arrayMap(indexes, index => isIndex(index, length) ? +index : index).sort(compareAscending));
|
||||||
return isIndex(index, length) ? +index : index;
|
|
||||||
}).sort(compareAscending));
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
});
|
});
|
||||||
|
|||||||
4
rearg.js
4
rearg.js
@@ -26,8 +26,6 @@ var WRAP_REARG_FLAG = 256;
|
|||||||
* rearged('b', 'c', 'a')
|
* rearged('b', 'c', 'a')
|
||||||
* // => ['a', 'b', 'c']
|
* // => ['a', 'b', 'c']
|
||||||
*/
|
*/
|
||||||
var rearg = flatRest(function(func, indexes) {
|
var rearg = flatRest((func, indexes) => createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes));
|
||||||
return createWrap(func, WRAP_REARG_FLAG, undefined, undefined, undefined, indexes);
|
|
||||||
});
|
|
||||||
|
|
||||||
export default rearg;
|
export default rearg;
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ import createCompounder from './_createCompounder.js';
|
|||||||
* _.snakeCase('--FOO-BAR--');
|
* _.snakeCase('--FOO-BAR--');
|
||||||
* // => 'foo_bar'
|
* // => 'foo_bar'
|
||||||
*/
|
*/
|
||||||
var snakeCase = createCompounder(function(result, word, index) {
|
const snakeCase = createCompounder((result, word, index) =>
|
||||||
return result + (index ? '_' : '') + word.toLowerCase();
|
result + (index ? '_' : '') + word.toLowerCase()
|
||||||
});
|
);
|
||||||
|
|
||||||
export default snakeCase;
|
export default snakeCase;
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ import upperFirst from './upperFirst.js';
|
|||||||
* _.startCase('__FOO_BAR__');
|
* _.startCase('__FOO_BAR__');
|
||||||
* // => 'FOO BAR'
|
* // => 'FOO BAR'
|
||||||
*/
|
*/
|
||||||
var startCase = createCompounder(function(result, word, index) {
|
var startCase = createCompounder((result, word, index) => result + (index ? ' ' : '') + upperFirst(word));
|
||||||
return result + (index ? ' ' : '') + upperFirst(word);
|
|
||||||
});
|
|
||||||
|
|
||||||
export default startCase;
|
export default startCase;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user