
Security News
Feross on Risky Business Weekly Podcast: npm’s Ongoing Supply Chain Attacks
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
npm install sums-up
In TypeScript:
import SumType from 'sums-up';
class Maybe<T> extends SumType<{ Just: [T]; Nothing: [] }> {}
function Just<T>(value: T): Maybe<T> {
return new Maybe("Just", value);
}
function Nothing<T>(): Maybe<T> {
return new Maybe("Nothing");
}
const x = Just("foo");
const result = x.caseOf({
Nothing: () => "nope",
Just: (a) => a + "bar",
});
Or in JavaScript
import SumType from 'sums-up';
class Maybe extends SumType {}
function Just(value) {
return new Maybe("Just", value);
}
function Nothing() {
return new Maybe("Nothing");
}
const x = Just("foo");
const result = x.caseOf({
Nothing: () => "nope",
Just: (a) => a + "bar",
});
If the kind of a sum type instance isn't present in the pattern given to caseOf
, a default key called _
will be used instead.
import SumType from 'sums-up';
class RequestState<T = never> extends SumType<{
NotStarted: [];
Connecting: [];
Downloading: [number];
Completed: [T];
Failed: [string];
}> {}
const state = new RequestState('Failed', 'Connection reset.');
const progressPercentage = state.caseOf({
Downloading: pct => pct,
Completed: () => 100,
_: () => 0
});
Contributors:
@hojberg @dfreeman @AdamEdgett
FAQs
👍 Sums Up ===
The npm package sums-up receives a total of 299 weekly downloads. As such, sums-up popularity was classified as not popular.
We found that sums-up demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.