reports/frontend/node_modules/recharts/es6/util/payload/getUniqPayload.js
jtricerolph 1c411e402e Add settings page for managing forecasting API key and URL via UI
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-07-20 14:37:36 +00:00

19 lines
No EOL
525 B
JavaScript

import uniqBy from 'es-toolkit/compat/uniqBy';
/**
* This is configuration option that decides how to filter for unique values only:
*
* - `false` means "no filter"
* - `true` means "use recharts default filter"
* - function means "use return of this function as the default key"
*/
export function getUniqPayload(payload, option, defaultUniqBy) {
if (option === true) {
return uniqBy(payload, defaultUniqBy);
}
if (typeof option === 'function') {
return uniqBy(payload, option);
}
return payload;
}