UNPKG

grunt-zuckrig-closure

Version:

Reduce a verbose syntax for Google Closure Compiler to be more Pythonic/Rubistic.

39 lines (30 loc) 852 B
var TokenBuilder; TokenBuilder = (function() { function TokenBuilder() {} TokenBuilder.prototype.build_punc = function(val, loc) { return { type: 'Punctuator', value: val, loc: loc }; }; TokenBuilder.prototype.build_iden = function(val, loc) { return { type: 'Identifier', value: val, loc: loc }; }; TokenBuilder.prototype.build_str = function(val, loc) { return { type: 'String', value: val, loc: loc }; }; TokenBuilder.prototype.build_goog_call = function(method, arg, loc) { return [this.build_iden('goog', loc), this.build_punc('.', loc), this.build_iden(method, loc), this.build_punc('(', loc), this.build_str(arg, loc), this.build_punc(')', loc), this.build_punc(';', loc)]; }; return TokenBuilder; })(); module.exports = TokenBuilder;