emoji-aware
Advanced tools
Comparing version
{ | ||
"name": "emoji-aware", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "Emoji-aware unicode string utilities", | ||
@@ -19,4 +19,4 @@ "main": "emoji-aware.js", | ||
"dependencies": { | ||
"lodash.flattendeep": "^3.0.2", | ||
"parsimmon": "^0.7.0" | ||
"lodash.flattendeep": "^4.3.0", | ||
"parsimmon": "^0.9.1" | ||
}, | ||
@@ -27,6 +27,9 @@ "directories": { | ||
"devDependencies": { | ||
"ava": "^0.9.1", | ||
"ava": "^0.16.0", | ||
"benchmark": "^2.1.1", | ||
"cheerio": "^0.20.0", | ||
"codecov.io": "^0.1.6", | ||
"emojilib": "^1.1.0", | ||
"nyc": "^5.3.0" | ||
"emojilib": "^2.0.2", | ||
"nyc": "^7.1.0", | ||
"request": "^2.74.0" | ||
}, | ||
@@ -33,0 +36,0 @@ "repository": { |
@@ -31,4 +31,4 @@ 'use strict'; | ||
Parsimmon.regex(/\uD83C[\uDC04-\uDFFF]/), | ||
Parsimmon.regex(/\uD83D[\uDC00-\uDE4F]/), | ||
Parsimmon.regex(/\uD83D[\uDE80-\uDEC5]/), | ||
Parsimmon.regex(/\uD83D[\uDC00-\uDFFF]/), | ||
Parsimmon.regex(/\uD83E[\uDC00-\uDFFF]/), | ||
// Single characters (trademark, copyright) that become emoji with a | ||
@@ -35,0 +35,0 @@ // variation selector (TODO: make the variation selector required here?) |
@@ -12,2 +12,6 @@ [![travis]](http://travis-ci.org/beaugunderson/emoji-aware) | ||
*Note:* Lodash's `toArray` (as of 4.0.0) and `split` (as of 4.9.0) functions | ||
now correctly split strings that contain emoji; so if that's all you need to do | ||
then [Lodash](https://lodash.com/) is a great fit. | ||
Emoji-aware unicode string utilities for JavaScript. | ||
@@ -29,2 +33,5 @@ | ||
`emoji-aware` also includes a parser combinator-based parser for emoji that you | ||
can build on top of for your own parsing needs. | ||
### Example | ||
@@ -31,0 +38,0 @@ |
@@ -9,4 +9,2 @@ 'use strict'; | ||
test('consoleFormat emoji', t => { | ||
t.plan(characters.length); | ||
characters.forEach(function (e) { | ||
@@ -13,0 +11,0 @@ var result = consoleFormat(`${e}:`); |
@@ -9,6 +9,3 @@ 'use strict'; | ||
test('onlyEmoji fail broken string', t => { | ||
t.plan(1); | ||
var result = utilities.onlyEmoji('\uDC00\uDC01'); | ||
t.false(result); | ||
@@ -18,4 +15,2 @@ }); | ||
test('withoutEmoji fail broken string', t => { | ||
t.plan(1); | ||
var result = utilities.withoutEmoji('\uDC00\uDC01'); | ||
@@ -27,8 +22,6 @@ | ||
test('onlyEmoji', t => { | ||
t.plan(characters.length); | ||
characters.forEach(function (e) { | ||
var result = utilities.onlyEmoji(`abcd${e}fg`); | ||
t.same(result, [e]); | ||
t.deepEqual(result, [e]); | ||
}); | ||
@@ -38,9 +31,7 @@ }); | ||
test('withoutEmoji', t => { | ||
t.plan(characters.length); | ||
characters.forEach(function (e) { | ||
var result = utilities.withoutEmoji(`abcd${e}fg`); | ||
t.same(result, ['a', 'b', 'c', 'd', 'f', 'g']); | ||
t.deepEqual(result, ['a', 'b', 'c', 'd', 'f', 'g']); | ||
}); | ||
}); |
@@ -5,8 +5,8 @@ 'use strict'; | ||
module.exports = Object.keys(emojis) | ||
module.exports = Object.keys(emojis.lib) | ||
.filter(function (key) { | ||
return emojis[key].char; | ||
return emojis.lib[key].char; | ||
}) | ||
.map(function (key) { | ||
return emojis[key].char; | ||
return emojis.lib[key].char; | ||
}).concat([ | ||
@@ -13,0 +13,0 @@ '๐ช', |
@@ -9,4 +9,2 @@ 'use strict'; | ||
test('parseOne emoji', t => { | ||
t.plan(characters.length); | ||
characters.forEach(function (e) { | ||
@@ -20,4 +18,2 @@ var result = unicode.parseOne(e); | ||
test('parse string that includes emoji', t => { | ||
t.plan(characters.length * 7); | ||
characters.forEach(function (e) { | ||
@@ -37,4 +33,2 @@ var result = unicode.parse(`abcd${e}fg`); | ||
test('parse unicode string', t => { | ||
t.plan(1); | ||
var result = unicode.parse('Testing ยซฯฮฑะะฌโฯยป: 1<2 & 4+1>3, now 20% off!'); | ||
@@ -46,4 +40,2 @@ | ||
test('parseOne fail empty string', t => { | ||
t.plan(1); | ||
var result = unicode.parseOne(''); | ||
@@ -55,12 +47,8 @@ | ||
test('parse empty string', t => { | ||
t.plan(1); | ||
var result = unicode.parse(''); | ||
t.same(result, []); | ||
t.deepEqual(result, []); | ||
}); | ||
test('parse fail broken string', t => { | ||
t.plan(1); | ||
var result = unicode.parse('\uDC00\uDC01'); | ||
@@ -67,0 +55,0 @@ |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
79089
408.02%37
76.19%705
94.21%50
16.28%7
75%1
Infinity%+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
Updated
Updated