This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "1", | |
"sku": "1234567", | |
"price": "9.99", | |
"name": "Product name in English", | |
"description": "Product description in English" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Function to flatten an array of arbitrarily nested arrays of integers into a flat array of integers | |
* | |
* @param {Array} inputArray The array to be flattenned. | |
* @param {Array} resultArray The result array. | |
*/ | |
flattenArray = (inputArray, resultArray) => { | |
inputArray.forEach(function(entry) { | |
if(entry.constructor === Array){ | |
flattenArray(entry, resultArray); |