Comparing version 1.0.0 to 1.0.1
@@ -12,2 +12,4 @@ function getName (value) { | ||
module.exports = function enforce (type, value) { | ||
var typeName = type | ||
if (typeof type === 'string') { | ||
@@ -95,3 +97,3 @@ if (type[0] === '?') { | ||
throw new TypeError('Expected ' + type + ', got ' + getName(value) + ' ' + value) | ||
throw new TypeError('Expected ' + typeName + ', got ' + getName(value) + ' ' + value) | ||
} |
{ | ||
"name": "typeforce", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Another biased type checking solution for Javascript", | ||
@@ -5,0 +5,0 @@ "main": "./index.js", |
@@ -76,2 +76,6 @@ { | ||
"value": [{ "a": 1 }, { "a": null }, {}] | ||
}, | ||
{ | ||
"type": "?", | ||
"value": null | ||
} | ||
@@ -436,4 +440,14 @@ ], | ||
"value": null | ||
}, | ||
{ | ||
"exception": "Expected \\?, got Number 1234", | ||
"type": "?", | ||
"value": 1234 | ||
}, | ||
{ | ||
"exception": "Expected \\?, got String foobar", | ||
"type": "?", | ||
"value": "foobar" | ||
} | ||
] | ||
} |
@@ -25,2 +25,3 @@ /* global describe, it */ | ||
fixtures.invalid.forEach(function (f) { | ||
assert(f.exception) | ||
var actualValue = f.custom ? CUSTOM_TYPES[f.custom] : f.value | ||
@@ -27,0 +28,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
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
0
16212
8
556