@exromany/lido-csm-sdk
Version:
[](https://github.com/lidofinance/lido-csm-sdk/blob/main/LICENSE.txt) [](h
16 lines • 442 B
JavaScript
export const findIndexAndLeaf = (tree, lookup) => {
for (const [index, leaf] of tree.entries()) {
if (lookup(leaf))
return [index, leaf];
}
return [undefined];
};
export const filterLeafs = (tree, lookup) => {
const result = [];
for (const [, leaf] of tree.entries()) {
if (lookup(leaf))
result.push(leaf);
}
return result;
};
//# sourceMappingURL=find-index-and-leaf.js.map