const formatDictionaryAsString = (obj: Object, indentation = 2) => { let result: string = "{\n"; for (let key in obj) { if (obj.hasOwnProperty(key)) { let value = obj[key]; let line = ' '.repeat(indentation) + `${key}: '${value}',\n`; result += line; } } result = result.slice(0, -2); result += `\n}`; return result; } export default formatDictionaryAsString;