UNPKG

@gooddata/react-components

Version:

GoodData.UI - A powerful JavaScript library for building analytical applications

26 lines 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // (C) 2019-2020 GoodData Corporation var get = require("lodash/get"); var isEmpty = require("lodash/isEmpty"); var bucketNames_1 = require("../constants/bucketNames"); function findBucketByLocalIdentifier(buckets, bucketName) { return (buckets || []).find(function (bucket) { return bucket.localIdentifier === bucketName; }); } exports.findBucketByLocalIdentifier = findBucketByLocalIdentifier; function getBucketItems(buckets, localIdentifier) { return get(findBucketByLocalIdentifier(buckets, localIdentifier), "items", []); } exports.getBucketItems = getBucketItems; function isBucketEmpty(buckets, bucketName) { return isEmpty(getBucketItems(buckets, bucketName)); } exports.isBucketEmpty = isBucketEmpty; function getSecondaryMeasuresLocalIdentifiers(buckets) { return getBucketItems(buckets, bucketNames_1.SECONDARY_MEASURES).map(function (item) { return get(item, "measure.localIdentifier"); }); } exports.getSecondaryMeasuresLocalIdentifiers = getSecondaryMeasuresLocalIdentifiers; exports.filterOutEmptyBuckets = function (buckets) { return buckets.filter(function (bucket) { return !isBucketEmpty(buckets, bucket.localIdentifier); }); }; //# sourceMappingURL=mdObjBucketHelper.js.map