mirror of
https://github.com/tornadocash/fixed-merkle-tree.git
synced 2024-12-28 07:37:57 +01:00
findIndex optimization
This commit is contained in:
parent
523094bdc8
commit
3d95212b1d
@ -139,8 +139,7 @@ class MerkleTree {
|
||||
*/
|
||||
indexOf(element, comparator) {
|
||||
if (comparator) {
|
||||
const result = this._layers[0].findIndex((el) => comparator(element, el))
|
||||
return result === undefined ? -1 : result
|
||||
return this._layers[0].findIndex((el) => comparator(element, el))
|
||||
} else {
|
||||
return this._layers[0].indexOf(element)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user