Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
35 lines
766 B
Plaintext
35 lines
766 B
Plaintext
module.exports = {
|
|
indexOf: function (arr, item) {
|
|
var i, j;
|
|
if (Array.prototype.indexOf) {
|
|
return arr.indexOf(item);
|
|
}
|
|
for (i = 0, j = arr.length; i < j; i++) {
|
|
if (arr[i] === item) {
|
|
return i;
|
|
}
|
|
}
|
|
return -1;
|
|
},
|
|
forEach: function (arr, fn, scope) {
|
|
var i, j;
|
|
if (Array.prototype.forEach) {
|
|
return arr.forEach(fn, scope);
|
|
}
|
|
for (i = 0, j = arr.length; i < j; i++) {
|
|
fn.call(scope, arr[i], i, arr);
|
|
}
|
|
},
|
|
trim: function (str) {
|
|
if (String.prototype.trim) {
|
|
return str.trim();
|
|
}
|
|
return str.replace(/(^\s*)|(\s*$)/g, "");
|
|
},
|
|
spaceIndex: function (str) {
|
|
var reg = /\s|\n|\t/;
|
|
var match = reg.exec(str);
|
|
return match ? match.index : -1;
|
|
},
|
|
};
|