kopia lustrzana https://github.com/c9/core
secure redirect
rodzic
8224fb8c66
commit
b0e10d15b5
|
@ -43,5 +43,14 @@ exports.repeat = function(str, times) {
|
|||
exports.count = function(str, substr){
|
||||
return str.split(substr).length - 1;
|
||||
};
|
||||
|
||||
exports.endsWith = function(subjectString, searchString, position) {
|
||||
if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
|
||||
position = subjectString.length;
|
||||
}
|
||||
position -= searchString.length;
|
||||
var lastIndex = subjectString.indexOf(searchString, position);
|
||||
return lastIndex !== -1 && lastIndex === position;
|
||||
};
|
||||
|
||||
});
|
Ładowanie…
Reference in New Issue