@plastichub/osr-cad
Version:
This is a CLI(CommandLineInterface) toolset to convert 3D files, using Solidworks and other software.
17 lines • 791 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.removeEmpty = void 0;
const removeEmpty = (data) => {
//transform properties into key-values pairs and filter all the empty-values
const entries = Object.entries(data).filter(([, value]) => value != null);
//map through all the remaining properties and check if the value is an object.
//if value is object, use recursion to remove empty properties
const clean = entries.map(([key, v]) => {
const value = typeof v == 'object' ? (0, exports.removeEmpty)(v) : v;
return [key, value];
});
//transform the key-value pairs back to an object.
return Object.fromEntries(clean);
};
exports.removeEmpty = removeEmpty;
//# sourceMappingURL=index.js.map