feat(core): add the find method to QueryList

This commit is contained in:
Thomas Shafer
2016-10-26 16:14:34 -07:00
committed by vsavkin
parent a318b57257
commit 7c16ef942e
3 changed files with 17 additions and 0 deletions

View File

@ -70,6 +70,16 @@ export function main() {
expect(queryList.filter((x: string, i: number) => i == 0)).toEqual(['one']);
});
it('should support find', () => {
queryList.reset(['one', 'two']);
expect(queryList.find((x: string) => x == 'two')).toEqual('two');
});
it('should support find with index', () => {
queryList.reset(['one', 'two']);
expect(queryList.find((x: string, i: number) => i == 1)).toEqual('two');
});
it('should support reduce', () => {
queryList.reset(['one', 'two']);
expect(queryList.reduce((a: string, x: string) => a + x, 'start:')).toEqual('start:onetwo');