1 | "use strict";
|
2 |
|
3 | exports.__esModule = true;
|
4 | exports["default"] = void 0;
|
5 | var _endsWith = _interopRequireDefault(require("./_endsWith"));
|
6 | var _stripUnit = _interopRequireDefault(require("../helpers/stripUnit"));
|
7 | var _errors = _interopRequireDefault(require("./_errors"));
|
8 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | var pxtoFactory = function pxtoFactory(to) {
|
14 | return function (pxval, base) {
|
15 | if (base === void 0) {
|
16 | base = '16px';
|
17 | }
|
18 | var newPxval = pxval;
|
19 | var newBase = base;
|
20 | if (typeof pxval === 'string') {
|
21 | if (!(0, _endsWith["default"])(pxval, 'px')) {
|
22 | throw new _errors["default"](69, to, pxval);
|
23 | }
|
24 | newPxval = (0, _stripUnit["default"])(pxval);
|
25 | }
|
26 | if (typeof base === 'string') {
|
27 | if (!(0, _endsWith["default"])(base, 'px')) {
|
28 | throw new _errors["default"](70, to, base);
|
29 | }
|
30 | newBase = (0, _stripUnit["default"])(base);
|
31 | }
|
32 | if (typeof newPxval === 'string') {
|
33 | throw new _errors["default"](71, pxval, to);
|
34 | }
|
35 | if (typeof newBase === 'string') {
|
36 | throw new _errors["default"](72, base, to);
|
37 | }
|
38 | return "" + newPxval / newBase + to;
|
39 | };
|
40 | };
|
41 | var _default = exports["default"] = pxtoFactory;
|
42 | module.exports = exports.default; |
\ | No newline at end of file |