New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tryumph

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tryumph - npm Package Compare versions

Comparing version 1.0.9 to 1.0.10

36

dist/result.d.ts

@@ -5,4 +5,7 @@ import type { Matcher } from "./matcher";

* A `Result` can either contain a result value or an error value.
*
* @sealed
*/
declare class Result<TResult, TError> extends TupleConstructor<TResult, TError> {
private readonly containsAmbiguousError;
/**

@@ -22,2 +25,18 @@ * Get the result value.

/**
* Creates an `Ok` `Result`.
*
* @param result - The result value.
*
* @returns A `Result` object containing the given result value.
*/
static makeOk: <R, E>(result: R) => Result<R, E>;
/**
* Creates an `Err` `Result`.
*
* @param error - The error value.
*
* @returns A `Result` object containing the given error value.
*/
static makeErr: <R, E>(error: E) => Result<R, E>;
/**
* Create a Result.

@@ -31,6 +50,3 @@ *

*/
constructor({ result, error, }: {
result?: TResult | null;
error?: TError | null;
});
private constructor();
/**

@@ -130,2 +146,6 @@ * Check if the `Result` has a value.

*
* @remarks
*
* This is just a public export of {@link Result.makeOk}
*
* @param result - The result value.

@@ -135,6 +155,10 @@ *

*/
declare function Ok<TResult, TError>(result: TResult): Result<TResult, TError>;
declare const Ok: <R, E>(result: R) => Result<R, E>;
/**
* Creates an `Err` `Result`.
*
* @remarks
*
* This is just a public export of {@link Result.makeErr}
*
* @param error - The error value.

@@ -144,5 +168,5 @@ *

*/
declare function Err<TResult, TError>(error: TError): Result<TResult, TError>;
declare const Err: <R, E>(error: E) => Result<R, E>;
export type { Result };
export { Ok, Err };
//# sourceMappingURL=result.d.ts.map

@@ -10,2 +10,4 @@ "use strict";

* A `Result` can either contain a result value or an error value.
*
* @sealed
*/

@@ -40,5 +42,2 @@ class Result extends tupleConstructor_1.default {

constructor({ result = null, error = null, }) {
if (result && error) {
throw Error("Both result and error where provided, You should only pass one to the constructor");
}
super(result, error);

@@ -56,3 +55,3 @@ /**

*/
this.isErr = () => this.err !== null;
this.isErr = () => this.err !== null || this.containsAmbiguousError || this.isOk === null;
/**

@@ -197,5 +196,32 @@ * Get the result value.

*/
function Ok(result) {
Result.makeOk = (result) => {
return new Result({ result });
}
};
/**
* Creates an `Err` `Result`.
*
* @param error - The error value.
*
* @returns A `Result` object containing the given error value.
*/
Result.makeErr = (error) => {
const self = new Result({ error });
if (!error) {
// @ts-expect-error this field is supposed to be set by makeErr function
self.containsAmbiguousError = true;
}
return self;
};
/**
* Creates an `Ok` `Result`.
*
* @remarks
*
* This is just a public export of {@link Result.makeOk}
*
* @param result - The result value.
*
* @returns A `Result` object containing the given result value.
*/
const Ok = Result.makeOk;
exports.Ok = Ok;

@@ -205,2 +231,6 @@ /**

*
* @remarks
*
* This is just a public export of {@link Result.makeErr}
*
* @param error - The error value.

@@ -210,6 +240,4 @@ *

*/
function Err(error) {
return new Result({ error });
}
const Err = Result.makeErr;
exports.Err = Err;
//# sourceMappingURL=result.js.map
import type { Result } from "./result";
/**
* Generic type for referencing any function with its included arguments and return type.
*/
type AnyFunction = (...args: any[]) => any;

@@ -3,0 +6,0 @@ /**

8

package.json
{
"name": "tryumph",
"version": "1.0.9",
"version": "1.0.10",
"description": "Bring the \"Umph\" to the javascript's async error handling",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": ["dist"],
"files": [
"dist"
],
"scripts": {

@@ -43,3 +45,3 @@ "prepare": "ts-node ./scripts/prepare.ts && npm run build",

},
"homepage": "https://github.com/rzvxa/tryumph#readme",
"homepage": "https://rzvxa.github.io/tryumph/",
"devDependencies": {

@@ -46,0 +48,0 @@ "@types/jest": "^29.5.11",

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