JavaScript参数的工作方式:(谓词:(值?:T,索引?:数字,列表?:T [])=>布尔值)

时间:2019-04-09 09:29:04

标签: typescript

我想在JavaScript中创建类似C#LINQ的参数。我在GitHub中找到了这个Sample,但是我需要为我的项目自定义此参数。

T defined in a class, look at the GitHub link.
Where(predicate: (value?: T, index?: number, list?: T[]) => boolean): void{
 //I want access to parameter here, but i don't know how.
 //I want 'x' & '>' & '2'
}

Usage: Where(x => x!.id > 2);

0 个答案:

没有答案