Skip to content

omit

js
_.omit(object, [paths])

选项对象。此方法创建一个由未省略的 object 的自身和继承的可枚举属性路径组成的对象。

¥The opposite of _.pick; this method creates an object composed of the own and inherited enumerable property paths of object that are not omitted.

注意:此方法比 _.pick 慢得多。

¥Note: This method is considerably slower than _.pick.

新增于

¥Since

0.1.0

参数

¥Arguments

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

    ¥object (Object): The source object.

  2. [paths] (...(字符串|字符串[])):要省略的属性路径。

    ¥[paths] (...(string|string[])): The property paths to omit.

返回

¥Returns

(对象):返回新对象。

¥(Object): Returns the new object.

示例

¥Example

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

_.omit(object, ['a', 'c']);
// => { 'b': '2' }

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