Skip to content

Instantly share code, notes, and snippets.

@FGRibreau
Created December 29, 2015 09:45
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 FGRibreau/7fbec4bdacb9957a94c9 to your computer and use it in GitHub Desktop.
Save FGRibreau/7fbec4bdacb9957a94c9 to your computer and use it in GitHub Desktop.
match-when - Pattern matching for modern JavaScript - https://github.com/FGRibreau/match-when
[2, 4, 1, 2].map(match({
[when(1)]: "one",
[when(2)]: "two",
[when()]: "many"
}));
// [ 'two', 'many', 'one', 'two' ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment