findWhere
优质
小牛编辑
134浏览
2023-12-01
Returns the first element in this sequence with property names and values matching those of the specified object.
Signature
Sequence.findWhere = function(properties) { /*...*/ }
Sequence.findWhere = function findWhere(properties) { return this.where(properties).first(); }
Name | Type(s) | Description |
---|---|---|
properties | Object | The properties that should be found on some element in this sequence. |
returns | * | The found element, or |
Examples
var words = ["foo", "bar"]; Lazy(words).findWhere({ 0: "f" }); // => "foo" Lazy(words).findWhere({ 0: "z" }); // => undefined