Socket
Socket
Sign inDemoInstall

@blackglory/errors

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blackglory/errors - npm Package Compare versions

Comparing version 1.1.2 to 2.0.0

17

dist/es2015/index.umd.js

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Errors = {}));
}(this, (function (exports) { 'use strict';
})(this, (function (exports) { 'use strict';

@@ -14,5 +14,2 @@ class CustomError extends Error {

class ExpectedError extends CustomError {
}
class AssertionError extends CustomError {

@@ -31,10 +28,2 @@ }

/**
* @throws {ExpectedError}
*/
function refute(condition, message) {
if (condition)
throw new ExpectedError(message);
}
/**
* @throws {AssertionError}

@@ -49,10 +38,8 @@ */

exports.CustomError = CustomError;
exports.ExpectedError = ExpectedError;
exports.assert = assert;
exports.normalize = normalize;
exports.refute = refute;
Object.defineProperty(exports, '__esModule', { value: true });
})));
}));
//# sourceMappingURL=index.umd.js.map

2

dist/es2015/index.umd.min.js

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Errors={})}(this,(function(e){"use strict";class t extends Error{get name(){return this.constructor.name}}class n extends t{}class r extends t{}e.AssertionError=r,e.CustomError=t,e.ExpectedError=n,e.assert=function(e,t){if(!e)throw new r(t)},e.normalize=function(e){var t;return{name:e.name,message:e.message,stack:null!==(t=e.stack)&&void 0!==t?t:null}},e.refute=function(e,t){if(e)throw new n(t)},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).Errors={})}(this,(function(e){"use strict";class n extends Error{get name(){return this.constructor.name}}class t extends n{}e.AssertionError=t,e.CustomError=n,e.assert=function(e,n){if(!e)throw new t(n)},e.normalize=function(e){var n;return{name:e.name,message:e.message,stack:null!==(n=e.stack)&&void 0!==n?n:null}},Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=index.umd.min.js.map

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Errors = {}));
}(this, (function (exports) { 'use strict';
})(this, (function (exports) { 'use strict';

@@ -14,5 +14,2 @@ class CustomError extends Error {

class ExpectedError extends CustomError {
}
class AssertionError extends CustomError {

@@ -31,10 +28,2 @@ }

/**
* @throws {ExpectedError}
*/
function refute(condition, message) {
if (condition)
throw new ExpectedError(message);
}
/**
* @throws {AssertionError}

@@ -49,10 +38,8 @@ */

exports.CustomError = CustomError;
exports.ExpectedError = ExpectedError;
exports.assert = assert;
exports.normalize = normalize;
exports.refute = refute;
Object.defineProperty(exports, '__esModule', { value: true });
})));
}));
//# sourceMappingURL=index.umd.js.map

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Errors={})}(this,(function(e){"use strict";class t extends Error{get name(){return this.constructor.name}}class n extends t{}class r extends t{}e.AssertionError=r,e.CustomError=t,e.ExpectedError=n,e.assert=function(e,t){if(!e)throw new r(t)},e.normalize=function(e){var t;return{name:e.name,message:e.message,stack:null!==(t=e.stack)&&void 0!==t?t:null}},e.refute=function(e,t){if(e)throw new n(t)},Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).Errors={})}(this,(function(e){"use strict";class n extends Error{get name(){return this.constructor.name}}class t extends n{}e.AssertionError=t,e.CustomError=n,e.assert=function(e,n){if(!e)throw new t(n)},e.normalize=function(e){var n;return{name:e.name,message:e.message,stack:null!==(n=e.stack)&&void 0!==n?n:null}},Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=index.umd.min.js.map

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

export declare function assert(condition: unknown, message?: string): asserts condition;
export declare function assert(condition: unknown, message: string): asserts condition;
export * from './custom-error';
export * from './expected-error';
export * from './assertion-error';
export * from './normalize';
export * from './refute';
export * from './assert';

@@ -14,7 +14,5 @@ "use strict";

__exportStar(require("./custom-error"), exports);
__exportStar(require("./expected-error"), exports);
__exportStar(require("./assertion-error"), exports);
__exportStar(require("./normalize"), exports);
__exportStar(require("./refute"), exports);
__exportStar(require("./assert"), exports);
//# sourceMappingURL=index.js.map

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

export declare function assert(condition: unknown, message?: string): asserts condition;
export declare function assert(condition: unknown, message: string): asserts condition;
export * from './custom-error';
export * from './expected-error';
export * from './assertion-error';
export * from './normalize';
export * from './refute';
export * from './assert';

@@ -14,7 +14,5 @@ "use strict";

__exportStar(require("./custom-error"), exports);
__exportStar(require("./expected-error"), exports);
__exportStar(require("./assertion-error"), exports);
__exportStar(require("./normalize"), exports);
__exportStar(require("./refute"), exports);
__exportStar(require("./assert"), exports);
//# sourceMappingURL=index.js.map
{
"name": "@blackglory/errors",
"version": "1.1.2",
"version": "2.0.0",
"description": "Common errors",

@@ -43,24 +43,23 @@ "files": [

"devDependencies": {
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@rollup/plugin-typescript": "^8.1.1",
"@types/jest": "^26.0.20",
"@types/node": "^14.14.22",
"@typescript-eslint/eslint-plugin": "^4.14.2",
"@typescript-eslint/parser": "^4.14.2",
"eslint": "^7.19.0",
"@commitlint/cli": "^16.0.2",
"@commitlint/config-conventional": "^16.0.0",
"@rollup/plugin-typescript": "^8.3.0",
"@types/jest": "^27.4.0",
"@typescript-eslint/eslint-plugin": "^5.9.1",
"@typescript-eslint/parser": "^5.9.1",
"eslint": "^8.6.0",
"husky": "^4.3.8",
"jest": "^26.6.3",
"jest": "^27.4.7",
"npm-run-all": "^4.1.5",
"return-style": "^0.11.5",
"return-style": "^0.12.6",
"rimraf": "^3.0.2",
"rollup": "^2.38.4",
"rollup": "^2.63.0",
"rollup-plugin-terser": "^7.0.2",
"standard-version": "^9.1.0",
"ts-jest": "^26.5.0",
"standard-version": "^9.3.2",
"ts-jest": "^27.0.7",
"tscpaths": "^0.0.9",
"tsd": "^0.14.0",
"tslib": "^2.1.0",
"typescript": "^4.1.3"
"tsd": "^0.19.1",
"tslib": "^2.3.1",
"typescript": "^4.5.4"
}
}
# errors
Common errors.
## Install
```sh

@@ -14,5 +12,3 @@ npm install --save @blackglory/errors

## API
### Interfaces
```ts

@@ -29,3 +25,2 @@ type CustomErrorConstructor<T extends CustomError = CustomError> = new (message?: string) => T

### CustomError
```ts

@@ -35,10 +30,3 @@ class CustomError extends Error {}

### ExpectedError
```ts
class ExpectedError extends CustomError {}
```
### AssertionError
```ts

@@ -49,3 +37,2 @@ class AssertionError extends CustomError {}

### normalize
```ts

@@ -56,3 +43,2 @@ function normalize(err: Error): SerializableError

### assert
```ts

@@ -62,14 +48,3 @@ /**

*/
function assert(condition: unknown, message?: string): asserts condition
function assert(condition: unknown, message: string): asserts condition
```
### refute
```ts
/**
* @throws {ExpectedError}
*/
function refute(condition: unknown, message?: string): void
```
A negative assertion, expects the condition to be falsy.

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

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

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

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

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