Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 |
|
---|
2 | /*!
|
---|
3 | * Stylus - Null
|
---|
4 | * Copyright (c) Automattic <developer.wordpress.com>
|
---|
5 | * MIT Licensed
|
---|
6 | */
|
---|
7 |
|
---|
8 | /**
|
---|
9 | * Module dependencies.
|
---|
10 | */
|
---|
11 |
|
---|
12 | var Node = require('./node')
|
---|
13 | , nodes = require('./');
|
---|
14 |
|
---|
15 | /**
|
---|
16 | * Initialize a new `Null` node.
|
---|
17 | *
|
---|
18 | * @api public
|
---|
19 | */
|
---|
20 |
|
---|
21 | var Null = module.exports = function Null(){};
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * Inherit from `Node.prototype`.
|
---|
25 | */
|
---|
26 |
|
---|
27 | Null.prototype.__proto__ = Node.prototype;
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * Return 'Null'.
|
---|
31 | *
|
---|
32 | * @return {String}
|
---|
33 | * @api public
|
---|
34 | */
|
---|
35 |
|
---|
36 | Null.prototype.inspect =
|
---|
37 | Null.prototype.toString = function(){
|
---|
38 | return 'null';
|
---|
39 | };
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * Return false.
|
---|
43 | *
|
---|
44 | * @return {Boolean}
|
---|
45 | * @api public
|
---|
46 | */
|
---|
47 |
|
---|
48 | Null.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 |
|
---|
59 | Null.prototype.__defineGetter__('isNull', function(){
|
---|
60 | return true;
|
---|
61 | });
|
---|
62 |
|
---|
63 | /**
|
---|
64 | * Return hash.
|
---|
65 | *
|
---|
66 | * @return {String}
|
---|
67 | * @api public
|
---|
68 | */
|
---|
69 |
|
---|
70 | Null.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 |
|
---|
81 | Null.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.