Sha256: f8a5ecd759dfb94da42135fcdf90339ebd605b7868b4293575d9114178a4d529

Contents?: true

Size: 913 Bytes

Versions: 41

Compression:

Stored size: 913 Bytes

Contents

/*!
 * Stylus - Token
 * Copyright (c) Automattic <developer.wordpress.com>
 * MIT Licensed
 */

/**
 * Module dependencies.
 */

var inspect = require('util').inspect;

/**
 * Initialize a new `Token` with the given `type` and `val`.
 *
 * @param {String} type
 * @param {Mixed} val
 * @api private
 */

var Token = exports = module.exports = function Token(type, val) {
  this.type = type;
  this.val = val;
};

/**
 * Custom inspect.
 *
 * @return {String}
 * @api public
 */

Token.prototype.inspect = function(){
  var val = ' ' + inspect(this.val);
  return '[Token:' + this.lineno + ':' + this.column + ' '
    + '\x1b[32m' + this.type + '\x1b[0m'
    + '\x1b[33m' + (this.val ? val : '') + '\x1b[0m'
    + ']';
};

/**
 * Return type or val.
 *
 * @return {String}
 * @api public
 */

Token.prototype.toString = function(){
  return (undefined === this.val
    ? this.type
    : this.val).toString();
};

Version data entries

41 entries across 22 versions & 3 rubygems

Version Path
epuber-stylus-source-0.56.0 vendor/lib/token.js
epuber-stylus-source-0.54.8 vendor/lib/token.js
ela-4.1.6 node_modules/nib/node_modules/stylus/lib/token.js
ela-4.1.6 node_modules/stylus/lib/token.js
ela-4.1.5 node_modules/nib/node_modules/stylus/lib/token.js
ela-4.1.5 node_modules/stylus/lib/token.js
ela-4.1.4 node_modules/nib/node_modules/stylus/lib/token.js
ela-4.1.4 node_modules/stylus/lib/token.js
ela-4.1.3 node_modules/stylus/lib/token.js
ela-4.1.3 node_modules/nib/node_modules/stylus/lib/token.js
ela-4.1.2 node_modules/stylus/lib/token.js
ela-4.1.2 node_modules/nib/node_modules/stylus/lib/token.js
ela-4.1.1 node_modules/nib/node_modules/stylus/lib/token.js
ela-4.1.1 node_modules/stylus/lib/token.js
ela-4.1.0 node_modules/nib/node_modules/stylus/lib/token.js
ela-4.1.0 node_modules/stylus/lib/token.js
ela-4.0.0 node_modules/stylus/lib/token.js
ela-4.0.0 node_modules/nib/node_modules/stylus/lib/token.js
ela-3.4.3 node_modules/nib/node_modules/stylus/lib/token.js
ela-3.4.3 node_modules/stylus/lib/token.js