Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
module.exports = deparse_stream
module.exports = {
deparse: deparse,
deparseString: deparseString
};

var through = require('through')
, language = require('cssauron-glsl')
Expand Down Expand Up @@ -82,6 +85,14 @@ function deparse_stream(with_whitespace, indent) {
}
}

function deparseString(n, with_whitespace, indent) {
output.length = 0;
with_whitespace = with_whitespace === undefined ? true : with_whitespace;
ws = new WSManager(with_whitespace, indent || ' ');
deparse(n);
return output.join('');
}

function deparse(n) {
return types[n.type](n)
}
Expand Down Expand Up @@ -376,7 +387,7 @@ function deparse_stmt(node) {
}

function deparse_stmtlist(node) {
var has_parent = node.parent !== null
var has_parent = node.parent !== null && node.parent !== undefined;

if(has_parent) {
output.push('{')
Expand Down