Bump to v4.17.1.

This commit is contained in:
John-David Dalton
2016-11-14 20:56:46 -08:00
parent b1ff59b3ea
commit 95f47b6d19
18 changed files with 48 additions and 44 deletions

View File

@@ -1,4 +1,4 @@
# lodash-es v4.17.0
# lodash-es v4.17.1
The [Lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules.
@@ -7,4 +7,4 @@ Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli):
$ lodash modularize exports=es -o ./
```
See the [package source](https://github.com/lodash/lodash/tree/4.17.0-es) for more details.
See the [package source](https://github.com/lodash/lodash/tree/4.17.1-es) for more details.

View File

@@ -1,5 +1,4 @@
import castPath from './_castPath.js';
import isKey from './_isKey.js';
import toKey from './_toKey.js';
/**
@@ -11,7 +10,7 @@ import toKey from './_toKey.js';
* @returns {*} Returns the resolved value.
*/
function baseGet(object, path) {
path = isKey(path, object) ? [path] : castPath(path);
path = castPath(path, object);
var index = 0,
length = path.length;

View File

@@ -1,6 +1,5 @@
import apply from './_apply.js';
import castPath from './_castPath.js';
import isKey from './_isKey.js';
import last from './last.js';
import parent from './_parent.js';
import toKey from './_toKey.js';
@@ -16,12 +15,9 @@ import toKey from './_toKey.js';
* @returns {*} Returns the result of the invoked method.
*/
function baseInvoke(object, path, args) {
if (!isKey(path, object)) {
path = castPath(path);
object = parent(object, path);
path = last(path);
}
var func = object == null ? object : object[toKey(path)];
path = castPath(path, object);
object = parent(object, path);
var func = object == null ? object : object[toKey(last(path))];
return func == null ? undefined : apply(func, object, args);
}

View File

@@ -1,6 +1,5 @@
import castPath from './_castPath.js';
import isIndex from './_isIndex.js';
import isKey from './_isKey.js';
import last from './last.js';
import parent from './_parent.js';
import toKey from './_toKey.js';
@@ -31,17 +30,14 @@ function basePullAt(array, indexes) {
if (isIndex(index)) {
splice.call(array, index, 1);
}
else if (!isKey(index, array)) {
var path = castPath(index),
else {
var path = castPath(index, array),
object = parent(array, path);
if (object != null) {
delete object[toKey(last(path))];
}
}
else {
delete array[toKey(index)];
}
}
}
return array;

View File

@@ -1,7 +1,6 @@
import assignValue from './_assignValue.js';
import castPath from './_castPath.js';
import isIndex from './_isIndex.js';
import isKey from './_isKey.js';
import isObject from './isObject.js';
import toKey from './_toKey.js';
@@ -19,7 +18,7 @@ function baseSet(object, path, value, customizer) {
if (!isObject(object)) {
return object;
}
path = isKey(path, object) ? [path] : castPath(path);
path = castPath(path, object);
var index = -1,
length = path.length,

View File

@@ -1,5 +1,4 @@
import castPath from './_castPath.js';
import isKey from './_isKey.js';
import last from './last.js';
import parent from './_parent.js';
import toKey from './_toKey.js';
@@ -19,9 +18,8 @@ var hasOwnProperty = objectProto.hasOwnProperty;
* @returns {boolean} Returns `true` if the property is deleted, else `false`.
*/
function baseUnset(object, path) {
path = isKey(path, object) ? [path] : castPath(path);
path = castPath(path, object);
object = parent(object, path);
var key = toKey(last(path));
return !(object != null && hasOwnProperty.call(object, key)) || delete object[key];
}

View File

@@ -1,15 +1,21 @@
import isArray from './isArray.js';
import isKey from './_isKey.js';
import stringToPath from './_stringToPath.js';
import toString from './toString.js';
/**
* Casts `value` to a path array if it's not one.
*
* @private
* @param {*} value The value to inspect.
* @param {Object} [object] The object to query keys on.
* @returns {Array} Returns the cast property path array.
*/
function castPath(value) {
return isArray(value) ? value : stringToPath(value);
function castPath(value, object) {
if (isArray(value)) {
return value;
}
return isKey(value, object) ? [value] : stringToPath(toString(value));
}
export default castPath;

View File

@@ -2,7 +2,6 @@ import castPath from './_castPath.js';
import isArguments from './isArguments.js';
import isArray from './isArray.js';
import isIndex from './_isIndex.js';
import isKey from './_isKey.js';
import isLength from './isLength.js';
import toKey from './_toKey.js';
@@ -16,7 +15,7 @@ import toKey from './_toKey.js';
* @returns {boolean} Returns `true` if `path` exists, else `false`.
*/
function hasPath(object, path, hasFunc) {
path = isKey(path, object) ? [path] : castPath(path);
path = castPath(path, object);
var index = -1,
length = path.length,

View File

@@ -10,7 +10,7 @@ import baseSlice from './_baseSlice.js';
* @returns {*} Returns the parent value.
*/
function parent(object, path) {
return path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
}
export default parent;

View File

@@ -1,5 +1,4 @@
import memoizeCapped from './_memoizeCapped.js';
import toString from './toString.js';
/** Used to match property names within property paths. */
var reLeadingDot = /^\./,
@@ -16,8 +15,6 @@ var reEscapeChar = /\\(\\)?/g;
* @returns {Array} Returns the property path array.
*/
var stringToPath = memoizeCapped(function(string) {
string = toString(string);
var result = [];
if (reLeadingDot.test(string)) {
result.push('');

View File

@@ -3,7 +3,6 @@ import baseEach from './_baseEach.js';
import baseInvoke from './_baseInvoke.js';
import baseRest from './_baseRest.js';
import isArrayLike from './isArrayLike.js';
import isKey from './_isKey.js';
/**
* Invokes the method at `path` of each element in `collection`, returning
@@ -31,12 +30,10 @@ import isKey from './_isKey.js';
var invokeMap = baseRest(function(collection, path, args) {
var index = -1,
isFunc = typeof path == 'function',
isProp = isKey(path),
result = isArrayLike(collection) ? Array(collection.length) : [];
baseEach(collection, function(value) {
var func = isFunc ? path : ((isProp && value != null) ? value[path] : undefined);
result[++index] = func ? apply(func, value, args) : baseInvoke(value, path, args);
result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
});
return result;
});

View File

@@ -45,7 +45,7 @@ import toInteger from './toInteger.js';
import lodash from './wrapperLodash.js';
/** Used as the semantic version number. */
var VERSION = '4.17.0';
var VERSION = '4.17.1';
/** Used to compose bitmasks for function metadata. */
var WRAP_BIND_KEY_FLAG = 2;

11
omit.js
View File

@@ -1,5 +1,7 @@
import arrayMap from './_arrayMap.js';
import baseClone from './_baseClone.js';
import baseUnset from './_baseUnset.js';
import castPath from './_castPath.js';
import copyObject from './_copyObject.js';
import flatRest from './_flatRest.js';
import getAllKeysIn from './_getAllKeysIn.js';
@@ -34,8 +36,15 @@ var omit = flatRest(function(object, paths) {
if (object == null) {
return result;
}
var bitmask = CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG;
paths = arrayMap(paths, function(path) {
path = castPath(path, object);
bitmask |= (path.length > 1 ? CLONE_DEEP_FLAG : 0);
return path;
});
copyObject(object, getAllKeysIn(object), result);
result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG);
result = baseClone(result, bitmask);
var length = paths.length;
while (length--) {

View File

@@ -1,6 +1,6 @@
{
"name": "lodash-es",
"version": "4.17.0",
"version": "4.17.1",
"description": "Lodash exported as ES modules.",
"keywords": "es6, modules, stdlib, util",
"homepage": "https://lodash.com/custom-builds",

View File

@@ -1,7 +1,5 @@
import arrayMap from './_arrayMap.js';
import basePick from './_basePick.js';
import flatRest from './_flatRest.js';
import toKey from './_toKey.js';
/**
* Creates an object composed of the picked `object` properties.
@@ -21,7 +19,7 @@ import toKey from './_toKey.js';
* // => { 'a': 1, 'c': 3 }
*/
var pick = flatRest(function(object, paths) {
return object == null ? {} : basePick(object, arrayMap(paths, toKey));
return object == null ? {} : basePick(object, paths);
});
export default pick;

View File

@@ -1,3 +1,4 @@
import arrayMap from './_arrayMap.js';
import baseIteratee from './_baseIteratee.js';
import basePickBy from './_basePickBy.js';
import getAllKeysIn from './_getAllKeysIn.js';
@@ -21,7 +22,16 @@ import getAllKeysIn from './_getAllKeysIn.js';
* // => { 'a': 1, 'c': 3 }
*/
function pickBy(object, predicate) {
return object == null ? {} : basePickBy(object, getAllKeysIn(object), baseIteratee(predicate));
if (object == null) {
return {};
}
var props = arrayMap(getAllKeysIn(object), function(prop) {
return [prop];
});
predicate = baseIteratee(predicate);
return basePickBy(object, props, function(value, path) {
return predicate(value, path[0]);
});
}
export default pickBy;

View File

@@ -1,6 +1,5 @@
import castPath from './_castPath.js';
import isFunction from './isFunction.js';
import isKey from './_isKey.js';
import toKey from './_toKey.js';
/**
@@ -33,7 +32,7 @@ import toKey from './_toKey.js';
* // => 'default'
*/
function result(object, path, defaultValue) {
path = isKey(path, object) ? [path] : castPath(path);
path = castPath(path, object);
var index = -1,
length = path.length;

View File

@@ -4,6 +4,7 @@ import isArray from './isArray.js';
import isSymbol from './isSymbol.js';
import stringToPath from './_stringToPath.js';
import toKey from './_toKey.js';
import toString from './toString.js';
/**
* Converts `value` to a property path array.
@@ -26,7 +27,7 @@ function toPath(value) {
if (isArray(value)) {
return arrayMap(value, toKey);
}
return isSymbol(value) ? [value] : copyArray(stringToPath(value));
return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
}
export default toPath;