source: trip-planner-front/node_modules/stylus/lib/nodes/null.js

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

initial commit

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