Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/rfs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rfs.js')
-rw-r--r--lib/rfs.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/rfs.js b/lib/rfs.js
index 7ffb235..850c93f 100644
--- a/lib/rfs.js
+++ b/lib/rfs.js
@@ -81,7 +81,9 @@ module.exports = class {
return;
}
- node.nodes.filter(node => node.type === 'word').forEach(node => {
+ const wordNodes = node.nodes.filter(node => node.type === 'word');
+
+ for (const node of wordNodes) {
node.value = node.value.replace(/^(-?\d*\.?\d+)(.*)/g, (match, value, unit) => {
value = Number.parseFloat(value);
@@ -116,7 +118,7 @@ module.exports = class {
return `calc(-${this.toFixed(baseValue, this.opts.unitPrecision)}${this.opts.unit} - ${this.toFixed(diff * 100 / this.opts.breakpoint, this.opts.unitPrecision)}${viewportUnit})`;
});
- });
+ }
// Now we will transform the existing rgba() function node
// into a word node with the hex value