Last change
on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
555 bytes
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | const Container = require('./container');
|
---|
4 | const Node = require('./node');
|
---|
5 |
|
---|
6 | class StringNode extends Node {
|
---|
7 | constructor (opts) {
|
---|
8 | super(opts);
|
---|
9 | this.type = 'string';
|
---|
10 | }
|
---|
11 |
|
---|
12 | toString () {
|
---|
13 | let quote = this.quoted ? this.raws.quote : '';
|
---|
14 | return [
|
---|
15 | this.raws.before,
|
---|
16 | quote,
|
---|
17 | // we can't use String() here because it'll try using itself
|
---|
18 | // as the constructor
|
---|
19 | this.value + '',
|
---|
20 | quote,
|
---|
21 | this.raws.after
|
---|
22 | ].join('');
|
---|
23 | }
|
---|
24 | }
|
---|
25 |
|
---|
26 | Container.registerWalker(StringNode);
|
---|
27 |
|
---|
28 | module.exports = StringNode;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.