UNPKG

@carbon/ibm-security

Version:

Carbon for Cloud & Cognitive IBM Security UI components

28 lines (25 loc) 850 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; /** * @file Item helpers. * @copyright IBM Security 2019 */ /** * Handles converting an item to a string. * @param {Record<string, any>} item The object containing a label to convert. * @returns {string} The converted label of the object passed. */ var convertItemToString = function convertItemToString(item) { return typeof (item || {}).label === 'string' ? (item || {}).label : (item || {}).toString(); }; /** * Handles returning a label for an object. * @param {Record<string, any>} item The object containing a label. * @returns {string} The label of the object passed. */ var _default = exports.default = function _default(item) { return Array.isArray(item) ? item.map(convertItemToString) : convertItemToString(item); };