860b8a37a2ed9d8cc6085c8d12f3f8b75475dddc9559d4bd18105d41243d521ae0240489bb2b2216098cc9f27bd4077b16aada9c10a8b4dc6036ba9bc93069 607 B

12345678910111213141516171819202122232425262728
  1. var parse = require("./parse");
  2. var walk = require("./walk");
  3. var stringify = require("./stringify");
  4. function ValueParser(value) {
  5. if (this instanceof ValueParser) {
  6. this.nodes = parse(value);
  7. return this;
  8. }
  9. return new ValueParser(value);
  10. }
  11. ValueParser.prototype.toString = function() {
  12. return Array.isArray(this.nodes) ? stringify(this.nodes) : "";
  13. };
  14. ValueParser.prototype.walk = function(cb, bubble) {
  15. walk(this.nodes, cb, bubble);
  16. return this;
  17. };
  18. ValueParser.unit = require("./unit");
  19. ValueParser.walk = walk;
  20. ValueParser.stringify = stringify;
  21. module.exports = ValueParser;