Created
January 30, 2020 19:33
-
-
Save doesdev/f1f00fe35ae9561c68a8f69ca099d9cb to your computer and use it in GitHub Desktop.
Pretty Print Single Level Array of Objects
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
const printer = (a) => `[\n ${a.map((o) => `{ ${Object.entries(o).map(([k, v]) => { | |
return `${k}: ${typeof v === 'string' ? `'${v}'` : v}` | |
}).join(', ')} }`).join(',\n ')}\n]` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment