Comparing version 4.17.0 to 4.17.1
import castPath from './_castPath.js'; | ||
import isKey from './_isKey.js'; | ||
import toKey from './_toKey.js'; | ||
@@ -14,3 +13,3 @@ | ||
function baseGet(object, path) { | ||
path = isKey(path, object) ? [path] : castPath(path); | ||
path = castPath(path, object); | ||
@@ -17,0 +16,0 @@ var index = 0, |
import apply from './_apply.js'; | ||
import castPath from './_castPath.js'; | ||
import isKey from './_isKey.js'; | ||
import last from './last.js'; | ||
@@ -19,8 +18,5 @@ import parent from './_parent.js'; | ||
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); | ||
@@ -27,0 +23,0 @@ } |
import castPath from './_castPath.js'; | ||
import isIndex from './_isIndex.js'; | ||
import isKey from './_isKey.js'; | ||
import last from './last.js'; | ||
@@ -34,4 +33,4 @@ import parent from './_parent.js'; | ||
} | ||
else if (!isKey(index, array)) { | ||
var path = castPath(index), | ||
else { | ||
var path = castPath(index, array), | ||
object = parent(array, path); | ||
@@ -43,5 +42,2 @@ | ||
} | ||
else { | ||
delete array[toKey(index)]; | ||
} | ||
} | ||
@@ -48,0 +44,0 @@ } |
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'; | ||
@@ -22,3 +21,3 @@ import toKey from './_toKey.js'; | ||
} | ||
path = isKey(path, object) ? [path] : castPath(path); | ||
path = castPath(path, object); | ||
@@ -25,0 +24,0 @@ var index = -1, |
import castPath from './_castPath.js'; | ||
import isKey from './_isKey.js'; | ||
import last from './last.js'; | ||
@@ -22,5 +21,4 @@ import parent from './_parent.js'; | ||
function baseUnset(object, path) { | ||
path = isKey(path, object) ? [path] : castPath(path); | ||
path = castPath(path, object); | ||
object = parent(object, path); | ||
var key = toKey(last(path)); | ||
@@ -27,0 +25,0 @@ return !(object != null && hasOwnProperty.call(object, key)) || delete object[key]; |
import isArray from './isArray.js'; | ||
import isKey from './_isKey.js'; | ||
import stringToPath from './_stringToPath.js'; | ||
import toString from './toString.js'; | ||
@@ -9,8 +11,12 @@ /** | ||
* @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; |
@@ -5,3 +5,2 @@ import castPath from './_castPath.js'; | ||
import isIndex from './_isIndex.js'; | ||
import isKey from './_isKey.js'; | ||
import isLength from './isLength.js'; | ||
@@ -20,3 +19,3 @@ import toKey from './_toKey.js'; | ||
function hasPath(object, path, hasFunc) { | ||
path = isKey(path, object) ? [path] : castPath(path); | ||
path = castPath(path, object); | ||
@@ -23,0 +22,0 @@ var index = -1, |
@@ -13,5 +13,5 @@ import baseGet from './_baseGet.js'; | ||
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; |
import memoizeCapped from './_memoizeCapped.js'; | ||
import toString from './toString.js'; | ||
@@ -19,4 +18,2 @@ /** Used to match property names within property paths. */ | ||
var stringToPath = memoizeCapped(function(string) { | ||
string = toString(string); | ||
var result = []; | ||
@@ -23,0 +20,0 @@ if (reLeadingDot.test(string)) { |
@@ -6,3 +6,2 @@ import apply from './_apply.js'; | ||
import isArrayLike from './isArrayLike.js'; | ||
import isKey from './_isKey.js'; | ||
@@ -35,8 +34,6 @@ /** | ||
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); | ||
}); | ||
@@ -43,0 +40,0 @@ return result; |
@@ -48,3 +48,3 @@ /** | ||
/** Used as the semantic version number. */ | ||
var VERSION = '4.17.0'; | ||
var VERSION = '4.17.1'; | ||
@@ -51,0 +51,0 @@ /** Used to compose bitmasks for function metadata. */ |
11
omit.js
@@ -0,3 +1,5 @@ | ||
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'; | ||
@@ -37,4 +39,11 @@ import flatRest from './_flatRest.js'; | ||
} | ||
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); | ||
@@ -41,0 +50,0 @@ var length = paths.length; |
{ | ||
"name": "lodash-es", | ||
"version": "4.17.0", | ||
"version": "4.17.1", | ||
"description": "Lodash exported as ES modules.", | ||
@@ -5,0 +5,0 @@ "keywords": "es6, modules, stdlib, util", |
@@ -1,5 +0,3 @@ | ||
import arrayMap from './_arrayMap.js'; | ||
import basePick from './_basePick.js'; | ||
import flatRest from './_flatRest.js'; | ||
import toKey from './_toKey.js'; | ||
@@ -24,5 +22,5 @@ /** | ||
var pick = flatRest(function(object, paths) { | ||
return object == null ? {} : basePick(object, arrayMap(paths, toKey)); | ||
return object == null ? {} : basePick(object, paths); | ||
}); | ||
export default pick; |
@@ -0,1 +1,2 @@ | ||
import arrayMap from './_arrayMap.js'; | ||
import baseIteratee from './_baseIteratee.js'; | ||
@@ -24,5 +25,14 @@ import basePickBy from './_basePickBy.js'; | ||
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; |
@@ -1,2 +0,2 @@ | ||
# lodash-es v4.17.0 | ||
# lodash-es v4.17.1 | ||
@@ -10,2 +10,2 @@ The [Lodash](https://lodash.com/) library exported as [ES](http://www.ecma-international.org/ecma-262/6.0/) modules. | ||
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. |
import castPath from './_castPath.js'; | ||
import isFunction from './isFunction.js'; | ||
import isKey from './_isKey.js'; | ||
import toKey from './_toKey.js'; | ||
@@ -36,3 +35,3 @@ | ||
function result(object, path, defaultValue) { | ||
path = isKey(path, object) ? [path] : castPath(path); | ||
path = castPath(path, object); | ||
@@ -39,0 +38,0 @@ var index = -1, |
@@ -7,2 +7,3 @@ import arrayMap from './_arrayMap.js'; | ||
import toKey from './_toKey.js'; | ||
import toString from './toString.js'; | ||
@@ -30,5 +31,5 @@ /** | ||
} | ||
return isSymbol(value) ? [value] : copyArray(stringToPath(value)); | ||
return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value))); | ||
} | ||
export default toPath; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19499
625460