File tree Expand file tree Collapse file tree 4 files changed +23
-14
lines changed
Expand file tree Collapse file tree 4 files changed +23
-14
lines changed Original file line number Diff line number Diff line change @@ -2,13 +2,14 @@ import fs from 'node:fs'
22import { emojiEmotion } from 'emoji-emotion'
33import { emojiToName } from 'gemoji'
44
5+ /** @type {Record<string, number> } */
56const data = { }
67let index = - 1
78
89while ( ++ index < emojiEmotion . length ) {
9- data [ emojiEmotion [ index ] . emoji ] = emojiEmotion [ index ] . polarity
10- data [ ':' + emojiToName [ emojiEmotion [ index ] . emoji ] + ':' ] =
11- emojiEmotion [ index ] . polarity
10+ const info = emojiEmotion [ index ]
11+ data [ info . emoji ] = info . polarity
12+ data [ ':' + emojiToName [ info . emoji ] + ':' ] = info . polarity
1213}
1314
1415fs . writeFileSync (
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ export function inject(values) {
8383 * Get the polarity of a word.
8484 *
8585 * @param {string } value
86- * @param {Inject } inject
86+ * @param {Inject } [ inject]
8787 * @returns {number }
8888 */
8989function getPolarity ( value , inject ) {
Original file line number Diff line number Diff line change @@ -158,7 +158,13 @@ test('algorithm', function (t) {
158158 t . end ( )
159159} )
160160
161- // Simple word tokenizer.
161+ /**
162+ * Simple word tokenizer.
163+ *
164+ * @param {string } value
165+ * @returns {Array<string> }
166+ */
162167function tokenize ( value ) {
163- return value . toLowerCase ( ) . match ( / \S + / g)
168+ const match = value . toLowerCase ( ) . match ( / \S + / g)
169+ return match ? [ ...match ] : [ ]
164170}
Original file line number Diff line number Diff line change 11{
2- "include" : [" *.js" ],
2+ "include" : [" **/**.js" ],
3+ "exclude" : [" coverage" , " node_modules" ],
34 "compilerOptions" : {
4- "target" : " ES2020" ,
5- "lib" : [" ES2020" ],
6- "module" : " ES2020" ,
7- "moduleResolution" : " node" ,
8- "allowJs" : true ,
95 "checkJs" : true ,
106 "declaration" : true ,
117 "emitDeclarationOnly" : true ,
12- "allowSyntheticDefaultImports" : true ,
13- "skipLibCheck" : true
8+ "exactOptionalPropertyTypes" : true ,
9+ "forceConsistentCasingInFileNames" : true ,
10+ "lib" : [" es2020" ],
11+ "module" : " node16" ,
12+ "newLine" : " lf" ,
13+ "skipLibCheck" : true ,
14+ "strict" : true ,
15+ "target" : " es2020"
1416 }
1517}
You can’t perform that action at this time.
0 commit comments