Socket
Socket
Sign inDemoInstall

err-code

Package Overview
Dependencies
Maintainers
2
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

err-code - npm Package Compare versions

Comparing version 2.0.3 to 3.0.0

.github/workflows/typecheck.yml

13

package.json
{
"name": "err-code",
"version": "2.0.3",
"version": "3.0.0",
"description": "Create an error with a code",
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"lint": "eslint '{*.js,test/**/*.js}' --ignore-pattern *.umd.js",
"check": "tsc --build",
"test": "mocha --bail",

@@ -29,7 +31,10 @@ "browserify": "browserify -s err-code index.js > index.umd.js"

"@satazor/eslint-config": "^3.0.0",
"browserify": "^16.5.1",
"eslint": "^7.2.0",
"@types/expect.js": "0.3.29",
"@types/mocha": "8.2.0",
"browserify": "^14.0.0",
"eslint": "^3.0.0",
"expect.js": "^0.3.1",
"mocha": "^8.0.1"
"mocha": "^3.0.2",
"typescript": "^4.1.3"
}
}

@@ -9,2 +9,3 @@ 'use strict';

it('should throw an error', () => {
// @ts-expect-error - strings are not supported
expect(() => { errcode('my message'); }).to.throwError((err) => {

@@ -19,2 +20,3 @@ expect(err).to.be.a(TypeError);

const myErr = new Error('my message');
// @ts-expect-error - more args are expected
const err = errcode(myErr);

@@ -112,2 +114,6 @@

class CustomError extends Error {
// eslint-disable-next-line valid-jsdoc
/**
* @param {any} val
*/
set code(val) {

@@ -140,2 +146,3 @@ throw new Error('Nope!');

it('should support errors that are not Errors', () => {
// @ts-expect-error - API not supported at type level
const err = errcode({

@@ -152,2 +159,3 @@ message: 'Oh noes!',

it('should not allow passing null as the first argument', () => {
// @ts-expect-error - null is not valid param
expect(() => { errcode(null); }).to.throwError((err) => {

@@ -159,2 +167,3 @@ expect(err).to.be.a(TypeError);

it('should not allow passing undefined as the first argument', () => {
// @ts-expect-error - undefined is not valid param
expect(() => { errcode(undefined); }).to.throwError((err) => {

@@ -161,0 +170,0 @@ expect(err).to.be.a(TypeError);

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