express-statuses
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "express-statuses", | ||
"description": "Simple response statuses for Express 4.x", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Pier Fumagalli", |
@@ -10,14 +10,25 @@ 'use strict'; | ||
var status = { status: code, message: message }; | ||
if (! object) return status; | ||
var string = ''; | ||
if (typeof(object) === 'string') { | ||
status.message = object; | ||
} else if (object instanceof Error) { | ||
status.error = object; | ||
} else { | ||
if (object.message) status.message = object.message; | ||
if (object.details) status.details = object.details; | ||
if (object.error) status.error = object.error; | ||
if (object) { | ||
if (typeof(object) === 'string') { | ||
status.message = object; | ||
string = ': ' + object; | ||
} else if (object instanceof Error) { | ||
status.error = object; | ||
} else { | ||
if (object.message) { | ||
status.message = object.message; | ||
string = ': ' + object; | ||
} | ||
if (object.details) status.details = object.details; | ||
if (object.error) status.error = object.error; | ||
} | ||
} | ||
status.toString = function() { | ||
return this.status + " " + message + string; | ||
} | ||
return status; | ||
@@ -28,2 +39,5 @@ } | ||
made.message = message; | ||
made.toString = function() { | ||
return this.status + " " + this.message; | ||
} | ||
return made; | ||
@@ -40,3 +54,2 @@ }; | ||
.toUpperCase(); | ||
console.log('`' + name + '`: ' + code); | ||
@@ -43,0 +56,0 @@ // Make our new status function |
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
11098
143