New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nlcst-emoji-modifier

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nlcst-emoji-modifier - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

5

history.md

@@ -5,2 +5,7 @@ <!--mdast setext-->

1.0.2 / 2016-06-22
==================
* Fix adjacent gemoji ([7f9a161](https://github.com/wooorm/nlcst-emoji-modifier/commit/7f9a161))
1.0.1 / 2015-08-30

@@ -7,0 +12,0 @@ ==================

112

index.js

@@ -84,2 +84,11 @@ /**

var value;
var subvalue;
var left;
var right;
var leftMatch;
var rightMatch;
var start;
var pos;
var end;
var replace;

@@ -129,6 +138,35 @@ if (child.type === 'WordNode') {

child.type = EMOTICON_NODE;
} else if (toString(child) === ':') {
} else if (toString(child).charAt(0) === ':') {
nodes = [];
siblingIndex = index;
subvalue = toString(child);
left = right = leftMatch = rightMatch = null;
if (subvalue.length === 1) {
rightMatch = child;
} else {
end = child.position && child.position.end;
start = end && child.position.start;
pos = end && {
line: start.line,
column: start.column + 1,
offset: start.offset + 1
};
rightMatch = {
type: 'PunctuationNode',
value: ':'
};
right = {
type: 'PunctuationNode',
value: subvalue.slice(1)
};
if (end) {
rightMatch.position = { start: start, end: pos };
right.position = { start: pos, end: end };
}
}
while (siblingIndex--) {

@@ -141,2 +179,9 @@ if ((index - siblingIndex) > MAX_GEMOJI_PART_COUNT) {

subvalue = toString(node);
if (subvalue.charAt(subvalue.length - 1) === ':') {
leftMatch = node;
break;
}
if (node.children) {

@@ -148,6 +193,2 @@ nodes = nodes.concat(node.children.concat().reverse());

if (toString(node) === ':') {
break;
}
if (siblingIndex === 0) {

@@ -158,4 +199,36 @@ return;

nodes.reverse().push(child);
if (!leftMatch) {
return;
}
subvalue = toString(leftMatch);
if (subvalue.length !== 1) {
end = leftMatch.position && leftMatch.position.end;
start = end && leftMatch.position.start;
pos = end && {
line: end.line,
column: end.column - 1,
offset: end.offset - 1
};
left = {
type: 'PunctuationNode',
value: subvalue.slice(0, -1)
};
leftMatch = {
type: 'PunctuationNode',
value: ':'
};
if (end) {
left.position = { start: start, end: pos };
leftMatch.position = { start: pos, end: end };
}
}
nodes.push(leftMatch);
nodes.reverse().push(rightMatch);
value = toString(nodes);

@@ -167,12 +240,31 @@

siblings.splice(siblingIndex, index - siblingIndex);
replace = [
siblingIndex,
index - siblingIndex + 1
];
if (left) {
replace.push(left);
}
child.type = EMOTICON_NODE;
child.value = value;
if (child.position && node.position) {
child.position.start = node.position.start;
if (child.position && leftMatch.position) {
child.position.start = leftMatch.position.start;
}
return siblingIndex + 1;
if (child.position && rightMatch.position) {
child.position.end = rightMatch.position.end;
}
replace.push(child);
if (right) {
replace.push(right);
}
[].splice.apply(siblings, replace);
return siblingIndex + 3;
}

@@ -179,0 +271,0 @@ }

2

package.json
{
"name": "nlcst-emoji-modifier",
"version": "1.0.1",
"version": "1.0.2",
"description": "Emoji in NLCST",

@@ -5,0 +5,0 @@ "license": "MIT",

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