contains
优质
小牛编辑
141浏览
2023-12-01
A version of Sequence#contains which returns an AsyncHandle.
Signature
AsyncSequence.contains = function(value) { /*...*/ }
AsyncSequence.contains = function contains(value) { var found = false; var handle = this.each(function(e) { if (e === value) { found = true; return false; } }); return handle.then(function() { return found; }); }
Name | Type(s) | Description |
---|---|---|
value | * | The element to search for in the sequence. |
returns | AsyncHandle | An AsyncHandle (promise) which resolves to either |