From d1279019921a80542f1f65d62b07acfe54c00889 Mon Sep 17 00:00:00 2001 From: goga-m Date: Mon, 16 Oct 2017 15:04:34 +0300 Subject: [PATCH] Fix on camelize --- lib/customers.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) 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