emoji-aware
Advanced tools
Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "emoji-aware", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Emoji-aware unicode string utilities", | ||
@@ -5,0 +5,0 @@ "main": "emoji-aware.js", |
@@ -18,7 +18,8 @@ [![travis]](http://travis-ci.org/beaugunderson/emoji-aware) | ||
strings correctly) you'll have trouble because emoji can span multiple | ||
characters (and multiple surrogate pairs). | ||
characters/surrogate pairs. | ||
The longest emoji is specified by 4 "regular" emoji with zero-width joiners in | ||
between them, for example. This library will correctly split that emoji into | ||
one space in the returned array of characters. | ||
The longest emoji I'm aware of is specified by 4 "regular" emoji (one, a heart, | ||
with its own variation selector) with zero-width joiners in between them. | ||
That's 8 unicode characters as split by most libraries. This library will | ||
correctly split that emoji into one entry in the returned array of characters. | ||
@@ -38,1 +39,17 @@ (But the unicode portion probably needs | ||
``` | ||
A starker example that uses Mathias Bynens' `getSymbols` with a | ||
[composed emoji](http://i.imgur.com/NUKsA1Y.png): | ||
```js | ||
// depending on your browser this will render as 1 emoji or 4; it's | ||
// woman + zwj + heart + graphic variation selector + zwj + kiss + zwj + woman | ||
// see above for a link to a correctly-rendered version | ||
var love = 'test: 👩❤️💋👩'; | ||
console.log(getSymbols(love)); | ||
// [ 't', 'e', 's', 't', ':', ' ', '👩', '', '❤', '️', '', '💋', '', '👩', '' ] | ||
console.log(split(love)); | ||
// [ 't', 'e', 's', 't', ':', ' ', '👩❤️💋👩' ] | ||
``` |
@@ -36,2 +36,8 @@ 'use strict'; | ||
test('parseOne fail non-emoji', function (t) { | ||
t.plan(1); | ||
t.false(emoji.parseOne('a')); | ||
}); | ||
test('parse fail on emoji with non-emoji', function (t) { | ||
@@ -43,3 +49,3 @@ t.plan(characters.length); | ||
t.is(result, false); | ||
t.false(result); | ||
}); | ||
@@ -52,3 +58,3 @@ }); | ||
characters.forEach(function (e) { | ||
t.is(isEmoji(e), true); | ||
t.true(isEmoji(e)); | ||
}); | ||
@@ -60,3 +66,3 @@ }); | ||
t.is(isEmoji('a'), false); | ||
t.false(isEmoji('a')); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14897
21
316
54