pick
优质
小牛编辑
132浏览
2023-12-01
Creates an ObjectLikeSequence consisting of the key/value pairs from this sequence whose keys are included in the given array of property names.
Signature
ObjectLikeSequence.pick = function(properties) { /*...*/ }
ObjectLikeSequence.pick = function pick(properties) { return new PickSequence(this, properties); }
Name | Type(s) | Description |
---|---|---|
properties | Array.<string> | An array of the properties to "pick" from this sequence. |
returns | ObjectLikeSequence | The new sequence. |
Examples
var players = { "who": "first", "what": "second", "i don't know": "third" }; Lazy(players).pick(["who", "what"]) // sequence: { who: "first", what: "second" }