@@ -8,9 +8,13 @@ exports.version = require('../package.json').version;
88
99// Helper function to detect if an object can be directly serializable
1010var isSerializable = function ( input , onlyPrimitives , options ) {
11- if ( typeof input === 'boolean' ||
12- typeof input === 'number' || input === null ||
13- input instanceof Date ) {
11+ if (
12+ typeof input === 'boolean' ||
13+ typeof input === 'number' ||
14+ typeof input === 'function' ||
15+ input === null ||
16+ input instanceof Date
17+ ) {
1418 return true ;
1519 }
1620 if ( typeof input === 'string' && input . indexOf ( '\n' ) === - 1 ) {
@@ -50,6 +54,10 @@ var addColorToData = function(input, options) {
5054 if ( typeof input === 'number' ) {
5155 return colors [ options . numberColor ] ( sInput ) ;
5256 }
57+ if ( typeof input === 'function' ) {
58+ return 'function() {}' ;
59+ }
60+
5361 if ( Array . isArray ( input ) ) {
5462 return input . join ( ', ' ) ;
5563 }
@@ -70,7 +78,7 @@ var renderToArray = function(data, options, indentation) {
7078 return [ Utils . indent ( indentation ) + addColorToData ( data , options ) ] ;
7179 }
7280
73- //unserializable string means it's multiline
81+ // Unserializable string means it's multiline
7482 if ( typeof data === 'string' ) {
7583 return [
7684 Utils . indent ( indentation ) + '"""' ,
0 commit comments