diff --git a/src/property-mapper.js b/src/property-mapper.js index 9b57540..c9d0d7a 100644 --- a/src/property-mapper.js +++ b/src/property-mapper.js @@ -13,9 +13,17 @@ module.exports = function createPropertyMapper(propertyMap) { transformer: destinationPath } } else { - let destinationPathParts = destinationPath.split("."); - let destinationObject = destinationPathParts[0]; - let destinationProperty = destinationPathParts.slice(1).join("."); + let destinationObject, destinationProperty; + + if (destinationPath.includes(".")) { + let destinationPathParts = destinationPath.split("."); + + destinationObject = destinationPathParts[0]; + destinationProperty = destinationPathParts.slice(1).join("."); + } else { + destinationObject = destinationPath; + destinationProperty = sourceProperty; + } return { sourceProperty: sourceProperty, @@ -82,8 +90,8 @@ module.exports = function createPropertyMapper(propertyMap) { }; let mapper = module.exports({ - foo: "one.foo", - bar: "two.bar", + foo: "one", + bar: "two", twoFoo: "two.foo", baz: (value) => { return {