source: trip-planner-front/node_modules/stylus/lib/nodes/ternary.js@ eed0bf8

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

initial commit

  • Property mode set to 100644
File size: 1.3 KB
Line 
1
2/*!
3 * Stylus - Ternary
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 `Ternary` with `cond`, `trueExpr` and `falseExpr`.
16 *
17 * @param {Expression} cond
18 * @param {Expression} trueExpr
19 * @param {Expression} falseExpr
20 * @api public
21 */
22
23var Ternary = module.exports = function Ternary(cond, trueExpr, falseExpr){
24 Node.call(this);
25 this.cond = cond;
26 this.trueExpr = trueExpr;
27 this.falseExpr = falseExpr;
28};
29
30/**
31 * Inherit from `Node.prototype`.
32 */
33
34Ternary.prototype.__proto__ = Node.prototype;
35
36/**
37 * Return a clone of this node.
38 *
39 * @return {Node}
40 * @api public
41 */
42
43Ternary.prototype.clone = function(parent){
44 var clone = new Ternary();
45 clone.cond = this.cond.clone(parent, clone);
46 clone.trueExpr = this.trueExpr.clone(parent, clone);
47 clone.falseExpr = this.falseExpr.clone(parent, clone);
48 clone.lineno = this.lineno;
49 clone.column = this.column;
50 clone.filename = this.filename;
51 return clone;
52};
53
54/**
55 * Return a JSON representation of this node.
56 *
57 * @return {Object}
58 * @api public
59 */
60
61Ternary.prototype.toJSON = function(){
62 return {
63 __type: 'Ternary',
64 cond: this.cond,
65 trueExpr: this.trueExpr,
66 falseExpr: this.falseExpr,
67 lineno: this.lineno,
68 column: this.column,
69 filename: this.filename
70 };
71};
Note: See TracBrowser for help on using the repository browser.