complete redesign: use nodejs on server instead of php - documentation to be updated
This commit is contained in:
53
nodejs/node_modules/stylus/lib/stack/scope.js
generated
vendored
Normal file
53
nodejs/node_modules/stylus/lib/stack/scope.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
|
||||
/*!
|
||||
* Stylus - stack - Scope
|
||||
* Copyright (c) Automattic <developer.wordpress.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initialize a new `Scope`.
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
var Scope = module.exports = function Scope() {
|
||||
this.locals = {};
|
||||
};
|
||||
|
||||
/**
|
||||
* Add `ident` node to the current scope.
|
||||
*
|
||||
* @param {Ident} ident
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scope.prototype.add = function(ident){
|
||||
this.locals[ident.name] = ident.val;
|
||||
};
|
||||
|
||||
/**
|
||||
* Lookup the given local variable `name`.
|
||||
*
|
||||
* @param {String} name
|
||||
* @return {Node}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
Scope.prototype.lookup = function(name){
|
||||
return this.locals[name];
|
||||
};
|
||||
|
||||
/**
|
||||
* Custom inspect.
|
||||
*
|
||||
* @return {String}
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Scope.prototype.inspect = function(){
|
||||
var keys = Object.keys(this.locals).map(function(key){ return '@' + key; });
|
||||
return '[Scope'
|
||||
+ (keys.length ? ' ' + keys.join(', ') : '')
|
||||
+ ']';
|
||||
};
|
Reference in New Issue
Block a user