Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save doesdev/f1f00fe35ae9561c68a8f69ca099d9cb to your computer and use it in GitHub Desktop.
Save doesdev/f1f00fe35ae9561c68a8f69ca099d9cb to your computer and use it in GitHub Desktop.
Pretty Print Single Level Array of Objects
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