Skip to content

omitBy

js
_.omitBy(object, [predicate=_.identity])

选项对象。此方法创建一个由 object 的自身和继承的可枚举字符串键属性组成的对象,predicate 不会返回真值。使用两个参数调用谓词:(value, key)。

¥The opposite of _.pickBy; this method creates an object composed of the own and inherited enumerable string keyed properties of object that predicate doesn't return truthy for. The predicate is invoked with two arguments: (value, key).

新增于

¥Since

4.0.0

参数

¥Arguments

  1. object (对象):源对象。

    ¥object (Object): The source object.

  2. [predicate=_.identity] (函数):每个属性调用的函数。

    ¥[predicate=_.identity] (Function): The function invoked per property.

返回

¥Returns

(对象):返回新对象。

¥(Object): Returns the new object.

示例

¥Example

js
var object = { 'a': 1, 'b': '2', 'c': 3 };

_.omitBy(object, _.isNumber);
// => { 'b': '2' }

Lodash v4.17 中文网 - 粤ICP备13048890号