@ozen-ui/kit
Version:
React component library
32 lines (31 loc) • 973 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.useAutocompleteListCardValue = void 0;
var array_1 = require("../../../utils/array");
var useAutocompleteListCardValue = function (value, optionById) {
var preparedValue = (function () {
if ((0, array_1.isArray)(value)) {
var values_1 = [];
value.forEach(function (id) {
var option = optionById.current[id];
if (option) {
values_1.push(option);
}
});
return values_1;
}
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
var option = optionById.current[value];
if (!option) {
return undefined;
}
return option;
})();
return preparedValue;
};
exports.useAutocompleteListCardValue = useAutocompleteListCardValue;
;