Comparing version 3.0.0 to 4.0.0
{ | ||
"name": "error", | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"description": "Custom errors", | ||
@@ -20,4 +20,6 @@ "keywords": [], | ||
"dependencies": { | ||
"xtend": "~2.1.1", | ||
"string-template": "~0.1.3" | ||
"assert": "^1.1.1", | ||
"camelize": "^0.1.2", | ||
"string-template": "~0.1.3", | ||
"xtend": "~2.1.1" | ||
}, | ||
@@ -24,0 +26,0 @@ "devDependencies": { |
11
typed.js
@@ -0,1 +1,3 @@ | ||
var assert = require("assert/") | ||
var camelize = require("camelize") | ||
var template = require("string-template") | ||
@@ -7,4 +9,13 @@ var extend = require("xtend/mutable") | ||
function TypedError(args) { | ||
assert(args, "args is required"); | ||
assert(args.type, "args.type is required") | ||
assert(args.message, "args.message is required") | ||
var message = args.message | ||
if (args.type && !args.name) { | ||
var errorName = camelize(args.type) + "Error" | ||
args.name = errorName[0].toUpperCase() + errorName.substr(1) | ||
} | ||
return function createError(opts) { | ||
@@ -11,0 +22,0 @@ var result = new Error() |
Sorry, the diff of this file is not supported yet
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
7074
80
4
+ Addedassert@^1.1.1
+ Addedcamelize@^0.1.2
+ Addedassert@1.5.1(transitive)
+ Addedcall-bind@1.0.7(transitive)
+ Addedcamelize@0.1.2(transitive)
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addedes-define-property@1.0.0(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-intrinsic@1.2.4(transitive)
+ Addedgopd@1.0.1(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedhas-proto@1.0.3(transitive)
+ Addedhas-symbols@1.0.3(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedinherits@2.0.3(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedobject.assign@4.1.5(transitive)
+ Addedset-function-length@1.2.2(transitive)
+ Addedutil@0.10.4(transitive)