@wener/ui
Version:
20 lines • 622 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.normalizeOptions = void 0;
function normalizeOptions(o) {
if (o === null || o === undefined) {
return [];
}
if (typeof o?.[0] === 'string') {
return o.map((value) => ({ label: value, value }));
}
if (typeof o?.[0] === 'number') {
return o.map((value) => ({ label: String(value), value }));
}
if (Array.isArray(o?.[0])) {
return o.map(([value, label]) => ({ label, value }));
}
return o;
}
exports.normalizeOptions = normalizeOptions;
//# sourceMappingURL=options.js.map