projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix squares colors on diagrams
[vchess.git]
/
client
/
src
/
utils
/
array.js
diff --git
a/client/src/utils/array.js
b/client/src/utils/array.js
index
fae4ce9
..
3d7f7ae
100644
(file)
--- a/
client/src/utils/array.js
+++ b/
client/src/utils/array.js
@@
-1,32
+1,26
@@
// Remove item(s) in array (if present)
// Remove item(s) in array (if present)
-export const ArrayFun =
-{
- remove: function(arr, rfun, all)
- {
+export const ArrayFun = {
+
+ remove: function(arr, rfun, all) {
const index = arr.findIndex(rfun);
const index = arr.findIndex(rfun);
- if (index >= 0)
- {
+ if (index >= 0) {
arr.splice(index, 1);
arr.splice(index, 1);
- if (!!all)
- {
+ if (!!all) {
// Reverse loop because of the splice below
// Reverse loop because of the splice below
- for (let i=arr.length-1; i>=index; i--)
- {
- if (rfun(arr[i]))
- arr.splice(i, 1);
+ for (let i = arr.length - 1; i >= index; i--) {
+ if (rfun(arr[i])) arr.splice(i, 1);
}
}
}
},
// Double array intialization
}
}
}
},
// Double array intialization
- init: function(size1, size2, initElem)
- {
- return [...Array(size1)].map(e => Array(size2).fill(initElem));
+ init: function(size1, size2, initElem) {
+ return [...Array(size1)].map(() => Array(size2).fill(initElem));
},
},
- range: function(max)
- {
+ range: function(max) {
return [...Array(max).keys()];
return [...Array(max).keys()];
- },
+ }
+
};
};