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

ts-errorflow

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ts-errorflow - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0

10

dist/index.d.ts

@@ -1,5 +0,5 @@

export declare const EitherErrorSymbol: unique symbol;
export interface IError {
either_error_symbol: Symbol;
}
export declare const AnErrorSymbol: unique symbol;
export declare type IError = {
[AnErrorSymbol]?: Symbol;
};
/**

@@ -13,3 +13,3 @@ * Checks an object to verify whether it represents a failure. Will return true if the checked object

*/
export declare function isError<T, U extends {}>(either: T | U): either is U;
export declare function isError<T, U>(either: T | U): either is U;
/**

@@ -16,0 +16,0 @@ * Augments a given object with the either error symbol. This guarantees that it when checked

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.EitherErrorSymbol = Symbol('EitherError');
exports.AnErrorSymbol = Symbol('AnErrorSymbol');
/**

@@ -13,5 +13,4 @@ * Checks an object to verify whether it represents a failure. Will return true if the checked object

function isError(either) {
const candidateFailure = either;
if (candidateFailure.either_error_symbol) {
return candidateFailure.either_error_symbol === exports.EitherErrorSymbol;
if (either[exports.AnErrorSymbol]) {
return either[exports.AnErrorSymbol] === exports.AnErrorSymbol;
}

@@ -34,5 +33,5 @@ return false;

}
error.either_error_symbol = exports.EitherErrorSymbol;
error[exports.AnErrorSymbol] = exports.AnErrorSymbol;
return error;
}
exports.makeError = makeError;
{
"name": "ts-errorflow",
"version": "1.0.1",
"version": "2.0.0",
"description": "A simple zero dependency TypeScript empowered implementation of an Either construct for improved control flow and error handling",

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

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