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.js10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/rfs.js b/lib/rfs.js
index a3e6d36..f76a835 100644
--- a/lib/rfs.js
+++ b/lib/rfs.js
@@ -3,10 +3,6 @@
const postcss = require('postcss');
const valueParser = require('postcss-value-parser');
-const BREAKPOINT_ERROR = 'breakpoint option is invalid, it should be set in `px`, `rem` or `em`.';
-const BREAKPOINT_UNIT_ERROR = 'breakpointUnit option is invalid, it should be `px`, `rem` or `em`.';
-const BASE_RFS_ERROR = 'baseValue option is invalid, it should be set in `px` or `rem`.';
-
const defaultOptions = {
baseValue: 20,
unit: 'rem',
@@ -31,7 +27,7 @@ module.exports = class {
} else if (this.opts.baseValue.endsWith('rem')) {
this.opts.baseValue = Number.parseFloat(this.opts.baseValue) * this.opts.remValue;
} else {
- console.error(BASE_RFS_ERROR);
+ throw new TypeError('`baseValue` option is invalid, it should be set in `px` or `rem`.');
}
}
@@ -41,12 +37,12 @@ module.exports = class {
} else if (this.opts.breakpoint.endsWith('em')) {
this.opts.breakpoint = Number.parseFloat(this.opts.breakpoint) * this.opts.remValue;
} else {
- console.error(BREAKPOINT_ERROR);
+ throw new TypeError('`breakpoint` option is invalid, it should be set in `px`, `rem` or `em`.');
}
}
if (!['px', 'rem', 'em'].includes(this.opts.breakpointUnit)) {
- console.error(BREAKPOINT_UNIT_ERROR);
+ throw new TypeError('`breakpointUnit` option is invalid, it should be `px`, `rem` or `em`.');
}
}