Comparing version 0.0.6 to 0.0.7
19
index.js
// Export reader | ||
exports.read = function(input, opts){ | ||
opts = opts || {}; | ||
exports.read = function(opts, input){ | ||
return compile(opts, parse(input)); | ||
@@ -11,12 +10,12 @@ }; | ||
// Export compiler | ||
var compile = exports.compile = function(flags, ast){ | ||
flags = flags || {}; | ||
flags.tab = flags.tab || -1; | ||
var tab = (new Array(parseInt(flags.tab === -1 ? 0 : flags.tab, 10)+1)).join(' '); | ||
var compile = exports.compile = function(opts, ast){ | ||
opts = opts || {}; | ||
opts.tab = opts.tab || -1; | ||
var tab = (new Array(parseInt(opts.tab === -1 ? 0 : opts.tab, 10)+1)).join(' '); | ||
var ind = function(il){ | ||
if (!flags.tab) return ''; | ||
if (!opts.tab) return ''; | ||
else return (new Array(il+1)).join(tab); | ||
}; | ||
var nli = function(il){ | ||
if (flags.tab === -1) return ''; | ||
if (opts.tab === -1) return ''; | ||
else return '\n' +ind(il); | ||
@@ -29,3 +28,3 @@ }; | ||
var sp = function(){ | ||
if (flags.compress) return ''; | ||
if (opts.compress) return ''; | ||
else return ' '; | ||
@@ -125,3 +124,3 @@ }; | ||
'RegularExpressionLiteral': function(){ | ||
return new Element(node.type, '/' +node.body +'/' +node.flags); | ||
return new Element(node.type, '/' +node.body +'/' +node.opts); | ||
}, | ||
@@ -128,0 +127,0 @@ 'This': function(){ |
@@ -10,3 +10,3 @@ { | ||
"author": "aynik", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"repository": { | ||
@@ -13,0 +13,0 @@ "type": "git", |
@@ -43,3 +43,3 @@ # Jsjs | ||
<a name="compress" /> | ||
### sx --compress | -c | ||
### jsjs --compress | -c | ||
@@ -46,0 +46,0 @@ Removes optional whitespace between statements and declarations. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
767175
16363