UNPKG

netlify-cms-widget-inline-select

Version:
33 lines (28 loc) 770 B
var logError = function logError(value) { console.error("Provided options are not an array - \"" + JSON.stringify(value) + "\""); }; var mapOptions = function mapOptions(list) { return list.map(function (item) { return typeof item === 'string' ? { label: item, value: item } : item; }); }; export default (function (_ref) { var field = _ref.field; var options = field.get('options'); if (!options) { logError(options); return []; } if (typeof options.toJS === 'function') { var value = options.toJS(); if (Array.isArray(value)) return mapOptions(value); logError(value); } if (Array.isArray(options)) return mapOptions(options); logError(options); return []; }); //# sourceMappingURL=getOptions.js.map