Skip to content

Commit 21d106b

Browse files
committed
Refactor to shout less
1 parent 9ab4a17 commit 21d106b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var raw = require('emoticon')
66

77
module.exports = modifier(mergeEmoticons)
88

9-
var EMOTICON_NODE = 'EmoticonNode'
9+
var emoticonNode = 'EmoticonNode'
1010

1111
// Magic numbers.
1212
//
@@ -17,7 +17,7 @@ var EMOTICON_NODE = 'EmoticonNode'
1717
// `Punctuation` (a tear), `Punctuation` (another tear), `Punctuation` (a nose),
1818
// and `Punctuation` (a frowning mouth), we can safely break when the modifier
1919
// has walked 5 characters.
20-
var MAX_EMOTICON_LENGTH = 5
20+
var maxEmoticonLength = 5
2121

2222
// Unpack.
2323
var emoticons = []
@@ -43,7 +43,7 @@ function mergeEmoticons(child, index, parent) {
4343
value = ''
4444

4545
while (node) {
46-
if (value.length >= MAX_EMOTICON_LENGTH) {
46+
if (value.length >= maxEmoticonLength) {
4747
return
4848
}
4949

@@ -54,11 +54,11 @@ function mergeEmoticons(child, index, parent) {
5454
// The second test, if the last character of the current node is
5555
// superfluous but improves performance by 30%.
5656
if (
57-
node.type !== EMOTICON_NODE &&
57+
node.type !== emoticonNode &&
5858
end.indexOf(subvalue.charAt(subvalue.length - 1)) !== -1 &&
5959
emoticons.indexOf(value) !== -1
6060
) {
61-
emoticon = {type: EMOTICON_NODE, value: value}
61+
emoticon = {type: emoticonNode, value: value}
6262

6363
if (child.position && node.position) {
6464
emoticon.position = {

0 commit comments

Comments
 (0)