diff options
Diffstat (limited to 'node_modules/stylus/lib/visitor/index.js')
| -rw-r--r-- | node_modules/stylus/lib/visitor/index.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/node_modules/stylus/lib/visitor/index.js b/node_modules/stylus/lib/visitor/index.js new file mode 100644 index 00000000..b7f3ce3f --- /dev/null +++ b/node_modules/stylus/lib/visitor/index.js @@ -0,0 +1,31 @@ + +/*! + * Stylus - Visitor + * Copyright (c) Automattic <developer.wordpress.com> + * MIT Licensed + */ + +/** + * Initialize a new `Visitor` with the given `root` Node. + * + * @param {Node} root + * @api private + */ + +var Visitor = module.exports = function Visitor(root) { + this.root = root; +}; + +/** + * Visit the given `node`. + * + * @param {Node|Array} node + * @api public + */ + +Visitor.prototype.visit = function(node, fn){ + var method = 'visit' + node.constructor.name; + if (this[method]) return this[method](node); + return node; +}; + |
