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 2.0.0 to 2.1.0

6

dist/mod.d.ts

@@ -25,2 +25,6 @@ declare const INTERNAL: unique symbol;

private [INTERNAL];
/**
* If the data is an object with a message property, it will be used as the error message
* Otherwise, the error message will be the name of the error and the data as a JSON string
*/
static readonly DEFAULT_MESSAGE: GetMessage<any>;

@@ -71,2 +75,3 @@ /**

static readonly declareMany: typeof declareMany;
static readonly declareEmpty: typeof declareEmpty;
readonly erreurCause?: Erreur;

@@ -97,2 +102,3 @@ cause?: Error | undefined;

}> | undefined;
declare function declareEmpty(name: string, message?: string | GetMessage<never>): ErreurDeclaration<never>;
declare function declareWithTransform<Data, Params extends readonly any[]>(name: string, transform: (...params: Params) => Data, message?: string | GetMessage<Data>): ErreurDeclaration<Data, Params>;

@@ -99,0 +105,0 @@ declare type CreatorsBase = Record<string, (...args: any[]) => any>;

11

dist/mod.js

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

INTERNAL;
Erreur.DEFAULT_MESSAGE = (data, declaration) => `${declaration.name} ${JSON.stringify(data)}`;
Erreur.DEFAULT_MESSAGE = (data, declaration) => {
if (data && "message" in data && typeof data.message === "string") {
return data.message;
}
return `${declaration.name} ${JSON.stringify(data)}`;
};
Erreur.wrap = wrap;

@@ -89,2 +94,3 @@ Erreur.wrapAsync = wrapAsync;

Erreur.declareMany = declareMany;
Erreur.declareEmpty = declareEmpty;
function wrap(fn, onError) {

@@ -170,2 +176,5 @@ try {

}
function declareEmpty(name, message) {
return declareWithTransform(name, () => null, message);
}
function declareWithTransform(name, transform, message) {

@@ -172,0 +181,0 @@ return Erreur.declare(name, message).withTransform(transform);

2

package.json
{
"name": "erreur",
"version": "2.0.0",
"version": "2.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