sync
This commit is contained in:
@ -22,7 +22,7 @@ export function getCookie(name) {
|
||||
const cookies = document.cookie.split(';');
|
||||
for (let cookie of cookies) {
|
||||
cookie = cookie.trim();
|
||||
if (cookie.indexOf(name) === 0) {
|
||||
if (cookie.startsWith(name)) {
|
||||
return decodeURIComponent(cookie.substring(name.length));
|
||||
}
|
||||
}
|
||||
|
@ -10,16 +10,16 @@ export function contains(s, key, ignoreCase) {
|
||||
key = String(key);
|
||||
}
|
||||
if (ignoreCase) {
|
||||
return s.toLowerCase().indexOf(key.toLowerCase()) >= 0;
|
||||
return s.toLowerCase().includes(key.toLowerCase());
|
||||
}
|
||||
return s.indexOf(key) >= 0;
|
||||
return s.includes(key);
|
||||
}
|
||||
|
||||
export function endsWith(s, suffix) {
|
||||
if (nullOrEmpty(s) || nullOrEmpty(suffix)) {
|
||||
return false;
|
||||
}
|
||||
return s.indexOf(suffix) === s.length - suffix.length;
|
||||
return s.endsWith(suffix); // === s.length - suffix.length;
|
||||
}
|
||||
|
||||
export function padStart(s, num, char) {
|
||||
|
Reference in New Issue
Block a user