You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
995 B

4 years ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _cssUnitConverter = _interopRequireDefault(require("css-unit-converter"));
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. function convertNodes(left, right, precision) {
  9. switch (left.type) {
  10. case 'LengthValue':
  11. case 'AngleValue':
  12. case 'TimeValue':
  13. case 'FrequencyValue':
  14. case 'ResolutionValue':
  15. return convertAbsoluteLength(left, right, precision);
  16. default:
  17. return {
  18. left,
  19. right
  20. };
  21. }
  22. }
  23. function convertAbsoluteLength(left, right, precision) {
  24. if (right.type === left.type) {
  25. right = {
  26. type: left.type,
  27. value: (0, _cssUnitConverter.default)(right.value, right.unit, left.unit, precision),
  28. unit: left.unit
  29. };
  30. }
  31. return {
  32. left,
  33. right
  34. };
  35. }
  36. var _default = convertNodes;
  37. exports.default = _default;
  38. module.exports = exports.default;