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

@ -8,10 +8,10 @@
export let headers = [];
export let style = undefined;
import { cx } from '../../lib';
import { cx, fillArray } from '../../lib';
const rows = Array.from({ length: rowCount - 1 }, (_, i) => i);
const columns = Array.from({ length: columnCount }, (_, i) => i);
const rows = fillArray(rowCount - 1);
const columns = fillArray(columnCount);
const _headers =
headers[0] === Object(headers[0]) && !Array.isArray(headers[0])
? headers.map(({ header }) => header)