mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-21 02:04:26 +08:00
code refactor
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
export function getColorsInRows(allColorInfos, itemPerRow) {
|
||||
const ret = [];
|
||||
let rowCount = -1;
|
||||
|
||||
for (let i = 0; i < allColorInfos.length; i++) {
|
||||
if (i % itemPerRow === 0) {
|
||||
ret[++rowCount] = [];
|
||||
}
|
||||
|
||||
ret[rowCount].push({
|
||||
color: allColorInfos[i]
|
||||
});
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
Reference in New Issue
Block a user