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.
29 lines
555 B
29 lines
555 B
4 years ago
|
'use strict';
|
||
|
|
||
|
const Container = require('./container');
|
||
|
const Node = require('./node');
|
||
|
|
||
|
class StringNode extends Node {
|
||
|
constructor (opts) {
|
||
|
super(opts);
|
||
|
this.type = 'string';
|
||
|
}
|
||
|
|
||
|
toString () {
|
||
|
let quote = this.quoted ? this.raws.quote : '';
|
||
|
return [
|
||
|
this.raws.before,
|
||
|
quote,
|
||
|
// we can't use String() here because it'll try using itself
|
||
|
// as the constructor
|
||
|
this.value + '',
|
||
|
quote,
|
||
|
this.raws.after
|
||
|
].join('');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Container.registerWalker(StringNode);
|
||
|
|
||
|
module.exports = StringNode;
|