@mmit/tools
v0.1.11
Published
Mix of various, unspecified, TS-tools
Downloads
16
Readme
Various TS-Tools
Noting spectacular here...
range
test('Number of iterations', () => {
let iterations = 0;
range(0, 10).forEach(() => iterations++);
expect(iterations).toBe(11);
});
loop
test('loop with values', () => {
let iterations = 0;
let sum = 0;
loop(1, 3).through((value: number) => {
sum += value;
iterations++;
});
expect(iterations).toBe(3);
expect(sum).toBe(6);
iterations = 0;
sum = 0;
loop(3, 1).through((value: number) => {
sum += value;
iterations++;
});
expect(iterations).toBe(3);
expect(sum).toBe(6);
});