UNPKG

@sanity/form-builder

Version:
19 lines (18 loc) 534 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isLegacyOptionsItem = isLegacyOptionsItem; exports.resolveValueWithLegacyOptionsSupport = resolveValueWithLegacyOptionsSupport; function isLegacyOptionsItem(item) { if (item && typeof item === 'object') { var keys = Object.keys(item); if (keys.length <= 2 && 'value' in item) { return true; } } return false; } function resolveValueWithLegacyOptionsSupport(item) { return isLegacyOptionsItem(item) ? item.value : item; }