mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
type for includes
This commit is contained in:
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
import { includes } from '../index';
|
||||
export default includes;
|
||||
Vendored
+7
@@ -269,6 +269,7 @@
|
||||
/// <reference path="./es/zip.d.ts" />
|
||||
/// <reference path="./es/zipObj.d.ts" />
|
||||
/// <reference path="./es/zipWith.d.ts" />
|
||||
/// <reference path="./es/includes.d.ts" />
|
||||
|
||||
declare let R: R.Static;
|
||||
|
||||
@@ -1129,6 +1130,12 @@ declare namespace R {
|
||||
*/
|
||||
inc(n: number): number;
|
||||
|
||||
/**
|
||||
* Given a target, this function checks a list for a target and returns a boolean.
|
||||
*/
|
||||
includes<T>(target: T, list: ReadonlyArray<T>): boolean;
|
||||
includes<T>(target: T): (list: ReadonlyArray<T>) => boolean;
|
||||
|
||||
/**
|
||||
* Given a function that generates a key, turns a list of objects into an object indexing the objects
|
||||
* by the given key.
|
||||
|
||||
@@ -971,6 +971,11 @@ interface Obj {
|
||||
)(list);
|
||||
});
|
||||
|
||||
() => {
|
||||
R.includes(8, [1, 8]); // => true
|
||||
R.includes(10)([1, 2, 3, 4]); // => false
|
||||
};
|
||||
|
||||
() => {
|
||||
R.indexOf(3, [1, 2, 3, 4]); // => 2
|
||||
R.indexOf(10)([1, 2, 3, 4]); // => -1
|
||||
|
||||
Reference in New Issue
Block a user