Use Lodash `omit` instead of `delete`

pull/1/head
Daniel Gasienica 7 years ago
parent ef2be2cf5f
commit 2ad0fd7db6

@ -1,6 +1,7 @@
const isArrayBuffer = require('lodash/isArrayBuffer');
const isFunction = require('lodash/isFunction');
const isUndefined = require('lodash/isUndefined');
const omit = require('lodash/omit');
// type Context :: {
@ -31,7 +32,9 @@ exports.migrateDataToFileSystem = async (attachment, { writeAttachmentData } = {
const path = await writeAttachmentData(data);
const attachmentWithoutData = Object.assign({}, attachment, { path });
delete attachmentWithoutData.data;
const attachmentWithoutData = omit(
Object.assign({}, attachment, { path }),
['data']
);
return attachmentWithoutData;
};

Loading…
Cancel
Save