UNPKG

@mui/x-charts

Version:

The community edition of MUI X Charts components.

23 lines (22 loc) 562 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.appendAtKey = appendAtKey; /** * Given a map of arrays, appends a value to the array at the given key. * If no array exists at that key, one is created and the value appended. * @param map Map of arrays * @param key Key to append the value at * @param value Value to append */ function appendAtKey(map, key, value) { let bucket = map.get(key); if (!bucket) { bucket = [value]; map.set(key, bucket); } else { bucket.push(value); } return bucket; }