UNPKG

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