Skip to content

Commit

Permalink
perf: remove intermediary const declaration in from functions
Browse files Browse the repository at this point in the history
  • Loading branch information
dmnsgn committed Feb 25, 2022
1 parent b0ee96b commit b20ffd4
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,7 @@ export function setRGB(color, r, g, b, a = 1) {
* @return {color}
*/
export function fromRGBBytes(bytes) {
const color = create();
return setRGBBytes(color, ...bytes);
return setRGBBytes(create(), ...bytes);
}

/**
Expand Down Expand Up @@ -147,9 +146,7 @@ export function getRGBBytes(color, out = [0, 0, 0]) {
* @return {color}
*/
export function fromHSV(h, s, v, a) {
const color = create();
setHSV(color, h, s, v, a);
return color;
return setHSV(create(), h, s, v, a);
}

/**
Expand Down Expand Up @@ -251,9 +248,7 @@ export function getHSV(color) {
* @return {color}
*/
export function fromHSL(h, s, l, a) {
const color = create();
setHSL(color, h, s, l, a);
return color;
return setHSL(create(), h, s, l, a);
}

/**
Expand Down Expand Up @@ -348,9 +343,7 @@ export function getHSL(color) {
* @return {color}
*/
export function fromHex(hex) {
const color = create();
setHex(color, hex);
return color;
return setHex(create(), hex);
}

/**
Expand Down Expand Up @@ -396,9 +389,7 @@ export function getHex(color) {
* @return {color}
*/
export function fromXYZ(x, y, z) {
const color = create();
setXYZ(color, x, y, z);
return color;
return setXYZ(create(), x, y, z);
}

/**
Expand Down Expand Up @@ -480,9 +471,7 @@ export function getXYZ(color) {
* @return {color}
*/
export function fromLab(l, a, b) {
const color = create();
setLab(color, l, a, b);
return color;
return setLab(create(), l, a, b);
}

export function fromLabValueToXYZValue(val, white) {
Expand Down

0 comments on commit b20ffd4

Please sign in to comment.