|
|
|
@ -610,6 +610,18 @@ if (!String.prototype.startsWith) {
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!String.prototype.endsWith) {
|
|
|
|
|
String.prototype.endsWith = function(searchString, position) {
|
|
|
|
|
var subjectString = this.toString();
|
|
|
|
|
if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
|
|
|
|
|
position = subjectString.length;
|
|
|
|
|
}
|
|
|
|
|
position -= searchString.length;
|
|
|
|
|
var lastIndex = subjectString.lastIndexOf(searchString, position);
|
|
|
|
|
return lastIndex !== -1 && lastIndex === position;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// array utility function
|
|
|
|
|
jQuery.last = function(arr) {
|
|
|
|
|
return arr && arr.length ? arr[arr.length-1] : undefined;
|
|
|
|
|