Sha256: b639209c42a4741e1c10a86b7ee373eca437ef4a333995e64bc536dd226d4959

Contents?: true

Size: 546 Bytes

Versions: 39

Compression:

Stored size: 546 Bytes

Contents

var utils = require('../utils')
  , nodes = require('../nodes');

/**
 * Set a variable `name` on current scope.
 *
 * @param {String} name
 * @param {Expression} expr
 * @param {Boolean} [global]
 * @api public
 */

module.exports = function define(name, expr, global){
  utils.assertType(name, 'string', 'name');
  expr = utils.unwrap(expr);
  var scope = this.currentScope;
  if (global && global.toBoolean().isTrue) {
    scope = this.global.scope;
  }
  var node = new nodes.Ident(name.val, expr);
  scope.add(node);
  return nodes.null;
};

Version data entries

39 entries across 20 versions & 2 rubygems

Version Path
ela-4.1.6 node_modules/stylus/lib/functions/define.js
ela-4.1.6 node_modules/nib/node_modules/stylus/lib/functions/define.js
ela-4.1.5 node_modules/stylus/lib/functions/define.js
ela-4.1.5 node_modules/nib/node_modules/stylus/lib/functions/define.js
ela-4.1.4 node_modules/nib/node_modules/stylus/lib/functions/define.js
ela-4.1.4 node_modules/stylus/lib/functions/define.js
ela-4.1.3 node_modules/stylus/lib/functions/define.js
ela-4.1.3 node_modules/nib/node_modules/stylus/lib/functions/define.js
ela-4.1.2 node_modules/stylus/lib/functions/define.js
ela-4.1.2 node_modules/nib/node_modules/stylus/lib/functions/define.js
ela-4.1.1 node_modules/stylus/lib/functions/define.js
ela-4.1.1 node_modules/nib/node_modules/stylus/lib/functions/define.js
ela-4.1.0 node_modules/stylus/lib/functions/define.js
ela-4.1.0 node_modules/nib/node_modules/stylus/lib/functions/define.js
ela-4.0.0 node_modules/stylus/lib/functions/define.js
ela-4.0.0 node_modules/nib/node_modules/stylus/lib/functions/define.js
ela-3.4.3 node_modules/stylus/lib/functions/define.js
ela-3.4.3 node_modules/nib/node_modules/stylus/lib/functions/define.js
ela-3.4.2 node_modules/nib/node_modules/stylus/lib/functions/define.js
ela-3.4.2 node_modules/stylus/lib/functions/define.js