source: trip-planner-front/node_modules/stylus/lib/nodes/params.js@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.4 KB
Line 
1
2/*!
3 * Stylus - Params
4 * Copyright (c) Automattic <developer.wordpress.com>
5 * MIT Licensed
6 */
7
8/**
9 * Module dependencies.
10 */
11
12var Node = require('./node');
13
14/**
15 * Initialize a new `Params` with `name`, `params`, and `body`.
16 *
17 * @param {String} name
18 * @param {Params} params
19 * @param {Expression} body
20 * @api public
21 */
22
23var Params = module.exports = function Params(){
24 Node.call(this);
25 this.nodes = [];
26};
27
28/**
29 * Check function arity.
30 *
31 * @return {Boolean}
32 * @api public
33 */
34
35Params.prototype.__defineGetter__('length', function(){
36 return this.nodes.length;
37});
38
39/**
40 * Inherit from `Node.prototype`.
41 */
42
43Params.prototype.__proto__ = Node.prototype;
44
45/**
46 * Push the given `node`.
47 *
48 * @param {Node} node
49 * @api public
50 */
51
52Params.prototype.push = function(node){
53 this.nodes.push(node);
54};
55
56/**
57 * Return a clone of this node.
58 *
59 * @return {Node}
60 * @api public
61 */
62
63Params.prototype.clone = function(parent){
64 var clone = new Params;
65 clone.lineno = this.lineno;
66 clone.column = this.column;
67 clone.filename = this.filename;
68 this.nodes.forEach(function(node){
69 clone.push(node.clone(parent, clone));
70 });
71 return clone;
72};
73
74/**
75 * Return a JSON representation of this node.
76 *
77 * @return {Object}
78 * @api public
79 */
80
81Params.prototype.toJSON = function(){
82 return {
83 __type: 'Params',
84 nodes: this.nodes,
85 lineno: this.lineno,
86 column: this.column,
87 filename: this.filename
88 };
89};
90
Note: See TracBrowser for help on using the repository browser.