Skip to content

Commit

Permalink
Simplify getting coords from args (#285)
Browse files Browse the repository at this point in the history
  • Loading branch information
Connormiha authored Feb 11, 2023
1 parent da77a1b commit f1a8df9
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ export default function parse (str) {
// From https://drafts.csswg.org/css-color-4/#color-function
// If more <number>s or <percentage>s are provided than parameters that the colorspace takes, the excess <number>s at the end are ignored.
// If less <number>s or <percentage>s are provided than parameters that the colorspace takes, the missing parameters default to 0. (This is particularly convenient for multichannel printers where the additional inks are spot colors or varnishes that most colors on the page won’t use.)
let argCount = Object.keys(space.coords).length;
let coords = Array(argCount).fill(0);
coords.forEach((_, i) => coords[i] = env.parsed.args[i] || 0);
const coords = Object.keys(space.coords).map((_, i) => env.parsed.args[i] || 0);

return {spaceId: space.id, coords, alpha};
}
Expand Down

0 comments on commit f1a8df9

Please sign in to comment.