http://wiki.ecmascript.org/doku.php?id=harmony:string_extras
I’ve found a small bug:
String.prototype.endsWith = function(s) {
var t = String(s);
return this.lastIndexOf(t) === this.length - t.length;
};
Interaction:
> "".endsWith("/")
true
> "#".endsWith("//")
true
> "##".endsWith("///")
true
Fix (e.g.):
String.prototype.endsWith = function(s) {
var t = String(s);
var index = this.lastIndexOf(t)
return index >= 0 && index === this.length - t.length;
};
--
Dr. Axel Rauschmayer
[email protected]
twitter.com/rauschma
home: rauschma.de
blog: 2ality.com
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss