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.

24 lines
495 B

2 years ago
  1. 'use strict'
  2. let Node = require('./node')
  3. class Declaration extends Node {
  4. constructor(defaults) {
  5. if (
  6. defaults &&
  7. typeof defaults.value !== 'undefined' &&
  8. typeof defaults.value !== 'string'
  9. ) {
  10. defaults = { ...defaults, value: String(defaults.value) }
  11. }
  12. super(defaults)
  13. this.type = 'decl'
  14. }
  15. get variable() {
  16. return this.prop.startsWith('--') || this.prop[0] === '$'
  17. }
  18. }
  19. module.exports = Declaration
  20. Declaration.default = Declaration