Browse Source

添加union,zipObject

es6
Frank.Qiu 7 years ago
parent
commit
447fbd991c
  1. 82
      dist/bundle.js
  2. 82
      dist/core.js
  3. 82
      dist/fineui.js
  4. 2
      lodash.md
  5. 82
      src/core/lodash.js
  6. 82
      utils/utils.js

82
dist/bundle.js vendored

@ -9599,7 +9599,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
})( window );/** })( window );/**
* @license * @license
* Lodash (Custom Build) <https://lodash.com/> * Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy"` * Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject"`
* Copyright JS Foundation and other contributors <https://js.foundation/> * Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license> * Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -12774,6 +12774,28 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
}, result); }, result);
} }
/**
* This base implementation of `_.zipObject` which assigns values using `assignFunc`.
*
* @private
* @param {Array} props The property identifiers.
* @param {Array} values The property values.
* @param {Function} assignFunc The function to assign values.
* @returns {Object} Returns the new object.
*/
function baseZipObject(props, values, assignFunc) {
var index = -1,
length = props.length,
valsLength = values.length,
result = {};
while (++index < length) {
var value = index < valsLength ? values[index] : undefined;
assignFunc(result, props[index], value);
}
return result;
}
/** /**
* Casts `value` to an empty array if it's not an array like object. * Casts `value` to an empty array if it's not an array like object.
* *
@ -15150,6 +15172,26 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return baseSlice(array, start, end); return baseSlice(array, start, end);
} }
/**
* Creates an array of unique values, in order, from all given arrays using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @returns {Array} Returns the new array of combined values.
* @example
*
* _.union([2], [1, 2]);
* // => [2, 1]
*/
var union = baseRest(function(arrays) {
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
});
/** /**
* Creates a duplicate-free version of an array, using * Creates a duplicate-free version of an array, using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
@ -15252,6 +15294,26 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
*/ */
var zip = baseRest(unzip); var zip = baseRest(unzip);
/**
* This method is like `_.fromPairs` except that it accepts two arrays,
* one of property identifiers and one of corresponding values.
*
* @static
* @memberOf _
* @since 0.4.0
* @category Array
* @param {Array} [props=[]] The property identifiers.
* @param {Array} [values=[]] The property values.
* @returns {Object} Returns the new object.
* @example
*
* _.zipObject(['a', 'b'], [1, 2]);
* // => { 'a': 1, 'b': 2 }
*/
function zipObject(props, values) {
return baseZipObject(props || [], values || [], assignValue);
}
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/** /**
@ -18198,21 +18260,6 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return baseRandom(lower, upper); return baseRandom(lower, upper);
} }
// Converts lists into objects. Pass either a single array of `[key, value]`
// pairs, or two parallel arrays of the same length -- one of keys, and one of
// the corresponding values.
function object (list, values) {
var result = {};
for (var i = 0, length = list && list.length; i < length; i++) {
if (values) {
result[list[i]] = values[i];
} else {
result[list[i][0]] = list[i][1];
}
}
return result;
}
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/** /**
@ -18704,11 +18751,13 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
lodash.throttle = throttle; lodash.throttle = throttle;
lodash.thru = thru; lodash.thru = thru;
lodash.toArray = toArray; lodash.toArray = toArray;
lodash.union = union;
lodash.uniq = uniq; lodash.uniq = uniq;
lodash.uniqBy = uniqBy; lodash.uniqBy = uniqBy;
lodash.unzip = unzip; lodash.unzip = unzip;
lodash.values = values; lodash.values = values;
lodash.zip = zip; lodash.zip = zip;
lodash.zipObject = zipObject;
// Add aliases. // Add aliases.
lodash.extend = assignIn; lodash.extend = assignIn;
@ -18760,7 +18809,6 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
lodash.size = size; lodash.size = size;
lodash.some = some; lodash.some = some;
lodash.uniqueId = uniqueId; lodash.uniqueId = uniqueId;
lodash.object = object;
// Add aliases. // Add aliases.
lodash.each = forEach; lodash.each = forEach;

82
dist/core.js vendored

@ -9599,7 +9599,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
})( window );/** })( window );/**
* @license * @license
* Lodash (Custom Build) <https://lodash.com/> * Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy"` * Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject"`
* Copyright JS Foundation and other contributors <https://js.foundation/> * Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license> * Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -12774,6 +12774,28 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
}, result); }, result);
} }
/**
* This base implementation of `_.zipObject` which assigns values using `assignFunc`.
*
* @private
* @param {Array} props The property identifiers.
* @param {Array} values The property values.
* @param {Function} assignFunc The function to assign values.
* @returns {Object} Returns the new object.
*/
function baseZipObject(props, values, assignFunc) {
var index = -1,
length = props.length,
valsLength = values.length,
result = {};
while (++index < length) {
var value = index < valsLength ? values[index] : undefined;
assignFunc(result, props[index], value);
}
return result;
}
/** /**
* Casts `value` to an empty array if it's not an array like object. * Casts `value` to an empty array if it's not an array like object.
* *
@ -15150,6 +15172,26 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return baseSlice(array, start, end); return baseSlice(array, start, end);
} }
/**
* Creates an array of unique values, in order, from all given arrays using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @returns {Array} Returns the new array of combined values.
* @example
*
* _.union([2], [1, 2]);
* // => [2, 1]
*/
var union = baseRest(function(arrays) {
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
});
/** /**
* Creates a duplicate-free version of an array, using * Creates a duplicate-free version of an array, using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
@ -15252,6 +15294,26 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
*/ */
var zip = baseRest(unzip); var zip = baseRest(unzip);
/**
* This method is like `_.fromPairs` except that it accepts two arrays,
* one of property identifiers and one of corresponding values.
*
* @static
* @memberOf _
* @since 0.4.0
* @category Array
* @param {Array} [props=[]] The property identifiers.
* @param {Array} [values=[]] The property values.
* @returns {Object} Returns the new object.
* @example
*
* _.zipObject(['a', 'b'], [1, 2]);
* // => { 'a': 1, 'b': 2 }
*/
function zipObject(props, values) {
return baseZipObject(props || [], values || [], assignValue);
}
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/** /**
@ -18198,21 +18260,6 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return baseRandom(lower, upper); return baseRandom(lower, upper);
} }
// Converts lists into objects. Pass either a single array of `[key, value]`
// pairs, or two parallel arrays of the same length -- one of keys, and one of
// the corresponding values.
function object (list, values) {
var result = {};
for (var i = 0, length = list && list.length; i < length; i++) {
if (values) {
result[list[i]] = values[i];
} else {
result[list[i][0]] = list[i][1];
}
}
return result;
}
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/** /**
@ -18704,11 +18751,13 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
lodash.throttle = throttle; lodash.throttle = throttle;
lodash.thru = thru; lodash.thru = thru;
lodash.toArray = toArray; lodash.toArray = toArray;
lodash.union = union;
lodash.uniq = uniq; lodash.uniq = uniq;
lodash.uniqBy = uniqBy; lodash.uniqBy = uniqBy;
lodash.unzip = unzip; lodash.unzip = unzip;
lodash.values = values; lodash.values = values;
lodash.zip = zip; lodash.zip = zip;
lodash.zipObject = zipObject;
// Add aliases. // Add aliases.
lodash.extend = assignIn; lodash.extend = assignIn;
@ -18760,7 +18809,6 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
lodash.size = size; lodash.size = size;
lodash.some = some; lodash.some = some;
lodash.uniqueId = uniqueId; lodash.uniqueId = uniqueId;
lodash.object = object;
// Add aliases. // Add aliases.
lodash.each = forEach; lodash.each = forEach;

82
dist/fineui.js vendored

@ -9800,7 +9800,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
})( window );/** })( window );/**
* @license * @license
* Lodash (Custom Build) <https://lodash.com/> * Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy"` * Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject"`
* Copyright JS Foundation and other contributors <https://js.foundation/> * Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license> * Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -12975,6 +12975,28 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
}, result); }, result);
} }
/**
* This base implementation of `_.zipObject` which assigns values using `assignFunc`.
*
* @private
* @param {Array} props The property identifiers.
* @param {Array} values The property values.
* @param {Function} assignFunc The function to assign values.
* @returns {Object} Returns the new object.
*/
function baseZipObject(props, values, assignFunc) {
var index = -1,
length = props.length,
valsLength = values.length,
result = {};
while (++index < length) {
var value = index < valsLength ? values[index] : undefined;
assignFunc(result, props[index], value);
}
return result;
}
/** /**
* Casts `value` to an empty array if it's not an array like object. * Casts `value` to an empty array if it's not an array like object.
* *
@ -15351,6 +15373,26 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return baseSlice(array, start, end); return baseSlice(array, start, end);
} }
/**
* Creates an array of unique values, in order, from all given arrays using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @returns {Array} Returns the new array of combined values.
* @example
*
* _.union([2], [1, 2]);
* // => [2, 1]
*/
var union = baseRest(function(arrays) {
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
});
/** /**
* Creates a duplicate-free version of an array, using * Creates a duplicate-free version of an array, using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
@ -15453,6 +15495,26 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
*/ */
var zip = baseRest(unzip); var zip = baseRest(unzip);
/**
* This method is like `_.fromPairs` except that it accepts two arrays,
* one of property identifiers and one of corresponding values.
*
* @static
* @memberOf _
* @since 0.4.0
* @category Array
* @param {Array} [props=[]] The property identifiers.
* @param {Array} [values=[]] The property values.
* @returns {Object} Returns the new object.
* @example
*
* _.zipObject(['a', 'b'], [1, 2]);
* // => { 'a': 1, 'b': 2 }
*/
function zipObject(props, values) {
return baseZipObject(props || [], values || [], assignValue);
}
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/** /**
@ -18399,21 +18461,6 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
return baseRandom(lower, upper); return baseRandom(lower, upper);
} }
// Converts lists into objects. Pass either a single array of `[key, value]`
// pairs, or two parallel arrays of the same length -- one of keys, and one of
// the corresponding values.
function object (list, values) {
var result = {};
for (var i = 0, length = list && list.length; i < length; i++) {
if (values) {
result[list[i]] = values[i];
} else {
result[list[i][0]] = list[i][1];
}
}
return result;
}
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/** /**
@ -18905,11 +18952,13 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
lodash.throttle = throttle; lodash.throttle = throttle;
lodash.thru = thru; lodash.thru = thru;
lodash.toArray = toArray; lodash.toArray = toArray;
lodash.union = union;
lodash.uniq = uniq; lodash.uniq = uniq;
lodash.uniqBy = uniqBy; lodash.uniqBy = uniqBy;
lodash.unzip = unzip; lodash.unzip = unzip;
lodash.values = values; lodash.values = values;
lodash.zip = zip; lodash.zip = zip;
lodash.zipObject = zipObject;
// Add aliases. // Add aliases.
lodash.extend = assignIn; lodash.extend = assignIn;
@ -18961,7 +19010,6 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
lodash.size = size; lodash.size = size;
lodash.some = some; lodash.some = some;
lodash.uniqueId = uniqueId; lodash.uniqueId = uniqueId;
lodash.object = object;
// Add aliases. // Add aliases.
lodash.each = forEach; lodash.each = forEach;

2
lodash.md

@ -1 +1 @@
lodash core plus=debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,object lodash core plus=debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject

82
src/core/lodash.js

@ -1,7 +1,7 @@
/** /**
* @license * @license
* Lodash (Custom Build) <https://lodash.com/> * Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy"` * Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject"`
* Copyright JS Foundation and other contributors <https://js.foundation/> * Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license> * Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -3176,6 +3176,28 @@
}, result); }, result);
} }
/**
* This base implementation of `_.zipObject` which assigns values using `assignFunc`.
*
* @private
* @param {Array} props The property identifiers.
* @param {Array} values The property values.
* @param {Function} assignFunc The function to assign values.
* @returns {Object} Returns the new object.
*/
function baseZipObject(props, values, assignFunc) {
var index = -1,
length = props.length,
valsLength = values.length,
result = {};
while (++index < length) {
var value = index < valsLength ? values[index] : undefined;
assignFunc(result, props[index], value);
}
return result;
}
/** /**
* Casts `value` to an empty array if it's not an array like object. * Casts `value` to an empty array if it's not an array like object.
* *
@ -5552,6 +5574,26 @@
return baseSlice(array, start, end); return baseSlice(array, start, end);
} }
/**
* Creates an array of unique values, in order, from all given arrays using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @returns {Array} Returns the new array of combined values.
* @example
*
* _.union([2], [1, 2]);
* // => [2, 1]
*/
var union = baseRest(function(arrays) {
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
});
/** /**
* Creates a duplicate-free version of an array, using * Creates a duplicate-free version of an array, using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
@ -5654,6 +5696,26 @@
*/ */
var zip = baseRest(unzip); var zip = baseRest(unzip);
/**
* This method is like `_.fromPairs` except that it accepts two arrays,
* one of property identifiers and one of corresponding values.
*
* @static
* @memberOf _
* @since 0.4.0
* @category Array
* @param {Array} [props=[]] The property identifiers.
* @param {Array} [values=[]] The property values.
* @returns {Object} Returns the new object.
* @example
*
* _.zipObject(['a', 'b'], [1, 2]);
* // => { 'a': 1, 'b': 2 }
*/
function zipObject(props, values) {
return baseZipObject(props || [], values || [], assignValue);
}
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/** /**
@ -8600,21 +8662,6 @@
return baseRandom(lower, upper); return baseRandom(lower, upper);
} }
// Converts lists into objects. Pass either a single array of `[key, value]`
// pairs, or two parallel arrays of the same length -- one of keys, and one of
// the corresponding values.
function object (list, values) {
var result = {};
for (var i = 0, length = list && list.length; i < length; i++) {
if (values) {
result[list[i]] = values[i];
} else {
result[list[i][0]] = list[i][1];
}
}
return result;
}
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/** /**
@ -9106,11 +9153,13 @@
lodash.throttle = throttle; lodash.throttle = throttle;
lodash.thru = thru; lodash.thru = thru;
lodash.toArray = toArray; lodash.toArray = toArray;
lodash.union = union;
lodash.uniq = uniq; lodash.uniq = uniq;
lodash.uniqBy = uniqBy; lodash.uniqBy = uniqBy;
lodash.unzip = unzip; lodash.unzip = unzip;
lodash.values = values; lodash.values = values;
lodash.zip = zip; lodash.zip = zip;
lodash.zipObject = zipObject;
// Add aliases. // Add aliases.
lodash.extend = assignIn; lodash.extend = assignIn;
@ -9162,7 +9211,6 @@
lodash.size = size; lodash.size = size;
lodash.some = some; lodash.some = some;
lodash.uniqueId = uniqueId; lodash.uniqueId = uniqueId;
lodash.object = object;
// Add aliases. // Add aliases.
lodash.each = forEach; lodash.each = forEach;

82
utils/utils.js

@ -1,7 +1,7 @@
/** /**
* @license * @license
* Lodash (Custom Build) <https://lodash.com/> * Lodash (Custom Build) <https://lodash.com/>
* Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy"` * Build: `lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject"`
* Copyright JS Foundation and other contributors <https://js.foundation/> * Copyright JS Foundation and other contributors <https://js.foundation/>
* Released under MIT license <https://lodash.com/license> * Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
@ -3176,6 +3176,28 @@
}, result); }, result);
} }
/**
* This base implementation of `_.zipObject` which assigns values using `assignFunc`.
*
* @private
* @param {Array} props The property identifiers.
* @param {Array} values The property values.
* @param {Function} assignFunc The function to assign values.
* @returns {Object} Returns the new object.
*/
function baseZipObject(props, values, assignFunc) {
var index = -1,
length = props.length,
valsLength = values.length,
result = {};
while (++index < length) {
var value = index < valsLength ? values[index] : undefined;
assignFunc(result, props[index], value);
}
return result;
}
/** /**
* Casts `value` to an empty array if it's not an array like object. * Casts `value` to an empty array if it's not an array like object.
* *
@ -5552,6 +5574,26 @@
return baseSlice(array, start, end); return baseSlice(array, start, end);
} }
/**
* Creates an array of unique values, in order, from all given arrays using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
* for equality comparisons.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Array
* @param {...Array} [arrays] The arrays to inspect.
* @returns {Array} Returns the new array of combined values.
* @example
*
* _.union([2], [1, 2]);
* // => [2, 1]
*/
var union = baseRest(function(arrays) {
return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
});
/** /**
* Creates a duplicate-free version of an array, using * Creates a duplicate-free version of an array, using
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
@ -5654,6 +5696,26 @@
*/ */
var zip = baseRest(unzip); var zip = baseRest(unzip);
/**
* This method is like `_.fromPairs` except that it accepts two arrays,
* one of property identifiers and one of corresponding values.
*
* @static
* @memberOf _
* @since 0.4.0
* @category Array
* @param {Array} [props=[]] The property identifiers.
* @param {Array} [values=[]] The property values.
* @returns {Object} Returns the new object.
* @example
*
* _.zipObject(['a', 'b'], [1, 2]);
* // => { 'a': 1, 'b': 2 }
*/
function zipObject(props, values) {
return baseZipObject(props || [], values || [], assignValue);
}
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/** /**
@ -8600,21 +8662,6 @@
return baseRandom(lower, upper); return baseRandom(lower, upper);
} }
// Converts lists into objects. Pass either a single array of `[key, value]`
// pairs, or two parallel arrays of the same length -- one of keys, and one of
// the corresponding values.
function object (list, values) {
var result = {};
for (var i = 0, length = list && list.length; i < length; i++) {
if (values) {
result[list[i]] = values[i];
} else {
result[list[i][0]] = list[i][1];
}
}
return result;
}
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/** /**
@ -9106,11 +9153,13 @@
lodash.throttle = throttle; lodash.throttle = throttle;
lodash.thru = thru; lodash.thru = thru;
lodash.toArray = toArray; lodash.toArray = toArray;
lodash.union = union;
lodash.uniq = uniq; lodash.uniq = uniq;
lodash.uniqBy = uniqBy; lodash.uniqBy = uniqBy;
lodash.unzip = unzip; lodash.unzip = unzip;
lodash.values = values; lodash.values = values;
lodash.zip = zip; lodash.zip = zip;
lodash.zipObject = zipObject;
// Add aliases. // Add aliases.
lodash.extend = assignIn; lodash.extend = assignIn;
@ -9162,7 +9211,6 @@
lodash.size = size; lodash.size = size;
lodash.some = some; lodash.some = some;
lodash.uniqueId = uniqueId; lodash.uniqueId = uniqueId;
lodash.object = object;
// Add aliases. // Add aliases.
lodash.each = forEach; lodash.each = forEach;

Loading…
Cancel
Save