Socket
Socket
Sign inDemoInstall

erreur

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

erreur - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

25

dist/mod.d.ts

@@ -13,3 +13,2 @@ declare type ErreurInfos = {

message: string;
details?: any;
}>;

@@ -24,13 +23,15 @@ declare type ErreursMapCreate<Errors extends ErreursMapErrors> = {

} : never;
declare type FromTypes<Errors extends {
kind: string;
message: string;
}> = {
[K in Errors['kind']]: (...args: any[]) => Omit<Extract<Errors, {
kind: K;
}>, 'kind'>;
};
declare class ErreursMap<Errors extends ErreursMapErrors> {
static readonly Base: ErreursMap<{
UnknownError: (error: Error) => {
message: string;
error: Error;
};
Unknown: (error: unknown) => {
message: string;
error: unknown;
};
}>;
static fromType<Errors extends {
kind: string;
message: string;
}>(errors: FromTypes<Errors>): ErreursMap<FromTypes<Errors>>;
readonly errors: Errors;

@@ -57,2 +58,2 @@ /**

export { Erreur, ErreurInfos, ErreursMap, ErreursMapCreate, ErreursMapErrors, Expand };
export { Erreur, ErreurInfos, ErreursMap, ErreursMapCreate, ErreursMapErrors, Expand, FromTypes };

@@ -51,3 +51,3 @@ var __defProp = Object.defineProperty;

};
var _ErreursMap = class {
var ErreursMap = class {
constructor(errors) {

@@ -61,2 +61,5 @@ this.infered = null;

}
static fromType(errors) {
return new ErreursMap(errors);
}
is(val) {

@@ -93,7 +96,2 @@ if (val instanceof Erreur && val.kind in this.errors) {

};
var ErreursMap = _ErreursMap;
ErreursMap.Base = new _ErreursMap({
UnknownError: (error) => ({ message: error.message, error }),
Unknown: (error) => ({ message: String(error), error })
});
function isPromise(val) {

@@ -100,0 +98,0 @@ return Promise.resolve(val) === val;

{
"name": "erreur",
"version": "1.0.2",
"version": "1.1.0",
"description": "Type safe custom errors",

@@ -5,0 +5,0 @@ "keywords": [

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