当前位置: 首页 > 文档资料 > Lazy.js 英文文档 >

omit

优质
小牛编辑
138浏览
2023-12-01

Creates an ObjectLikeSequence consisting of the key/value pairs from this sequence excluding those with the specified keys. Non-string keys are effectively ignored.

Signature

ObjectLikeSequence.omit = function(properties) { /*...*/ }
ObjectLikeSequence.omit = function omit(properties) {
  return new OmitSequence(this, properties);
}
NameType(s)Description
propertiesArray

An array of the properties to omit from this sequence.

returnsObjectLikeSequence

The new sequence.

Examples

var players = {
  "who": "first",
  "what": "second",
  "i don't know": "third"
};

Lazy(players).omit(["who", "what"]) // sequence: { "i don't know": "third" }

// Example to show handling of non-string keys
Lazy({1: 2, true: false}).omit([1, true]) // sequence: { "1": 2, "true": false }