Last change
on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
607 bytes
|
Line | |
---|
1 | var parse = require("./parse");
|
---|
2 | var walk = require("./walk");
|
---|
3 | var stringify = require("./stringify");
|
---|
4 |
|
---|
5 | function ValueParser(value) {
|
---|
6 | if (this instanceof ValueParser) {
|
---|
7 | this.nodes = parse(value);
|
---|
8 | return this;
|
---|
9 | }
|
---|
10 | return new ValueParser(value);
|
---|
11 | }
|
---|
12 |
|
---|
13 | ValueParser.prototype.toString = function() {
|
---|
14 | return Array.isArray(this.nodes) ? stringify(this.nodes) : "";
|
---|
15 | };
|
---|
16 |
|
---|
17 | ValueParser.prototype.walk = function(cb, bubble) {
|
---|
18 | walk(this.nodes, cb, bubble);
|
---|
19 | return this;
|
---|
20 | };
|
---|
21 |
|
---|
22 | ValueParser.unit = require("./unit");
|
---|
23 |
|
---|
24 | ValueParser.walk = walk;
|
---|
25 |
|
---|
26 | ValueParser.stringify = stringify;
|
---|
27 |
|
---|
28 | module.exports = ValueParser;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.