Sha256: 4a2f59b82558915c37df396302df07092de0412949c993ad421852d51c529d7f

Contents?: true

Size: 1.7 KB

Versions: 41

Compression:

Stored size: 1.7 KB

Contents

/*!
 * Stylus - Arguments
 * Copyright (c) Automattic <developer.wordpress.com>
 * MIT Licensed
 */

/**
 * Module dependencies.
 */

var Node = require('./node')
  , nodes = require('../nodes')
  , utils = require('../utils');

/**
 * Initialize a new `Arguments`.
 *
 * @api public
 */

var Arguments = module.exports = function Arguments(){
  nodes.Expression.call(this);
  this.map = {};
};

/**
 * Inherit from `nodes.Expression.prototype`.
 */

Arguments.prototype.__proto__ = nodes.Expression.prototype;

/**
 * Initialize an `Arguments` object with the nodes
 * from the given `expr`.
 *
 * @param {Expression} expr
 * @return {Arguments}
 * @api public
 */

Arguments.fromExpression = function(expr){
  var args = new Arguments
    , len = expr.nodes.length;
  args.lineno = expr.lineno;
  args.column = expr.column;
  args.isList = expr.isList;
  for (var i = 0; i < len; ++i) {
    args.push(expr.nodes[i]);
  }
  return args;
};

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

Arguments.prototype.clone = function(parent){
  var clone = nodes.Expression.prototype.clone.call(this, parent);
  clone.map = {};
  for (var key in this.map) {
    clone.map[key] = this.map[key].clone(parent, clone);
  }
  clone.isList = this.isList;
  clone.lineno = this.lineno;
  clone.column = this.column;
  clone.filename = this.filename;
  return clone;
};

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

Arguments.prototype.toJSON = function(){
  return {
    __type: 'Arguments',
    map: this.map,
    isList: this.isList,
    preserve: this.preserve,
    lineno: this.lineno,
    column: this.column,
    filename: this.filename,
    nodes: this.nodes
  };
};

Version data entries

41 entries across 22 versions & 3 rubygems

Version Path
epuber-stylus-source-0.56.0 vendor/lib/nodes/arguments.js
epuber-stylus-source-0.54.8 vendor/lib/nodes/arguments.js
ela-4.1.6 node_modules/nib/node_modules/stylus/lib/nodes/arguments.js
ela-4.1.6 node_modules/stylus/lib/nodes/arguments.js
ela-4.1.5 node_modules/nib/node_modules/stylus/lib/nodes/arguments.js
ela-4.1.5 node_modules/stylus/lib/nodes/arguments.js
ela-4.1.4 node_modules/nib/node_modules/stylus/lib/nodes/arguments.js
ela-4.1.4 node_modules/stylus/lib/nodes/arguments.js
ela-4.1.3 node_modules/stylus/lib/nodes/arguments.js
ela-4.1.3 node_modules/nib/node_modules/stylus/lib/nodes/arguments.js
ela-4.1.2 node_modules/stylus/lib/nodes/arguments.js
ela-4.1.2 node_modules/nib/node_modules/stylus/lib/nodes/arguments.js
ela-4.1.1 node_modules/nib/node_modules/stylus/lib/nodes/arguments.js
ela-4.1.1 node_modules/stylus/lib/nodes/arguments.js
ela-4.1.0 node_modules/nib/node_modules/stylus/lib/nodes/arguments.js
ela-4.1.0 node_modules/stylus/lib/nodes/arguments.js
ela-4.0.0 node_modules/stylus/lib/nodes/arguments.js
ela-4.0.0 node_modules/nib/node_modules/stylus/lib/nodes/arguments.js
ela-3.4.3 node_modules/nib/node_modules/stylus/lib/nodes/arguments.js
ela-3.4.3 node_modules/stylus/lib/nodes/arguments.js