Skip to content

Commit 6a077d3

Browse files
committed
fix(datastore-integration-webflow): improve object data handling in iGet function
1 parent efaa300 commit 6a077d3

File tree

1 file changed

+3
-2
lines changed
  • src/functions/datastore-integration-webflow

1 file changed

+3
-2
lines changed

src/functions/datastore-integration-webflow/index.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -510,11 +510,12 @@ function outOfStockItems(values) {
510510
* @returns {any} the value stored in the key
511511
*/
512512
function iGet(object, key) {
513+
const objectData = object && object.fieldData ? object.fieldData : object;
513514
const numbered = new RegExp(key.toLowerCase().trim()+'(-\\d+)?');
514-
const existingKey = Object.keys(object.fieldData)
515+
const existingKey = Object.keys(objectData)
515516
.filter((k) => k.toLowerCase().trim().match(numbered))
516517
.sort();
517-
return object[existingKey[0]];
518+
return objectData[existingKey[0]];
518519
}
519520

520521
module.exports = {

0 commit comments

Comments
 (0)