is-emoji

0.1.1 • Public • Published

is-emoji Build Status

Simple enough:

var isEmoji = require('is-emoji');
 
isEmoji('🌻'); // true
isEmoji('🌻'); // true
 
// for string iteration, since emoji char will be broken up over two indexes.
var str = 'abc🚲def';
 
for (var i = 0; i < str.length; i++) {
  var s = str[i];
  // will be true for i == 3, which will tell you
  if (isEmoji.isFirstCharCode(s.charCodeAt(0))) {
    // the character is 4 bytes, so concatenate them
    s += str[i+1];
  }
 
  console.log(s);
}
 

Readme

Keywords

Package Sidebar

Install

npm i is-emoji

Weekly Downloads

40

Version

0.1.1

License

MIT

Last publish

Collaborators

  • smurthas