22 lines
514 B
JavaScript
22 lines
514 B
JavaScript
|
var String = function() {
|
||
|
var properEscape = function(str) {
|
||
|
str.replace('"', """);
|
||
|
str.replace("&", "&");
|
||
|
str.replace("'", "'");
|
||
|
str.replace("<", "<");
|
||
|
str.replace(">", ">");
|
||
|
return str;
|
||
|
};
|
||
|
|
||
|
var toText = function(elmList) {
|
||
|
var a = [];
|
||
|
while (elmList[0] === "Cons") {
|
||
|
a.push(elmList[1]);
|
||
|
elmList = elmList[2];
|
||
|
}
|
||
|
return String.properEscape(a.join(''));
|
||
|
};
|
||
|
|
||
|
return {toText : toText,
|
||
|
properEscape : properEscape };
|
||
|
}();
|