Comparing version 3.2.0 to 3.2.1
@@ -15,2 +15,9 @@ # Changelog | ||
# v3.2.1 | ||
- **Bug Fix** | ||
- fix missing path argument in FuncType | ||
- **Polish** | ||
- better stringify serialization for functions | ||
# v3.2.0 | ||
@@ -17,0 +24,0 @@ |
@@ -51,10 +51,11 @@ var assert = require('./assert'); | ||
function FuncType(value, curried) { | ||
function FuncType(value, path) { | ||
if (!isInstrumented(value)) { // automatically instrument the function | ||
return FuncType.of(value, curried); | ||
return FuncType.of(value); | ||
} | ||
if (process.env.NODE_ENV !== 'production') { | ||
assert(FuncType.is(value), function () { return 'Invalid value ' + assert.stringify(value) + ' supplied to ' + displayName; }); | ||
path = path || [displayName]; | ||
assert(FuncType.is(value), function () { return 'Invalid value ' + assert.stringify(value) + ' supplied to ' + path.join('/'); }); | ||
} | ||
@@ -61,0 +62,0 @@ |
@@ -0,4 +1,13 @@ | ||
var getFunctionName = require('./getFunctionName'); | ||
function replacer(key, value) { | ||
if (typeof value === 'function') { | ||
return getFunctionName(value); | ||
} | ||
return value; | ||
} | ||
module.exports = function stringify(x) { | ||
try { // handle "Converting circular structure to JSON" error | ||
return JSON.stringify(x, null, 2); | ||
return JSON.stringify(x, replacer, 2); | ||
} | ||
@@ -5,0 +14,0 @@ catch (e) { |
{ | ||
"name": "tcomb", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"description": "Type checking and DDD for JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
86958
1907