axax
Version:
A library of async iterator extensions for JavaScript including ```map```, ```reduce```, ```filter```, ```flatMap```, ```pipe``` and [more](https://github.com/jamiemccrindle/axax/blob/master/docs/API.md#functions).
14 lines (13 loc) • 545 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const filter_1 = require("../filter");
const of_1 = require("../of");
const toArray_1 = require("../toArray");
test("filter", async () => {
const result = await toArray_1.toArray(filter_1.filter((value) => value % 2 === 0)(of_1.of(1, 2, 3, 4, 5, 6)));
expect(result).toEqual([2, 4, 6]);
});
test("async filter", async () => {
const result = await toArray_1.toArray(filter_1.filter(async () => false)(of_1.of(1, 2, 3)));
expect(result).toEqual([]);
});