UNPKG

ts-prime

Version:

A utility library for JavaScript and Typescript.

15 lines (14 loc) 415 B
import { splitWhen } from './splitWhen'; it('should split array', function () { expect(splitWhen([1, 2, 3, 1, 2, 3], function (x) { return x === 2; })).toEqual([ [1], [2, 3, 1, 2, 3], ]); }); it('should with no matches', function () { var n = 1232; expect(splitWhen([1, 2, 3, 1, 2, 3], function (x) { return x === n; })).toEqual([ [1, 2, 3, 1, 2, 3], [], ]); });