mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 04:01:52 +00:00
Add array-find-index (#9151)
This commit is contained in:
committed by
Masahiro Wakame
parent
7b7b8af73b
commit
3063f61d0e
@@ -0,0 +1,10 @@
|
||||
/// <reference path="./array-find-index.d.ts" />
|
||||
|
||||
import * as arrayFindIndex from 'array-find-index';
|
||||
|
||||
arrayFindIndex(['rainbow', 'unicorn', 'pony'], x => x === 'unicorn');
|
||||
|
||||
const ctx = {foo: 'rainbow'};
|
||||
arrayFindIndex(['rainbow', 'unicorn', 'pony'], function (x) {
|
||||
return x === this.foo;
|
||||
}, ctx);
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// Type definitions for array-find-index
|
||||
// Project: https://github.com/sindresorhus/array-find-index
|
||||
// Definitions by: Sam Verschueren <https://github.com/samverschueren>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "array-find-index" {
|
||||
type Predicate = (element: any, index: number, array: any[]) => boolean;
|
||||
|
||||
function arrayFindIndex(arr: any[], predicate: Predicate): number;
|
||||
function arrayFindIndex(arr: any[], predicate: Predicate, ctx: any): number;
|
||||
namespace arrayFindIndex {}
|
||||
export = arrayFindIndex;
|
||||
}
|
||||
Reference in New Issue
Block a user