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