Sha256: fe4e93aabb00a83192833214ad92049d4f9f8c99e0f1dd352da4c7bf4fe9384e

Contents?: true

Size: 1.38 KB

Versions: 41

Compression:

Stored size: 1.38 KB

Contents

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

/**
 * Module dependencies.
 */

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

/**
 * Initialize a new `Root` node.
 *
 * @api public
 */

var Root = module.exports = function Root(){
  this.nodes = [];
};

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

Root.prototype.__proto__ = Node.prototype;

/**
 * Push a `node` to this block.
 *
 * @param {Node} node
 * @api public
 */

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

/**
 * Unshift a `node` to this block.
 *
 * @param {Node} node
 * @api public
 */

Root.prototype.unshift = function(node){
  this.nodes.unshift(node);
};

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

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

/**
 * Return "root".
 *
 * @return {String}
 * @api public
 */

Root.prototype.toString = function(){
  return '[Root]';
};

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

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

Version data entries

41 entries across 22 versions & 3 rubygems

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