never-catch
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -12,2 +12,3 @@ export declare type Result<V, E> = Ok<V> | Err<E>; | ||
export declare const err: <E>(error: E) => Err<E>; | ||
export declare const unwrap: <V>(result: Result<V, any>) => unknown extends V ? never : V; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.err = exports.ok = void 0; | ||
exports.unwrap = exports.err = exports.ok = void 0; | ||
var ok = function (value) { return ({ ok: true, value: value }); }; | ||
@@ -8,2 +8,11 @@ exports.ok = ok; | ||
exports.err = err; | ||
var unwrap = function (result) { | ||
if (result.ok) { | ||
return result.value; | ||
} | ||
else { | ||
throw result.error; | ||
} | ||
}; | ||
exports.unwrap = unwrap; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "never-catch", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "A design pattern to implement result in functions.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -0,0 +0,0 @@ # never-catch |
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
3075
28