Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

neverthrow

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

neverthrow - npm Package Compare versions

Comparing version 7.0.0 to 7.0.1

10

dist/index.d.ts

@@ -23,3 +23,3 @@ interface ErrorConfig {

orElse<A>(f: (e: E) => Result<T, A> | ResultAsync<T, A>): ResultAsync<T, A>;
match<A>(ok: (t: T) => A, _err: (e: E) => A): Promise<A>;
match<A, B = A>(ok: (t: T) => A, _err: (e: E) => B): Promise<A | B>;
unwrapOr<A>(t: A): Promise<T | A>;

@@ -91,2 +91,3 @@ /**

declare function safeTry<T, E>(body: () => Generator<Err<never, E>, Result<T, E>>): Result<T, E>;
declare function safeTry<YieldErr extends Err<never, unknown>, GeneratorReturnResult extends Result<unknown, unknown>>(body: () => Generator<YieldErr, GeneratorReturnResult>): Result<InferOkTypes<GeneratorReturnResult>, InferErrTypes<YieldErr> | InferErrTypes<GeneratorReturnResult>>;
/**

@@ -105,2 +106,3 @@ * Evaluates the given generator to a Result returned or an Err yielded from it,

declare function safeTry<T, E>(body: () => AsyncGenerator<Err<never, E>, Result<T, E>>): Promise<Result<T, E>>;
declare function safeTry<YieldErr extends Err<never, unknown>, GeneratorReturnResult extends Result<unknown, unknown>>(body: () => AsyncGenerator<YieldErr, GeneratorReturnResult>): Promise<Result<InferOkTypes<GeneratorReturnResult>, InferErrTypes<YieldErr> | InferErrTypes<GeneratorReturnResult>>>;
interface IResult<T, E> {

@@ -199,3 +201,3 @@ /**

*/
match<A>(ok: (t: T) => A, err: (e: E) => A): A;
match<A, B = A>(ok: (t: T) => A, err: (e: E) => B): A | B;
/**

@@ -237,3 +239,3 @@ * Emulates Rust's `?` operator in `safeTry`'s body. See also `safeTry`.

unwrapOr<A>(_v: A): T | A;
match<A>(ok: (t: T) => A, _err: (e: E) => A): A;
match<A, B = A>(ok: (t: T) => A, _err: (e: E) => B): A | B;
safeUnwrap(): Generator<Err<never, E>, T>;

@@ -257,3 +259,3 @@ _unsafeUnwrap(_?: ErrorConfig): T;

unwrapOr<A>(v: A): T | A;
match<A>(_ok: (t: T) => A, err: (e: E) => A): A;
match<A, B = A>(_ok: (t: T) => A, err: (e: E) => B): A | B;
safeUnwrap(): Generator<Err<never, E>, T>;

@@ -260,0 +262,0 @@ _unsafeUnwrap(config?: ErrorConfig): T;

2

package.json
{
"name": "neverthrow",
"version": "7.0.0",
"version": "7.0.1",
"description": "Stop throwing errors, and instead return Results!",

@@ -5,0 +5,0 @@ "main": "dist/index.cjs.js",

@@ -451,6 +451,6 @@ > Seeking co-maintainers: I don't have much time to maintain this project these days. If someone would like to jump in and become a co-maintainer, it would be appreciated!

class Result<T, E> {
match<A>(
match<A, B = A>(
okCallback: (value: T) => A,
errorCallback: (error: E) => A
): A => { ... }
errorCallback: (error: E) => B
): A | B => { ... }
}

@@ -1071,6 +1071,6 @@ ```

class ResultAsync<T, E> {
match<A>(
match<A, B = A>(
okCallback: (value: T) => A,
errorCallback: (error: E) => A
): Promise<A> => { ... }
errorCallback: (error: E) => B
): Promise<A | B> => { ... }
}

@@ -1077,0 +1077,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc