Skip to content

Commit

Permalink
Removed obsolete joinCss function
Browse files Browse the repository at this point in the history
  • Loading branch information
marekdedic committed Nov 22, 2023
1 parent 9e7b415 commit 27c0299
Showing 1 changed file with 5 additions and 23 deletions.
28 changes: 5 additions & 23 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,5 @@
const parseNumber = parseFloat;

export function joinCss(obj, separator = ';') {
let texts;
if (Array.isArray(obj)) {
texts = obj.filter((text) => text);
} else {
texts = [];
for (const prop in obj) {
if (obj[prop]) {
texts.push(`${prop}:${obj[prop]}`);
}
}
}
return texts.join(separator);
}

export function setCustomSize(element, size) {
if (size && size !== 'lg' && size !== 'sm' && size !== 'xs') {
element.style.fontSize = size.replace('x', 'em');
Expand Down Expand Up @@ -44,12 +29,9 @@ export function getTransform(
}
}

return joinCss(
[
`translate(${parseNumber(translateX) * translateTimes}${translateUnit},${parseNumber(translateY) * translateTimes}${translateUnit})`,
`scale(${flipX * parseNumber(scale)},${flipY * parseNumber(scale)})`,
rotate && `rotate(${rotate}${rotateUnit})`,
],
' ',
);
let output = `translate(${parseNumber(translateX) * translateTimes}${translateUnit},${parseNumber(translateY) * translateTimes}${translateUnit}) scale(${flipX * parseNumber(scale)},${flipY * parseNumber(scale)})`;
if (rotate) {
output += ` rotate(${rotate}${rotateUnit})`;
}
return output;
}

0 comments on commit 27c0299

Please sign in to comment.