Skip to content

Commit

Permalink
Merge pull request #11 from AntonBazhal/deep-merge
Browse files Browse the repository at this point in the history
Fixed bug with deep nested objects
  • Loading branch information
AntonBazhal committed Mar 6, 2017
2 parents cd7fe9b + f5e2fb8 commit 33bd3e9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion lib/handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ module.exports = function(options) {
}

acc.meta.push({
event: _.merge({}, record, { dynamodb: parsedRecord }),
event: _.assign(
{},
record,
{
dynamodb: _.assign({}, record.dynamodb, parsedRecord)
}
),
action,
document: doc
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dynamo2es-lambda",
"version": "1.0.3",
"version": "1.0.4",
"description": "Configurable AWS Lambda handler to index documents from DynamoDB Streams in Amazon Elasticsearch",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion test/handler-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ describe('handler', function() {

let hookCalled = false;
const testItemKeys = { id: uuid.v4() };
const testItemData = { data: 'some data' };
const testItemData = { data: 'some data', nestedData: { data: 'nested data' } };
const testEvent = formatEvent({
name: 'INSERT',
keys: testItemKeys,
Expand Down

0 comments on commit 33bd3e9

Please sign in to comment.