@loken/hierarchies
Version:
Library for working with hierarchies of identifiers and identifiable objects.
19 lines (18 loc) • 592 B
JavaScript
import { multipleToIterable } from "@loken/utilities";
const nodesToItems = (nodes) => {
const items = [];
for (const node of multipleToIterable(nodes))
items.push(node.item);
return items;
}, nodeToId = (node, identify) => (identify == null ? void 0 : identify(node.item)) ?? node.item, nodesToIds = (nodes, identify) => {
const ids = [];
for (const node of multipleToIterable(nodes))
ids.push((identify == null ? void 0 : identify(node.item)) ?? node.item);
return ids;
};
export {
nodeToId,
nodesToIds,
nodesToItems
};
//# sourceMappingURL=node-conversion.js.map