style: reformat all source code by prettier

This commit is contained in:
Zongmin Lei
2021-05-06 13:32:47 +08:00
parent 0b15109107
commit 901b771960
7 changed files with 40 additions and 32 deletions

View File

@@ -1,5 +1,5 @@
module.exports = {
indexOf: function(arr, item) {
indexOf: function (arr, item) {
var i, j;
if (Array.prototype.indexOf) {
return arr.indexOf(item);
@@ -11,7 +11,7 @@ module.exports = {
}
return -1;
},
forEach: function(arr, fn, scope) {
forEach: function (arr, fn, scope) {
var i, j;
if (Array.prototype.forEach) {
return arr.forEach(fn, scope);
@@ -20,15 +20,15 @@ module.exports = {
fn.call(scope, arr[i], i, arr);
}
},
trim: function(str) {
trim: function (str) {
if (String.prototype.trim) {
return str.trim();
}
return str.replace(/(^\s*)|(\s*$)/g, "");
},
spaceIndex: function(str) {
spaceIndex: function (str) {
var reg = /\s|\n|\t/;
var match = reg.exec(str);
return match ? match.index : -1;
}
},
};