版博士V2.0程序
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

CSSUnitValue.js 881 B

12345678910111213141516171819202122232425262728293031
  1. "use strict";
  2. var __importDefault = (this && this.__importDefault) || function (mod) {
  3. return (mod && mod.__esModule) ? mod : { "default": mod };
  4. };
  5. Object.defineProperty(exports, "__esModule", { value: true });
  6. const CSSUnits_1 = __importDefault(require("./CSSUnits"));
  7. /**
  8. * CSS unit value.
  9. */
  10. class CSSUnitValue {
  11. /**
  12. * Constructor.
  13. *
  14. * @param value Value.
  15. * @param unit Unit.
  16. */
  17. constructor(value, unit) {
  18. this.unit = null;
  19. this.value = null;
  20. if (typeof value !== 'number') {
  21. throw new TypeError('The provided double value is non-finite');
  22. }
  23. if (!CSSUnits_1.default.includes(unit)) {
  24. throw new TypeError('Invalid unit: ' + unit);
  25. }
  26. this.value = value;
  27. this.unit = unit;
  28. }
  29. }
  30. exports.default = CSSUnitValue;
  31. //# sourceMappingURL=CSSUnitValue.js.map