Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Detect the polarity of text, based on afinn-165
and
emoji-emotion
.
npm:
npm install polarity
var polarity = require('polarity');
polarity(['some', 'positive', 'happy', 'cats']);
Yields:
{
polarity: 5,
positivity: 5,
negativity: 0,
positive: ['happy', 'positive'],
negative: []
}
polarity(['darn', 'self-deluded', 'abandoned', 'dogs']);
Yields:
{
polarity: -4,
positivity: 0,
negativity: -4,
positive: [],
negative: ['abandoned', 'self-deluded']
}
polarity(words[, inject])
Get a polarity result from given values, optionally with one time injections.
polarity does not tokenise values. There are better tokenisers around (parse-latin). However, the following will work pretty good:
function tokenize(value) {
return value.toLowerCase().match(/\S+/g);
}
words
(Array.<string>
) — Words to parseinject
(Object.<number>
, optional) — Custom valences for wordsObject
:
polarity
(number
) — Calculated polarity of inputpositivity
(number
) — Total positivitynegativity
(number
) — Total negativitypositive
(Array.<string>
) — All positive wordsnegative
(Array.<string>
) — All negative wordspolarity.inject(words)
Insert custom values.
polarity.polarities
Direct access to the internal values.
afinn-96
— AFINN list from 2009, containing 1468 entriesafinn-111
— AFINN list from 2011, containing 2477 entriesafinn-169
— AFINN list from 2015, containing 3382 entriesemoji-emotion
— Like AFINN, but for emojiFAQs
Detect the polarity (sentiment) of text
The npm package polarity receives a total of 10 weekly downloads. As such, polarity popularity was classified as not popular.
We found that polarity demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.