From 2ad0fd7db6060931fd02752ee1f9a047d2494c0a Mon Sep 17 00:00:00 2001 From: Daniel Gasienica Date: Fri, 23 Mar 2018 10:44:01 -0400 Subject: [PATCH] Use Lodash `omit` instead of `delete` --- js/modules/types/attachment/migrate_data_to_file_system.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/modules/types/attachment/migrate_data_to_file_system.js b/js/modules/types/attachment/migrate_data_to_file_system.js index 7a7a4db82..d57ca4128 100644 --- a/js/modules/types/attachment/migrate_data_to_file_system.js +++ b/js/modules/types/attachment/migrate_data_to_file_system.js @@ -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; };