r9761 - helma-ng/trunk/modules/core

[email protected] Thu, 14 May 2009 17:27:40 +0200 (CEST)
Newsgroups gmane.comp.java.helma.cvs
Message-ID <20090514152740.CE74B3D0D6@mia>
Author: hannes
Date: 2009-05-14 17:27:40 +0200 (Thu, 14 May 2009)
New Revision: 9761

Modified:
   helma-ng/trunk/modules/core/string.js
Log:
rewrite last fix to be a bit more readable.

Details at http://dev.helma.org/trac/helma/changeset/9761

Modified: helma-ng/trunk/modules/core/string.js
===================================================================
--- helma-ng/trunk/modules/core/string.js	2009-05-14 15:27:37 UTC (rev 9760)
+++ helma-ng/trunk/modules/core/string.js	2009-05-14 15:27:40 UTC (rev 9761)
@@ -454,7 +454,8 @@
  */
 Object.defineProperty(String.prototype, "endsWith", {
     value: function(str) {
-        return this.length >= str.length && this.lastIndexOf(str) == this.length - str.length;
+        var diff = this.length - str.length;
+        return diff > -1 && this.lastIndexOf(str) == diff;
     }
 });