From fd15b5d4a4ad68707189eaa27a63412b254b926b Mon Sep 17 00:00:00 2001 From: Stefan Breunig Date: Fri, 8 Feb 2013 15:22:21 +0100 Subject: [PATCH] =?UTF-8?q?add=20startsWith=20for=20string=20for=20browser?= =?UTF-8?q?s=20which=20don=E2=80=99t=20ship=20it=20yet.=20Fixes=20#45?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/utils_misc.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/utils_misc.js b/code/utils_misc.js index 103c1a7a..3fca9f17 100644 --- a/code/utils_misc.js +++ b/code/utils_misc.js @@ -141,3 +141,10 @@ window.zoomToAndShowPortal = function(guid, latlng) { String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1).toLowerCase(); } + +// http://stackoverflow.com/a/646643/1684530 by Bergi and CMS +if (typeof String.prototype.startsWith !== 'function') { + String.prototype.startsWith = function (str){ + return this.slice(0, str.length) === str; + }; +}