Use Lodash omit
instead of delete
This commit is contained in:
parent
ef2be2cf5f
commit
2ad0fd7db6
1 changed files with 5 additions and 2 deletions
|
@ -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…
Reference in a new issue