Skip to content

Instantly share code, notes, and snippets.

@geoffreydhuyvetters
Last active January 13, 2021 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geoffreydhuyvetters/4f5076e36dc691b129916e62fdc0f4ed to your computer and use it in GitHub Desktop.
Save geoffreydhuyvetters/4f5076e36dc691b129916e62fdc0f4ed to your computer and use it in GitHub Desktop.
Wrap any value with an array
// not wrapped
const foo = 'foo';
// already wrapped
const bar = ['bar'];
console.log([foo].flat())
// [ 'foo' ]
console.log([bar].flat())
// [ 'bar' ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment