preconditions 3.0.1 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/errr/validator.js
CHANGED
|
@@ -89,7 +89,7 @@ class ErrrValidator {
|
|
|
89
89
|
*/
|
|
90
90
|
static shouldBeObject(val, message, template) {
|
|
91
91
|
function doesFail() {
|
|
92
|
-
return !
|
|
92
|
+
return !(val !== null && (typeof val === "object" || typeof val === "function"));
|
|
93
93
|
}
|
|
94
94
|
|
|
95
95
|
message = message || constants.ShouldBeObject;
|
|
@@ -105,7 +105,7 @@ class ErrrValidator {
|
|
|
105
105
|
*/
|
|
106
106
|
static shouldNotBeObject(val, message, template) {
|
|
107
107
|
function doesFail() {
|
|
108
|
-
return
|
|
108
|
+
return val !== null && (typeof val === "object" || typeof val === "function");
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
message = message || constants.ShouldNotBeObject;
|
|
@@ -18,10 +18,10 @@ var validate = {
|
|
|
18
18
|
},
|
|
19
19
|
|
|
20
20
|
shouldBeObject: function (val) {
|
|
21
|
-
return !
|
|
21
|
+
return !(val !== null && (typeof val === "object" || typeof val === "function"));
|
|
22
22
|
},
|
|
23
23
|
shouldNotBeObject: function (val) {
|
|
24
|
-
return
|
|
24
|
+
return (val !== null && (typeof val === "object" || typeof val === "function"));
|
|
25
25
|
},
|
|
26
26
|
|
|
27
27
|
shouldBeEmpty: function (val) {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "preconditions",
|
|
3
3
|
"author": "Cory Parrish",
|
|
4
4
|
"main": "./lib/preconditions.js",
|
|
5
|
-
"version": "3.0.
|
|
5
|
+
"version": "3.0.2",
|
|
6
6
|
"description": "Support for Precondition error checking in Node.js.",
|
|
7
7
|
"homepage": "https://github.com/corybill/preconditions",
|
|
8
8
|
"bugs": {
|