Issue #275: Added Array.prototype.find binding

This commit is contained in:
Tyler Laing
2018-07-05 15:05:23 -07:00
parent 52a00d5e16
commit d29b17f158
2 changed files with 46 additions and 0 deletions

View File

@ -134,6 +134,7 @@ extern "C" {
#[wasm_bindgen(method)]
pub fn fill(this: &Array, value: JsValue, start: u32, end: u32) -> Array;
/// The `filter()` method creates a new array with all elements that pass the
/// test implemented by the provided function.
///
@ -141,6 +142,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.
///