Replace startsWith

This commit is contained in:
Sashko Stubailo
2017-11-10 14:07:10 -08:00
parent 0da59ee8c9
commit 470df87cef

View File

@@ -1,12 +1,5 @@
import { Random } from 'meteor/random';
// XXX from Underscore.String (http://epeli.github.com/underscore.string/)
function startsWith(str, starts) {
return (
str.length >= starts.length && str.substring(0, starts.length) === starts
);
}
function endsWith(str, ends) {
return (
str.length >= ends.length &&
@@ -50,7 +43,7 @@ function translateUrl(url, newSchemeBase, subPath) {
}
// Prefix FQDNs but not relative URLs
if (url.indexOf('://') === -1 && !startsWith(url, '/')) {
if (url.indexOf('://') === -1 && !url.startsWith('/')) {
url = newSchemeBase + '://' + url;
}