@draftbit/core 48.5.1-a97e35.2 → 48.5.1-cd9561.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- Object.defineProperty(exports,"__esModule",{value:true});exports.normalizeToPickerOptions=normalizeToPickerOptions;var _lodash=require("lodash");function normalizeToPickerOptions(options){if(options.length===0){return[];}var firstOption=options[0];if(typeof firstOption===("string"||"number")){return options.map(function(option){return{label:option,value:option};});}if((0,_lodash.isObject)(firstOption)&&firstOption.value&&firstOption.label){return options.map(function(option){return{label:option.label,value:option.value};});}throw new Error('Picker options must be either an array of strings, numbers, or an array of { "label": string | number; "value": string | number; } objects.');}
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.normalizeToPickerOptions=normalizeToPickerOptions;var _lodash=require("lodash");function normalizeToPickerOptions(options){if(options.length===0){return[];}var firstOption=options[0];if(typeof firstOption==="string"||typeof firstOption==="number"){return options.map(function(option){return{label:option,value:option};});}if((0,_lodash.isObject)(firstOption)&&firstOption.value!==undefined&&firstOption.label!==undefined){return options.map(function(option){return{label:option.label,value:option.value};});}throw new Error('Picker options must be either an array of strings, numbers, or an array of { "label": string | number; "value": string | number; } objects.');}
@@ -4,13 +4,15 @@ export function normalizeToPickerOptions(options) {
4
4
  return [];
5
5
  }
6
6
  const firstOption = options[0];
7
- if (typeof firstOption === ("string" || "number")) {
7
+ if (typeof firstOption === "string" || typeof firstOption === "number") {
8
8
  return options.map((option) => ({
9
9
  label: option,
10
10
  value: option,
11
11
  }));
12
12
  }
13
- if (isObject(firstOption) && firstOption.value && firstOption.label) {
13
+ if (isObject(firstOption) &&
14
+ firstOption.value !== undefined &&
15
+ firstOption.label !== undefined) {
14
16
  return options.map((option) => {
15
17
  return {
16
18
  label: option.label,
@@ -1 +1 @@
1
- {"version":3,"file":"PickerCommon.js","sourceRoot":"","sources":["../../../../../src/components/Picker/PickerCommon.ts"],"names":[],"mappings":"AAEA,OAAO,EA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