UNPKG

@exromany/lido-csm-sdk

Version:

[![GitHub license](https://img.shields.io/github/license/lidofinance/lido-csm-sdk?color=limegreen)](https://github.com/lidofinance/lido-csm-sdk/blob/main/LICENSE.txt) [![Version npm](https://img.shields.io/npm/v/@lidofinance/lido-csm-sdk?label=version)](h

21 lines 642 B
"use strict"; 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