Sha256: c29bb9c7cad9c99b5fb2347bf5e7ce1b6b5f80dedb40e23905a0131957fe24b9

Contents?: true

Size: 562 Bytes

Versions: 1

Compression:

Stored size: 562 Bytes

Contents

/*!
 * Stylus - Visitor
 * Copyright(c) 2010 LearnBoost <dev@learnboost.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]) throw new Error('un-implemented ' + method);
  return this[method](node);
};

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stylus-source-0.19.4 vendor/lib/visitor/index.js