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-111 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 parse;inject
(Object.<number>
, optional) — Custom valences for words.Object
:
polarity
(number
) — Calculated polarity of input;positivity
(number
) — Total positivity;negativity
(number
) — Total negativity;positive
(Array.<string>
) — All positive words;negative
(Array.<string>
) — All negative words.polarity.inject(words)
Insert custom values.
polarity.polarities
Direct access to the internal values.
FAQs
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.