1b2c90bc by Michael Richards

Simplify the String::trim polyfill.

1 parent d582ba6a
......@@ -8,7 +8,7 @@
if (!String.prototype.trim) {
String.prototype.trim = function() {
return this.replace(/^\s\*/, '').replace(/\s\s*$/, '');
return this.replace(/^\s+|\s+$/g, "");
};
}
......
......@@ -6,9 +6,8 @@
# The Rivets namespace.
Rivets = {}
# Polyfill For String::trim
unless String::trim
String::trim = -> return @.replace(/^\s\*/, '').replace(/\s\s*$/, '')
# Polyfill For String::trim.
unless String::trim then String::trim = -> @replace /^\s+|\s+$/g, ""
# Polyfill For Array::map
unless Array::map
......