raptor
Version:
RaptorJS provides an AMD module loader that works in Node, Rhino and the web browser. It also includes various sub-modules to support building optimized web applications.
36 lines (27 loc) • 907 B
JavaScript
(function() {
var stringProto = String.prototype;
if (!stringProto.startsWith) {
stringProto.startsWith = function(prefix, position) {
var str = this;
if (position) {
str = str.substring(position);
}
if (str.length < prefix.length) {
return false;
}
return str.substring(0, prefix.length) == prefix;
};
}
if (!stringProto.endsWith) {
stringProto.endsWith = function(suffix, position) {
var str = this;
if (position) {
str = str.substring(position);
}
if (str.length < suffix.length) {
return false;
}
return str.slice(0 - suffix.length) == suffix;
};
}
}());