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.

21 lines
556 B

2 years ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. Object.defineProperty(exports, "default", {
  6. enumerable: true,
  7. get: ()=>_default
  8. });
  9. function _default(value) {
  10. value = `${value}`;
  11. if (value === "0") {
  12. return "0";
  13. }
  14. // Flip sign of numbers
  15. if (/^[+-]?(\d+|\d*\.\d+)(e[+-]?\d+)?(%|\w+)?$/.test(value)) {
  16. return value.replace(/^[+-]?/, (sign)=>sign === "-" ? "" : "-");
  17. }
  18. if (value.includes("var(") || value.includes("calc(")) {
  19. return `calc(${value} * -1)`;
  20. }
  21. }