Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

emoji-aware

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emoji-aware - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

zwj.js

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc