Comparing version 0.2.0 to 1.0.0
@@ -5,4 +5,8 @@ 'use strict'; | ||
var inherits = require('inherits'); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
var defekt = function defekt(errorDefinitions) { | ||
@@ -32,13 +36,23 @@ if (!errorDefinitions) { | ||
var CustomError = function CustomError(message, cause) { | ||
Reflect.apply(Error, this, []); | ||
var CustomError = function (_Error) { | ||
_inherits(CustomError, _Error); | ||
this.name = errorName; | ||
this.code = errorCode; | ||
this.message = message || ''; | ||
this.cause = cause; | ||
}; | ||
function CustomError() { | ||
var message = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; | ||
var cause = arguments[1]; | ||
inherits(CustomError, Error); | ||
_classCallCheck(this, CustomError); | ||
var _this = _possibleConstructorReturn(this, (CustomError.__proto__ || Object.getPrototypeOf(CustomError)).call(this)); | ||
_this.name = errorName; | ||
_this.code = errorCode; | ||
_this.message = message; | ||
_this.cause = cause; | ||
return _this; | ||
} | ||
return CustomError; | ||
}(Error); | ||
errors[errorName] = CustomError; | ||
@@ -45,0 +59,0 @@ }); |
'use strict'; | ||
const inherits = require('inherits'); | ||
const defekt = function (errorDefinitions) { | ||
@@ -29,13 +27,13 @@ if (!errorDefinitions) { | ||
const CustomError = function (message, cause) { | ||
Reflect.apply(Error, this, []); | ||
class CustomError extends Error { | ||
constructor (message = '', cause) { | ||
super(); | ||
this.name = errorName; | ||
this.code = errorCode; | ||
this.message = message || ''; | ||
this.cause = cause; | ||
}; | ||
this.name = errorName; | ||
this.code = errorCode; | ||
this.message = message; | ||
this.cause = cause; | ||
} | ||
} | ||
inherits(CustomError, Error); | ||
errors[errorName] = CustomError; | ||
@@ -42,0 +40,0 @@ }); |
{ | ||
"name": "defekt", | ||
"version": "0.2.0", | ||
"version": "1.0.0", | ||
"description": "defekt is custom errors made simple.", | ||
@@ -20,9 +20,7 @@ "contributors": [ | ||
"main": "dist/defekt.js", | ||
"dependencies": { | ||
"inherits": "2.0.3" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"assertthat": "0.10.3", | ||
"roboter": "0.15.4", | ||
"roboter-server": "0.15.4" | ||
"assertthat": "1.0.0", | ||
"roboter": "0.15.6", | ||
"roboter-server": "0.15.6" | ||
}, | ||
@@ -29,0 +27,0 @@ "repository": { |
@@ -78,3 +78,3 @@ # defekt | ||
The MIT License (MIT) | ||
Copyright (c) 2015-2017 the native web. | ||
Copyright (c) 2015-2018 the native web. | ||
@@ -81,0 +81,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
@@ -31,2 +31,3 @@ 'use strict'; | ||
'(MIT AND CC-BY-3.0)', | ||
'(MIT OR Apache-2.0)', | ||
'(WTFPL OR MIT)' | ||
@@ -33,0 +34,0 @@ ], |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
71210
0
226
1
8
- Removedinherits@2.0.3
- Removedinherits@2.0.3(transitive)