diff --git a/lib/customers.js b/lib/customers.js index 5b7719af..6db8a819 100644 --- a/lib/customers.js +++ b/lib/customers.js @@ -5,7 +5,6 @@ const _ = require('lodash/fp') const db = require('./db') const BN = require('./bn') const anonymous = require('../lib/constants').anonymousCustomer -const camelize = _.mapKeys(_.camelCase) const complianceOverrides = require('./compliance_overrides') const users = require('./users') @@ -112,6 +111,20 @@ function getDailyVolume (id) { }) } +/** + * Camelize customer fields + * Note: return null if customer is undefined + * + * @name camelize + * @function + * + * @param {object} customer Customer with snake_case fields + * @returns {object} Camelized Customer object + */ +function camelize (customer) { + return customer ? _.mapKeys(_.camelCase, customer) : null +} + /** * Populate customer object * with dailyVolume information