nlcst-emoji-modifier
Advanced tools
Comparing version 0.0.1 to 0.1.0
35
index.js
@@ -44,3 +44,3 @@ 'use strict'; | ||
MAX_GEMOJI_PART_COUNT = 4; | ||
MAX_GEMOJI_PART_COUNT = 12; | ||
@@ -141,3 +141,3 @@ /** | ||
while (siblingIndex--) { | ||
if ((index - siblingIndex) >= MAX_GEMOJI_PART_COUNT) { | ||
if ((index - siblingIndex) > MAX_GEMOJI_PART_COUNT) { | ||
return; | ||
@@ -235,4 +235,2 @@ } | ||
function attach(parser) { | ||
var paragraphPlugins; | ||
if (!parser || !parser.parse) { | ||
@@ -255,29 +253,4 @@ throw new Error( | ||
parser.use('tokenizeSentence', emojiModifier); | ||
/** | ||
* Adding the paragraph modifier is a bit non-standard. | ||
* Reasoning is first of all, to not worry about white | ||
* space nodes between sentences: at this stage, | ||
* paragraph only consists of `SentenceNode`s. | ||
* Additionally, adding it before all other modifiers | ||
* makes sure that sentences starting with a lower case | ||
* letter still get matched correctly: | ||
* | ||
* Alfred! :+1: bertrand | ||
* | ||
* ...is correctly classified as one sentence, and: | ||
* | ||
* Alfred! :+1: Bertrand | ||
* | ||
* ...is correctly classified as `SentenceNode` | ||
* (`Alfred! :+1:`), `WhiteSpaceNode` and | ||
* `SentenceNode` (`Bertrand`). | ||
*/ | ||
paragraphPlugins = parser.tokenizeParagraphPlugins; | ||
if (paragraphPlugins.indexOf(affixEmojiModifier) === -1) { | ||
parser.tokenizeParagraphPlugins.unshift(affixEmojiModifier); | ||
} | ||
parser.useFirst('tokenizeSentence', emojiModifier); | ||
parser.useFirst('tokenizeParagraph', affixEmojiModifier); | ||
} | ||
@@ -284,0 +257,0 @@ |
{ | ||
"name": "nlcst-emoji-modifier", | ||
"version": "0.0.1", | ||
"version": "0.1.0", | ||
"description": "Emoji in NLCST", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
0
37460
5
1918