@openally/result
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -22,2 +22,3 @@ declare class ErrImpl<E> { | ||
unwrap(): T; | ||
safeUnwrap(): T; | ||
map<T2>(mapper: (val: T) => T2): OkImpl<T2>; | ||
@@ -24,0 +25,0 @@ andThen<T2>(mapper: (val: T) => OkImpl<T2>): OkImpl<T2>; |
@@ -44,2 +44,5 @@ var __defProp = Object.defineProperty; | ||
} | ||
safeUnwrap() { | ||
return this.val; | ||
} | ||
map(mapper) { | ||
@@ -88,4 +91,8 @@ return new OkImpl(mapper(this.val)); | ||
unwrap() { | ||
throw new Error(`Tried to unwrap Error: ${toString(this.val)} | ||
${this._stack}`); | ||
const errorOptions = this.val instanceof Error ? { cause: this.val } : {}; | ||
throw new Error( | ||
`Tried to unwrap Error: ${toString(this.val)} | ||
${this._stack}`, | ||
errorOptions | ||
); | ||
} | ||
@@ -92,0 +99,0 @@ map(_mapper) { |
{ | ||
"name": "@openally/result", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Another inspired Rust's Result implementation.", | ||
@@ -15,2 +15,5 @@ "main": "./dist/index.js", | ||
}, | ||
"engines": { | ||
"node": ">=16.9.x" | ||
}, | ||
"scripts": { | ||
@@ -17,0 +20,0 @@ "build": "tsup src/index.ts --format cjs,esm --dts --clean", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9250
304