UNPKG

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