From ccd2dc078346007fe91f385fc9eb364993539b85 Mon Sep 17 00:00:00 2001 From: Jannis R Date: Sun, 18 Mar 2018 00:17:10 +0100 Subject: [PATCH] let parseProducts and formatProductsFilter get the real profile :bug: --- index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 70f4ae2d..b6c82e3a 100644 --- a/index.js +++ b/index.js @@ -12,10 +12,14 @@ const _request = require('./lib/request') const isNonEmptyString = str => 'string' === typeof str && str.length > 0 -const createClient = (profile, request = _request) => { - profile = Object.assign({ - parseProducts: createParseBitmask(profile), - formatProductsFilter: createFormatProductsFilter(profile) +const createClient = (_profile, request = _request) => { + profile = Object.assign({}, defaultProfile, profile) + if (!profile.parseProducts) { + profile.parseProducts = createParseBitmask(profile) + } + if (!profile.formatProductsFilter) { + profile.formatProductsFilter = createFormatProductsFilter(profile) + } }, defaultProfile, profile) validateProfile(profile)