Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
ts-errorflow
Advanced tools
A simple zero dependency TypeScript empowered implementation of an Either construct for improved control flow and error handling
A one file, zero-dependency library for improved control flow and error handling in TypeScript. In fact, the entire code base is only 41 lines including comments. Inspired by the concepts of Railway Oriented Programming.
TsErrorFlow leverages Union Types, Intersection Types, User-Defined Type Guards to provide an intuitive and type safe developer experience for error handling.
TsErrorFlow allows you to represent the potential errors in your application domain using plain old javascript objects. This makes it easier to follow a more explicit coding style in which relevant information about things that went wrong can be passed simply and acted on, instead of relying on throwing Errors for control flow:
interface ParkingLotFullError = {
tryAgainAt: Date;
}
interface Ticket {
ticketNumber: string;
issuedAt: Date;
}
function tryGetTicket(): Ticket | ParkingLotFullError {
if (lotIsFull()) {
return makeError({
tryAgainAt: new Date()
});
}
// return an actual ticket
}
const ticketResponse = tryGetTicket();
if (isError<Ticket, ParkingLotFullError>(ticketResponse)) {
// response is definitely an error and will only allow access of properties from ParkingLotFullError
} else {
// response is definitely a ticket and will only allow access of properties from Ticket
}
FAQs
A simple zero dependency TypeScript empowered implementation of an Either construct for improved control flow and error handling
The npm package ts-errorflow receives a total of 0 weekly downloads. As such, ts-errorflow popularity was classified as not popular.
We found that ts-errorflow 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.