mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-16 02:41:05 +00:00
refactor(lib): extract fillArray utility
This commit is contained in:
parent
06e02c3dc3
commit
f3c702947c
7 changed files with 23 additions and 10 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue