From b3d01f0590480fe06f0d6f9f4ef9f62923de2f46 Mon Sep 17 00:00:00 2001 From: Cian Montgomery Date: Mon, 11 Nov 2019 16:45:30 -0800 Subject: [PATCH] Add support for mapped data types --- lib/typeUtil.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/typeUtil.js b/lib/typeUtil.js index 8c8ffd8..bcd025f 100644 --- a/lib/typeUtil.js +++ b/lib/typeUtil.js @@ -114,6 +114,9 @@ function valueToObject(value) { } else { throw new Error('Invalid dynamo set value. Type: ' + firstItemType + ', Value: ' + value[0]) } + } else if( (typeof value === "object" || typeof value === 'function') + && (value !== null) && Object.keys(value).length !== 0) { + return {M: packObjectOrArray(value) } } else { throw new Error('Invalid dynamo value. Type: ' + type + ', Value: ' + value) }