@mskcc/carbon-react
Version:
Carbon react components for the MSKCC DSM
27 lines (19 loc) • 916 B
JavaScript
/**
* MSKCC 2021, 2024
*/
;
Object.defineProperty(exports, '__esModule', { value: true });
var invariant = require('invariant');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var invariant__default = /*#__PURE__*/_interopDefaultLegacy(invariant);
const itemToString = item => {
!(typeof item.label === 'string') ? process.env.NODE_ENV !== "production" ? invariant__default["default"](false, '[MultiSelect] the default `itemToString` method expected to receive ' + 'an item with a `label` field of type `string`. Instead received: `%s`', typeof item.label) : invariant__default["default"](false) : void 0;
return item.label || '';
};
const defaultItemToString = item => {
if (Array.isArray(item)) {
return item.map(itemToString);
}
return itemToString(item);
};
exports.defaultItemToString = defaultItemToString;