@exromany/lido-csm-sdk
Version:
[](https://github.com/lidofinance/lido-csm-sdk/blob/main/LICENSE.txt) [](h
21 lines • 642 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.filterLeafs = exports.findIndexAndLeaf = void 0;
const findIndexAndLeaf = (tree, lookup) => {
for (const [index, leaf] of tree.entries()) {
if (lookup(leaf))
return [index, leaf];
}
return [undefined];
};
exports.findIndexAndLeaf = findIndexAndLeaf;
const filterLeafs = (tree, lookup) => {
const result = [];
for (const [, leaf] of tree.entries()) {
if (lookup(leaf))
result.push(leaf);
}
return result;
};
exports.filterLeafs = filterLeafs;
//# sourceMappingURL=find-index-and-leaf.js.map