Sha256: 7c09e451b3269d6b6b64e9ab76868302a895920dcbcf978b775844b186f1d98b

Contents?: true

Size: 1.35 KB

Versions: 33

Compression:

Stored size: 1.35 KB

Contents

/*!
 * Stylus - Params
 * Copyright(c) 2010 LearnBoost <dev@learnboost.com>
 * MIT Licensed
 */

/**
 * Module dependencies.
 */

var Node = require('./node');

/**
 * Initialize a new `Params` with `name`, `params`, and `body`.
 *
 * @param {String} name
 * @param {Params} params
 * @param {Expression} body
 * @api public
 */

var Params = module.exports = function Params(){
  Node.call(this);
  this.nodes = [];
};

/**
 * Check function arity.
 *
 * @return {Boolean}
 * @api public
 */

Params.prototype.__defineGetter__('length', function(){
  return this.nodes.length;
});

/**
 * Inherit from `Node.prototype`.
 */

Params.prototype.__proto__ = Node.prototype;

/**
 * Push the given `node`.
 *
 * @param {Node} node
 * @api public
 */

Params.prototype.push = function(node){
  this.nodes.push(node);
};

/**
 * Return a clone of this node.
 * 
 * @return {Node}
 * @api public
 */

Params.prototype.clone = function(parent){
  var clone = new Params;
  clone.lineno = this.lineno;
  clone.filename = this.filename;
  this.nodes.forEach(function(node){
    clone.push(node.clone(parent, clone));
  });
  return clone;
};

/**
 * Return a JSON representation of this node.
 *
 * @return {Object}
 * @api public
 */

Params.prototype.toJSON = function(){
  return {
    __type: 'Params',
    nodes: this.nodes,
    lineno: this.lineno,
    filename: this.filename
  };
};

Version data entries

33 entries across 19 versions & 1 rubygems

Version Path
ela-3.3.0 node_modules/codo/node_modules/nib/node_modules/stylus/lib/nodes/params.js
ela-3.2.0 node_modules/codo/node_modules/nib/node_modules/stylus/lib/nodes/params.js
ela-3.2.0 node_modules/poised/node_modules/stylus/lib/nodes/params.js
ela-3.1.1 node_modules/poised/node_modules/stylus/lib/nodes/params.js
ela-3.1.1 node_modules/codo/node_modules/nib/node_modules/stylus/lib/nodes/params.js
ela-3.1.0 node_modules/poised/node_modules/stylus/lib/nodes/params.js
ela-3.1.0 node_modules/codo/node_modules/nib/node_modules/stylus/lib/nodes/params.js
ela-3.0.0 node_modules/poised/node_modules/stylus/lib/nodes/params.js
ela-3.0.0 node_modules/codo/node_modules/nib/node_modules/stylus/lib/nodes/params.js
ela-2.0.0 node_modules/poised/node_modules/stylus/lib/nodes/params.js
ela-2.0.0 node_modules/codo/node_modules/nib/node_modules/stylus/lib/nodes/params.js
ela-1.1.0 node_modules/poised/node_modules/stylus/lib/nodes/params.js
ela-1.1.0 node_modules/codo/node_modules/nib/node_modules/stylus/lib/nodes/params.js