Comparing version
@@ -82,3 +82,3 @@ var inherits = require('inherits') | ||
function getFunctionName (fn) { | ||
function getTypeName (fn) { | ||
return fn.name || fn.toString().match(/function (.*?)\s*\(/)[1] | ||
@@ -88,5 +88,3 @@ } | ||
function getValueTypeName (value) { | ||
if (native.Null(value)) return '' | ||
return getFunctionName(value.constructor) | ||
return native.Null(value) ? '' : getTypeName(value.constructor) | ||
} | ||
@@ -98,3 +96,2 @@ | ||
if (value && native.Object(value)) return '' | ||
return value | ||
@@ -104,3 +101,3 @@ } | ||
function tfJSON (type) { | ||
if (native.Function(type)) return type.toJSON ? type.toJSON() : getFunctionName(type) | ||
if (native.Function(type)) return type.toJSON ? type.toJSON() : getTypeName(type) | ||
if (native.Array(type)) return 'Array' | ||
@@ -133,4 +130,3 @@ if (type && native.Object(type)) return 'Object' | ||
tfJSON: tfJSON, | ||
getFunctionName: getFunctionName, | ||
getValueTypeName: getValueTypeName | ||
} |
{ | ||
"name": "typeforce", | ||
"version": "1.8.4", | ||
"version": "1.8.5", | ||
"description": "Another biased type checking solution for Javascript", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
424023
-0.01%19517
-0.01%