Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@sweet-monads/async
Advanced tools
Package for better developer experience with Promise
and @sweet-monad/interfaces/Monad
sweet-monads — easy-to-use monads implementation with static types definition and separated packages.
npm install @sweet-monads/async
import { chain } from "@sweet-monads/async";
import { right } from "@sweet-monads/either";
const fn = () =>
Promise.resolve(right("Hello, Sweet Monad."))
.then(chain(doSomethingAsync))
.then(chain(doOneMoreAsyncThing));
chain
chain<T, R>(fn: (v: T) => Promise<Monad<R>>): (m: Monad<T>) => Promise<Monad<R>>;
f: (v: T) => Promise<Monad<R>>
- async function which convert a Monad to another one.Promise
with mapped by fn
function value wrapped by Monad
by the Monad
implementation rule.Example:
declare function getUser(email: string): Promise<Either<UserNotFoundError, User>>;
declare function arePasswordsMatched(password: string, user: User): Promise<Either<WrongCredentialsError, boolean>>;
// result is Promise<Either<UserNotFoundError | WrongCredentialsError, boolean>>
const result = getUser("some@email.com")
.then(chain(user => arePasswordsMatched("some password", user.password)));
MIT (c) Artem Kobzar see LICENSE file.
FAQs
Promise helpers for monad
The npm package @sweet-monads/async receives a total of 0 weekly downloads. As such, @sweet-monads/async popularity was classified as not popular.
We found that @sweet-monads/async 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's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.