init: Initial Commit
This commit is contained in:
15
services/frontend/utils/formatting.ts
Normal file
15
services/frontend/utils/formatting.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user