sonarr-repo-only/UI/Shared/StringHelpers.js

34 lines
933 B
JavaScript
Raw Normal View History

'use strict';
define(
[
], function () {
return {
2013-08-04 01:27:12 +00:00
startsWith: function (str, starts) {
if (starts === '') {
return true;
}
if (str == null || starts == null) {
return false;
}
str = String(str);
starts = String(starts);
return str.length >= starts.length && str.slice(0, starts.length) === starts;
},
2013-08-04 01:27:12 +00:00
endsWith: function (str, ends) {
if (ends === '') {
return true;
}
if (str == null || ends == null) {
return false;
}
str = String(str);
ends = String(ends);
return str.length >= ends.length && str.slice(str.length - ends.length) === ends;
}
}
});