UNPKG

@itwin/presentation-hierarchies

Version:

A package for creating hierarchies based on data in iTwin.js iModels.

25 lines 1.27 kB
"use strict"; /*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", { value: true }); exports.sortNodesByLabelOperator = sortNodesByLabelOperator; const rxjs_1 = require("rxjs"); const core_bentley_1 = require("@itwin/core-bentley"); const Common_js_1 = require("../Common.js"); /** * This should accept sorting params in some form: * - is sorting disabled? * - are we sorting by label or some property value, in case of the latter - how do we get the value? * * @note Nodes with same labels are returned in undefined order. * @internal */ function sortNodesByLabelOperator(nodes) { return nodes.pipe((0, rxjs_1.reduce)((sorted, node) => { sorted.insert(node); return sorted; }, new core_bentley_1.SortedArray(Common_js_1.compareNodesByLabel, core_bentley_1.DuplicatePolicy.Allow)), (0, rxjs_1.map)((sortedArray) => sortedArray.extractArray()), (0, rxjs_1.concatAll)()); } //# sourceMappingURL=Sorting.js.map