Skip to content

Instantly share code, notes, and snippets.

@jreyes33
Created March 24, 2015 04:36
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Better emoji support in ES6
let isAnimal = (emojo) =>
'🐀'.codePointAt(0) <= emojo.codePointAt(0) &&
emojo.codePointAt(0) <= '🐼'.codePointAt(0);
let emoji = ['🐶', '👻', '🐸', '🐻', '💩', '🐳'];
let animals = [for (e of emoji) if (isAnimal(e)) e];
console.log(animals);
// => ["🐶","🐸","🐻","🐳"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment