Socket
Socket
Sign inDemoInstall

@hazae41/result

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hazae41/result - npm Package Compare versions

Comparing version 1.1.16 to 1.2.0

2

dist/types/index.d.ts
export { Err } from './mods/result/err.js';
export { AssertError, Catched, Panic, Unimplemented } from './mods/result/errors.js';
export { Catched, Panic } from './mods/result/errors.js';
export { Ok } from './mods/result/ok.js';
export { Result, Unwrappable } from './mods/result/result.js';

@@ -1,18 +0,4 @@

import { Err } from './err.js';
declare class Unimplemented extends Error {
#private;
readonly name: string;
constructor(options?: ErrorOptions);
}
declare class AssertError extends Error {
#private;
readonly name: string;
constructor(options?: ErrorOptions);
}
declare class Panic extends Error {
#private;
readonly name: string;
static from(cause: unknown): Panic;
static fromAndThrow(cause: unknown): never;
}

@@ -22,14 +8,5 @@ declare class Catched extends Error {

readonly name: string;
constructor(options?: ErrorOptions);
static from(cause: unknown): Catched;
static fromAndThrow(cause: unknown): never;
/**
* Throw if `Catched`, wrap in `Err` otherwise
* @param error
* @returns `Err(error)` if not `Catched`
* @throws `error.cause` if `Catched`
*/
static throwOrErr(error: unknown): Err<unknown>;
static wrap(cause: unknown): Error | Catched;
}
export { AssertError, Catched, Panic, Unimplemented };
export { Catched, Panic };
import { Nullable } from '@hazae41/option';
import { Awaitable } from '../../libs/promises/promises.js';
import { Err } from './err.js';
import { AssertError, Catched } from './errors.js';
import { Ok } from './ok.js';

@@ -25,3 +24,3 @@

*/
function assert(value: boolean): Ok<void> | Err<AssertError>;
function assert(value: boolean): Ok<void> | Err<void>;
/**

@@ -80,3 +79,3 @@ * Rewrap any type that extends Ok into an Ok

*/
function runAndDoubleWrap<T>(callback: () => Awaitable<T>): Promise<Result<T, Catched>>;
function runAndDoubleWrap<T>(callback: () => Awaitable<T>): Promise<Result<T, Error>>;
/**

@@ -87,3 +86,3 @@ * Run a callback and wrap any returned value in Ok<T> and any thrown error in Err<Catched>

*/
function runAndDoubleWrapSync<T>(callback: () => T): Result<T, Catched>;
function runAndDoubleWrapSync<T>(callback: () => T): Result<T, Error>;
/**

@@ -106,3 +105,3 @@ * Run a callback and wrap any thrown error in Err<unknown>

*/
function runOrDoubleWrap<R extends Result.Infer<R>>(callback: () => Awaitable<R>): Promise<R | Err<Catched>>;
function runOrDoubleWrap<R extends Result.Infer<R>>(callback: () => Awaitable<R>): Promise<R | Err<Error>>;
/**

@@ -113,3 +112,3 @@ * Run a callback and wrap any thrown error in Err<unknown>

*/
function runOrDoubleWrapSync<R extends Result.Infer<R>>(callback: () => R): R | Err<Catched>;
function runOrDoubleWrapSync<R extends Result.Infer<R>>(callback: () => R): R | Err<Error>;
/**

@@ -116,0 +115,0 @@ * Transform `Iterable<Result<T,E>` into `Result<Array<T>, E>`

{
"type": "module",
"name": "@hazae41/result",
"version": "1.1.16",
"version": "1.2.0",
"description": "Rust-like Result for TypeScript",

@@ -6,0 +6,0 @@ "homepage": "https://github.com/hazae41/result",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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