Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
tiny-decoders
Advanced tools
Version 10.0.0 (2023-10-15)
Changed: multi
has a new API.
Before:
type Id = { tag: "Id"; id: string } | { tag: "LegacyId"; id: number };
const idDecoder: Decoder<Id> = multi({
string: (id) => ({ tag: "Id" as const, id }),
number: (id) => ({ tag: "LegacyId" as const, id }),
});
After:
type Id = { tag: "Id"; id: string } | { tag: "LegacyId"; id: number };
const idDecoder: Decoder<Id> = chain(multi(["string", "number"]), (value) => {
switch (value.type) {
case "string":
return { tag: "Id" as const, id: value.value };
case "number":
return { tag: "LegacyId" as const, id: value.value };
}
});
Like before, you specify the types you want (string
and number
above), but now you get a tagged union back ({ type: "string", value: string } | { type: "number", value: number }
) instead of supplying functions to call for each type. You typically want to pair this with chain
, switching on the different variants of the tagged union.
This change unlocks further changes that will come in future releases.
FAQs
Type-safe data decoding for the minimalist.
The npm package tiny-decoders receives a total of 4,331 weekly downloads. As such, tiny-decoders popularity was classified as popular.
We found that tiny-decoders 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.