UNPKG

@platform/cell.schema

Version:

URI and database schemas for the `cell.os`.

36 lines (35 loc) 1.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Squash = void 0; var tslib_1 = require("tslib"); var common_1 = require("../common"); exports.Squash = { props: function (props) { return exports.Squash.object(props); }, cell: function (cell, options) { if (options === void 0) { options = {}; } var empty = (0, common_1.defaultValue)(options.empty, undefined); if (!cell) return empty; var res = tslib_1.__assign({}, cell); Object.keys(res) .filter(function (key) { return (0, common_1.isUndefinedOrEmptyObject)(res[key]); }) .forEach(function (key) { return delete res[key]; }); return exports.Squash.object(res, options); }, object: function (obj, options) { if (options === void 0) { options = {}; } var empty = (0, common_1.defaultValue)(options.empty, undefined); if (!obj) { return empty; } else { var res_1 = tslib_1.__assign({}, (obj || {})); Object.keys(res_1) .filter(function (key) { return (0, common_1.isUndefinedOrEmptyObject)(res_1[key]); }) .forEach(function (key) { return delete res_1[key]; }); return ((0, common_1.isUndefinedOrEmptyObject)(res_1, { ignoreHash: true }) ? empty : res_1); } }, };