lodash.omit
Advanced tools
Comparing version 4.1.1 to 4.1.2
231
index.js
/** | ||
* lodash 4.1.1 (Custom Build) <https://lodash.com/> | ||
* lodash 4.1.2 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modularize exports="npm" -o ./` | ||
* Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/> | ||
* Copyright jQuery Foundation and other contributors <https://jquery.org/> | ||
* Released under MIT license <https://lodash.com/license> | ||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> | ||
* Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
* Available under MIT license <https://lodash.com/license> | ||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors | ||
*/ | ||
@@ -14,2 +14,5 @@ var baseDifference = require('lodash._basedifference'), | ||
/** `Object#toString` result references. */ | ||
var symbolTag = '[object Symbol]'; | ||
/** | ||
@@ -36,2 +39,21 @@ * A specialized version of `_.map` for arrays without support for iteratee | ||
/** | ||
* Appends the elements of `values` to `array`. | ||
* | ||
* @private | ||
* @param {Array} array The array to modify. | ||
* @param {Array} values The values to append. | ||
* @returns {Array} Returns `array`. | ||
*/ | ||
function arrayPush(array, values) { | ||
var index = -1, | ||
length = values.length, | ||
offset = array.length; | ||
while (++index < length) { | ||
array[offset + index] = values[index]; | ||
} | ||
return array; | ||
} | ||
/** | ||
* A specialized version of `_.reduce` for arrays without support for | ||
@@ -44,3 +66,4 @@ * iteratee shorthands. | ||
* @param {*} [accumulator] The initial value. | ||
* @param {boolean} [initAccum] Specify using the first element of `array` as the initial value. | ||
* @param {boolean} [initAccum] Specify using the first element of `array` as | ||
* the initial value. | ||
* @returns {*} Returns the accumulated value. | ||
@@ -61,9 +84,53 @@ */ | ||
/** Used for built-in method references. */ | ||
var objectProto = Object.prototype; | ||
/** | ||
* Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) | ||
* of values. | ||
*/ | ||
var objectToString = objectProto.toString; | ||
/** Built-in value references. */ | ||
var getOwnPropertySymbols = Object.getOwnPropertySymbols; | ||
/* Built-in method references for those with the same name as other `lodash` methods. */ | ||
var nativeGetPrototype = Object.getPrototypeOf; | ||
/** | ||
* Casts `value` to a string if it's not a string or symbol. | ||
* | ||
* @private | ||
* @param {*} value The value to inspect. | ||
* @returns {string|symbol} Returns the cast key. | ||
*/ | ||
function baseCastKey(key) { | ||
return (typeof key == 'string' || isSymbol(key)) ? key : (key + ''); | ||
} | ||
/** | ||
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses | ||
* `keysFunc` and `symbolsFunc` to get the enumerable property names and | ||
* symbols of `object`. | ||
* | ||
* @private | ||
* @param {Object} object The object to query. | ||
* @param {Function} keysFunc The function to get the keys of `object`. | ||
* @param {Function} symbolsFunc The function to get the symbols of `object`. | ||
* @returns {Array} Returns the array of property names and symbols. | ||
*/ | ||
function baseGetAllKeys(object, keysFunc, symbolsFunc) { | ||
var result = keysFunc(object); | ||
return isArray(object) | ||
? result | ||
: arrayPush(result, symbolsFunc(object)); | ||
} | ||
/** | ||
* The base implementation of `_.pick` without support for individual | ||
* property names. | ||
* property identifiers. | ||
* | ||
* @private | ||
* @param {Object} object The source object. | ||
* @param {string[]} props The property names to pick. | ||
* @param {string[]} props The property identifiers to pick. | ||
* @returns {Object} Returns the new object. | ||
@@ -82,11 +149,151 @@ */ | ||
/** | ||
* Creates an array of own and inherited enumerable property names and | ||
* symbols of `object`. | ||
* | ||
* @private | ||
* @param {Object} object The object to query. | ||
* @returns {Array} Returns the array of property names and symbols. | ||
*/ | ||
function getAllKeysIn(object) { | ||
return baseGetAllKeys(object, keysIn, getSymbolsIn); | ||
} | ||
/** | ||
* Gets the `[[Prototype]]` of `value`. | ||
* | ||
* @private | ||
* @param {*} value The value to query. | ||
* @returns {null|Object} Returns the `[[Prototype]]`. | ||
*/ | ||
function getPrototype(value) { | ||
return nativeGetPrototype(Object(value)); | ||
} | ||
/** | ||
* Creates an array of the own enumerable symbol properties of `object`. | ||
* | ||
* @private | ||
* @param {Object} object The object to query. | ||
* @returns {Array} Returns the array of symbols. | ||
*/ | ||
function getSymbols(object) { | ||
// Coerce `object` to an object to avoid non-object errors in V8. | ||
// See https://bugs.chromium.org/p/v8/issues/detail?id=3443 for more details. | ||
return getOwnPropertySymbols(Object(object)); | ||
} | ||
// Fallback for IE < 11. | ||
if (!getOwnPropertySymbols) { | ||
getSymbols = function() { | ||
return []; | ||
}; | ||
} | ||
/** | ||
* Creates an array of the own and inherited enumerable symbol properties | ||
* of `object`. | ||
* | ||
* @private | ||
* @param {Object} object The object to query. | ||
* @returns {Array} Returns the array of symbols. | ||
*/ | ||
var getSymbolsIn = !getOwnPropertySymbols ? getSymbols : function(object) { | ||
var result = []; | ||
while (object) { | ||
arrayPush(result, getSymbols(object)); | ||
object = getPrototype(object); | ||
} | ||
return result; | ||
}; | ||
/** | ||
* Checks if `value` is classified as an `Array` object. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 0.1.0 | ||
* @type {Function} | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is correctly classified, | ||
* else `false`. | ||
* @example | ||
* | ||
* _.isArray([1, 2, 3]); | ||
* // => true | ||
* | ||
* _.isArray(document.body.children); | ||
* // => false | ||
* | ||
* _.isArray('abc'); | ||
* // => false | ||
* | ||
* _.isArray(_.noop); | ||
* // => false | ||
*/ | ||
var isArray = Array.isArray; | ||
/** | ||
* Checks if `value` is object-like. A value is object-like if it's not `null` | ||
* and has a `typeof` result of "object". | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 4.0.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is object-like, else `false`. | ||
* @example | ||
* | ||
* _.isObjectLike({}); | ||
* // => true | ||
* | ||
* _.isObjectLike([1, 2, 3]); | ||
* // => true | ||
* | ||
* _.isObjectLike(_.noop); | ||
* // => false | ||
* | ||
* _.isObjectLike(null); | ||
* // => false | ||
*/ | ||
function isObjectLike(value) { | ||
return !!value && typeof value == 'object'; | ||
} | ||
/** | ||
* Checks if `value` is classified as a `Symbol` primitive or object. | ||
* | ||
* @static | ||
* @memberOf _ | ||
* @since 4.0.0 | ||
* @category Lang | ||
* @param {*} value The value to check. | ||
* @returns {boolean} Returns `true` if `value` is correctly classified, | ||
* else `false`. | ||
* @example | ||
* | ||
* _.isSymbol(Symbol.iterator); | ||
* // => true | ||
* | ||
* _.isSymbol('abc'); | ||
* // => false | ||
*/ | ||
function isSymbol(value) { | ||
return typeof value == 'symbol' || | ||
(isObjectLike(value) && objectToString.call(value) == symbolTag); | ||
} | ||
/** | ||
* The opposite of `_.pick`; this method creates an object composed of the | ||
* own and inherited enumerable properties of `object` that are not omitted. | ||
* own and inherited enumerable string keyed properties of `object` that are | ||
* not omitted. | ||
* | ||
* @static | ||
* @since 0.1.0 | ||
* @memberOf _ | ||
* @category Object | ||
* @param {Object} object The source object. | ||
* @param {...(string|string[])} [props] The property names to omit, specified | ||
* individually or in arrays. | ||
* @param {...(string|string[])} [props] The property identifiers to omit, | ||
* specified individually or in arrays. | ||
* @returns {Object} Returns the new object. | ||
@@ -104,6 +311,6 @@ * @example | ||
} | ||
props = arrayMap(baseFlatten(props, 1), String); | ||
return basePick(object, baseDifference(keysIn(object), props)); | ||
props = arrayMap(baseFlatten(props, 1), baseCastKey); | ||
return basePick(object, baseDifference(getAllKeysIn(object), props)); | ||
}); | ||
module.exports = omit; |
{ | ||
"name": "lodash.omit", | ||
"version": "4.1.1", | ||
"version": "4.1.2", | ||
"description": "The lodash method `_.omit` exported as a module.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/", |
@@ -1,2 +0,2 @@ | ||
# lodash.omit v4.1.1 | ||
# lodash.omit v4.1.2 | ||
@@ -18,2 +18,2 @@ The [lodash](https://lodash.com/) method `_.omit` exported as a [Node.js](https://nodejs.org/) module. | ||
See the [documentation](https://lodash.com/docs#omit) or [package source](https://github.com/lodash/lodash/blob/4.1.1-npm-packages/lodash.omit) for more details. | ||
See the [documentation](https://lodash.com/docs#omit) or [package source](https://github.com/lodash/lodash/blob/4.1.2-npm-packages/lodash.omit) for more details. |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license
Found 1 instance in 1 package
11384
286
1
80
1