Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
@eeue56/adeilad
Advanced tools
Ensure JSON has the correct structure at runtime, inspired by Elm's decoders and the pipeline decoder package.
These functions are best used at the surface points where JSON comes into your program: either via an API call, user input, or some untyped library.
Part of the Hiraeth collection.
npm install --save @eeue56/adeilad
Imagine you have some API that gives you JSON, for example:
import { decode, pipeline, required, string, number, array } from "@eeue56/adeilad";
// fetched via a http request
const someExampleData = {
name: "Noah",
age: 28,
pets: [
{ name: "Frodo", age: 8 },
{ name: "Fiver", age: 3 },
]
};
type Pet = {
name: string;
age: number;
}
function Pet(name: string, age: number): Pet {
return {
name,
age
}
}
type Person = {
name: string;
age: number;
pets: Pet[]
}
function Person(name: string, age: number, pets: Pet[]): Person{
return {
name,
age,
pets
}
}
const petDecoder = pipeline([
required("name", string()),
required("age", number())
])
const personDecoder = pipeline([
required("name", string()),
required("age", number()),
required(pets, array(petDecoder))
]))
const result = decode(personDecoder, person);
switch (result.kind) {
"ok": {
console.log("Got a valid person:", result.value);
},
"err": {
console.error("Invalid person:", res.error);
}
}
See docs
You may also want to see the Result type from coed
Adeilad is the Welsh word for buildings. For English speakers it'd be pronounced similar to "ah-dey-lad".
FAQs
Ensure JSON has the correct structure at runtime
The npm package @eeue56/adeilad receives a total of 3 weekly downloads. As such, @eeue56/adeilad popularity was classified as not popular.
We found that @eeue56/adeilad 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
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.