1 function stringifyNode(node, custom) {
3 var value = node.value;
7 if (custom && (customResult = custom(node)) !== undefined) {
9 } else if (type === "word" || type === "space") {
11 } else if (type === "string") {
12 buf = node.quote || "";
13 return buf + value + (node.unclosed ? "" : buf);
14 } else if (type === "comment") {
15 return "/*" + value + (node.unclosed ? "" : "*/");
16 } else if (type === "div") {
17 return (node.before || "") + value + (node.after || "");
18 } else if (Array.isArray(node.nodes)) {
19 buf = stringify(node.nodes);
20 if (type !== "function") {
29 (node.unclosed ? "" : ")")
35 function stringify(nodes, custom) {
38 if (Array.isArray(nodes)) {
40 for (i = nodes.length - 1; ~i; i -= 1) {
41 result = stringifyNode(nodes[i], custom) + result;
45 return stringifyNode(nodes, custom);
48 module.exports = stringify;