elm/core-js/String.js

22 lines
514 B
JavaScript
Raw Normal View History

2012-04-20 03:10:25 +00:00
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 };
}();