mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 02:47:50 +00:00
Clarify _.pick and _.omit docs. [ci skip] [closes #826]
This commit is contained in:
39
lodash.js
39
lodash.js
@@ -8571,12 +8571,12 @@
|
|||||||
var merge = createAssigner(baseMerge);
|
var merge = createAssigner(baseMerge);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a shallow clone of `object` excluding the specified properties.
|
* The opposite of `_.pick`; this method creates an object composed of the
|
||||||
* Property names may be specified as individual arguments or as arrays of
|
* own and inherited enumerable properties of `object` that are not omitted.
|
||||||
* property names. If `predicate` is provided it is invoked for each property
|
* Property names may be specified as individual arguments or as arrays of property
|
||||||
* of `object` omitting the properties `predicate` returns truthy for. The
|
* names. If `predicate` is provided it is invoked for each property of `object`
|
||||||
* predicate is bound to `thisArg` and invoked with three arguments;
|
* omitting the properties `predicate` returns truthy for. The predicate is
|
||||||
* (value, key, object).
|
* bound to `thisArg` and invoked with three arguments; (value, key, object).
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
@@ -8589,12 +8589,12 @@
|
|||||||
* @returns {Object} Returns the new object.
|
* @returns {Object} Returns the new object.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.omit({ 'user': 'fred', 'age': 40 }, 'age');
|
* var object = { 'user': 'fred', 'age': 40 };
|
||||||
|
*
|
||||||
|
* _.omit(object, 'age');
|
||||||
* // => { 'user': 'fred' }
|
* // => { 'user': 'fred' }
|
||||||
*
|
*
|
||||||
* _.omit({ 'user': 'fred', 'age': 40 }, function(value) {
|
* _.omit(object, _.isNumber);
|
||||||
* return typeof value == 'number';
|
|
||||||
* });
|
|
||||||
* // => { 'user': 'fred' }
|
* // => { 'user': 'fred' }
|
||||||
*/
|
*/
|
||||||
function omit(object, predicate, thisArg) {
|
function omit(object, predicate, thisArg) {
|
||||||
@@ -8639,12 +8639,11 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a shallow clone of `object` composed of the specified properties.
|
* Creates an object composed of the picked `object` properties. Property
|
||||||
* Property names may be specified as individual arguments or as arrays of
|
* names may be specified as individual arguments or as arrays of property
|
||||||
* property names. If `predicate` is provided it is invoked for each property
|
* names. If `predicate` is provided it is invoked for each property of `object`
|
||||||
* of `object` picking the properties `predicate` returns truthy for. The
|
* picking the properties `predicate` returns truthy for. The predicate is
|
||||||
* predicate is bound to `thisArg` and invoked with three arguments;
|
* bound to `thisArg` and invoked with three arguments; (value, key, object).
|
||||||
* (value, key, object).
|
|
||||||
*
|
*
|
||||||
* @static
|
* @static
|
||||||
* @memberOf _
|
* @memberOf _
|
||||||
@@ -8657,12 +8656,12 @@
|
|||||||
* @returns {Object} Returns the new object.
|
* @returns {Object} Returns the new object.
|
||||||
* @example
|
* @example
|
||||||
*
|
*
|
||||||
* _.pick({ 'user': 'fred', '_userid': 'fred1' }, 'user');
|
* var object = { 'user': 'fred', 'age': 40 };
|
||||||
|
*
|
||||||
|
* _.pick(object, 'user');
|
||||||
* // => { 'user': 'fred' }
|
* // => { 'user': 'fred' }
|
||||||
*
|
*
|
||||||
* _.pick({ 'user': 'fred', '_userid': 'fred1' }, function(value, key) {
|
* _.pick(object, _.isString);
|
||||||
* return key.charAt(0) != '_';
|
|
||||||
* });
|
|
||||||
* // => { 'user': 'fred' }
|
* // => { 'user': 'fred' }
|
||||||
*/
|
*/
|
||||||
function pick(object, predicate, thisArg) {
|
function pick(object, predicate, thisArg) {
|
||||||
|
|||||||
Reference in New Issue
Block a user