refactor(lib): extract fillArray utility

This commit is contained in:
Eric Liu 2019-12-23 09:47:34 -08:00
commit f3c702947c
7 changed files with 23 additions and 10 deletions

View file

@ -0,0 +1,7 @@
import { fillArray } from '../fill-array';
test('fillArray', () => {
expect(fillArray(0)).toEqual([]);
expect(fillArray(2)).toEqual([0, 1]);
expect(fillArray(3)).toEqual([0, 1, 2]);
});

5
src/lib/fill-array.js Normal file
View file

@ -0,0 +1,5 @@
function fillArray(length) {
return Array.from({ length }, (_, i) => i);
}
export { fillArray };

View file

@ -1,2 +1,3 @@
export { cx } from './cx';
export { css } from './css';
export { fillArray } from './fill-array';