ts-prime
Version:
A utility library for JavaScript and Typescript.
17 lines (16 loc) • 585 B
JavaScript
import { ensureType } from "./ensureType";
import { isString } from "./guards";
import { partition } from "./partition";
import { pipe } from "./pipe";
test("partition data first", function () {
var arr = [1, 2, 3, 4, 5, 6, "1", "2"];
var type = partition(arr, isString);
ensureType(type);
expect(type).toEqual([["1", "2"], [1, 2, 3, 4, 5, 6]]);
});
test("partition data last", function () {
var arr = [1, 2, 3, 4, 5, 6, "1", "2"];
var type = pipe(arr, partition(isString));
ensureType(type);
expect(type).toEqual([["1", "2"], [1, 2, 3, 4, 5, 6]]);
});