mirror of
https://github.com/orbitdb/orbitdb.git
synced 2025-03-30 15:08:28 +00:00
Use reduce() instead of forEach() for building EventIndex
This commit is contained in:
parent
2b8b5f0285
commit
3c4fc90819
@ -10,9 +10,7 @@ class EventIndex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateIndex(oplog, updated) {
|
updateIndex(oplog, updated) {
|
||||||
let handled = [];
|
updated.reduce((handled, item) => {
|
||||||
|
|
||||||
updated.forEach((item) => {
|
|
||||||
if(handled.indexOf(item.hash) === -1) {
|
if(handled.indexOf(item.hash) === -1) {
|
||||||
handled.push(item.hash);
|
handled.push(item.hash);
|
||||||
if(item.op === 'ADD') {
|
if(item.op === 'ADD') {
|
||||||
@ -21,7 +19,8 @@ class EventIndex {
|
|||||||
delete this._index[item.value];
|
delete this._index[item.value];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
return handled;
|
||||||
|
}, []);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user