UNPKG

1.03 kBJavaScriptView Raw
1
2/*!
3 * Stylus - Comment
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 `Comment` with the given `str`.
16 *
17 * @param {String} str
18 * @param {Boolean} suppress
19 * @param {Boolean} inline
20 * @api public
21 */
22
23var Comment = module.exports = function Comment(str, suppress, inline){
24 Node.call(this);
25 this.str = str;
26 this.suppress = suppress;
27 this.inline = inline;
28};
29
30/**
31 * Inherit from `Node.prototype`.
32 */
33
34Comment.prototype.__proto__ = Node.prototype;
35
36/**
37 * Return a JSON representation of this node.
38 *
39 * @return {Object}
40 * @api public
41 */
42
43Comment.prototype.toJSON = function(){
44 return {
45 __type: 'Comment',
46 str: this.str,
47 suppress: this.suppress,
48 inline: this.inline,
49 lineno: this.lineno,
50 column: this.column,
51 filename: this.filename
52 };
53};
54
55/**
56 * Return comment.
57 *
58 * @return {String}
59 * @api public
60 */
61
62Comment.prototype.toString = function(){
63 return this.str;
64};