Merge pull request #397 from ZerothLaw/Issue275/ArrayFind

Issue #275: Added Array.prototype.find binding
This commit is contained in:
Sendil Kumar N
2018-07-06 09:22:46 +02:00
committed by GitHub
2 changed files with 45 additions and 0 deletions

View File

@ -141,6 +141,13 @@ extern "C" {
#[wasm_bindgen(method)]
pub fn filter(this: &Array, predicate: &mut FnMut(JsValue, u32, Array) -> bool) -> Array;
/// The `find()` method returns the value of the first element in the array that satisfies
/// the provided testing function. Otherwise `undefined` is returned.
///
/// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find
#[wasm_bindgen(method)]
pub fn find(this: &Array, predicate: &mut FnMut(JsValue, u32, Array) -> bool) -> JsValue;
/// The includes() method determines whether an array includes a certain
/// element, returning true or false as appropriate.
///