UNPKG

node-pdf-report

Version:

node-pdf-report is a HTML(ejs) to PDF and Image coverting library, this library is powered by puppeteer PDF reporting facilities.

26 lines (22 loc) 817 B
function getJsonObjectToArray(obj) { const result = []; // recursive funciton function recursiveConverter(objToConvert) { if (typeof objToConvert === "object") { const keys = Object.keys(objToConvert); for (let i = 0; i < keys.length; i++) { const currentKeyValue = objToConvert[keys[i]]; if(Array.isArray(currentKeyValue)) result.push([keys[i], currentKeyValue]); else if(typeof currentKeyValue === "object") recursiveConverter(currentKeyValue); else { result.push([keys[i], currentKeyValue]); } } } } recursiveConverter(obj); return result; } module.exports = { getJsonObjectToArray: getJsonObjectToArray }