elm/core-js/String.js
2012-04-19 23:10:25 -04:00

22 lines
No EOL
514 B
JavaScript

var String = function() {
var properEscape = function(str) {
str.replace('"', """);
str.replace("&", "&");
str.replace("'", "'");
str.replace("<", "&#60;");
str.replace(">", "&#62;");
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 };
}();