Comparing version 0.2.5 to 0.2.6
@@ -144,8 +144,29 @@ var _ = require('lodash'); | ||
particle: 'prefix', | ||
email: 'emailAddress' | ||
email: 'emailAddress', | ||
gender: { | ||
fieldName: 'gender', | ||
values: { | ||
M: 'MAN', | ||
F: 'WOMAN' | ||
} | ||
} | ||
}); | ||
// create a new object with altered keys based on fieldMap | ||
customer = _.mapKeys(customer, function(value, key) { | ||
return options.fieldMap[key] || key; | ||
// create a new object with altered keys and values based on the fieldMap configuration | ||
var transformedCustomer = {}; | ||
_.forOwn(customer, function(value, key) { | ||
var fieldMapTo = options.fieldMap[key]; | ||
if (typeof fieldMapTo === 'string') { | ||
// set the value on a new key | ||
transformedCustomer[fieldMapTo] = value; | ||
} | ||
else if (typeof fieldMapTo === 'object') { | ||
// take the fieldName and values configuration of this fieldMap to transform the key and value | ||
transformedCustomer[fieldMapTo.fieldName] = fieldMapTo.values[value] || value; | ||
} | ||
else { | ||
// set the value on a the same key | ||
transformedCustomer[key] = value; | ||
} | ||
}); | ||
customer = transformedCustomer; | ||
@@ -152,0 +173,0 @@ var customerArgs = {}; |
{ | ||
"name": "clang", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"description": "Node.js api wrapper for Clang's SOAP api", | ||
@@ -5,0 +5,0 @@ "author": "Christiaan Westerbeek <chris@devotis.nl>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
236142
6832