UNPKG

@sanity/form-builder

Version:
17 lines (16 loc) 646 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getItemType = getItemType; exports.isEmpty = isEmpty; var _content = require("@sanity/util/content"); var _constants = require("./constants"); // eslint-disable-next-line @typescript-eslint/ban-types function isEmpty(value) { return Object.keys(value).every(key => _constants.IGNORE_KEYS.includes(key)); } function getItemType(arrayType, item) { var itemTypeName = (0, _content.resolveTypeName)(item); return itemTypeName === 'object' && arrayType.of.length === 1 ? arrayType.of[0] : arrayType.of.find(memberType => memberType.name === itemTypeName); }