Comparing version 0.0.7 to 0.0.8
@@ -100,19 +100,26 @@ var logMethods = ['error', 'warn', 'info', 'log', 'trace', 'debug']; | ||
}; | ||
logger.stringify = function stringify(object) { | ||
try { | ||
Object.defineProperty(object, 'IS_STRINGIFY_INITIATOR', { | ||
enumerable: false, | ||
value: true | ||
}); | ||
if (object === null) { | ||
return 'null'; | ||
} | ||
catch (e) { | ||
switch (typeof object) { | ||
case 'function': | ||
return object.toString(); | ||
case 'object': | ||
Object.defineProperty(object, 'IS_STRINGIFY_INITIATOR', { | ||
enumerable: false, | ||
value: true | ||
}); | ||
var isInitiated = false; | ||
var string = JSON.stringify(object, function (key, value) { | ||
value = value.IS_STRINGIFY_INITIATOR && isInitiated ? '[Circular]' : value; | ||
isInitiated = true; | ||
return value; | ||
}, jsonSpace); | ||
delete object.IS_STRINGIFY_INITIATOR; | ||
return string; | ||
default: | ||
return '' + object; | ||
} | ||
var isInitiated = false; | ||
var string = JSON.stringify(object, function (key, value) { | ||
value = value.IS_STRINGIFY_INITIATOR && isInitiated ? '[Circular]' : value; | ||
isInitiated = true; | ||
return value; | ||
}, jsonSpace); | ||
delete object.IS_STRINGIFY_INITIATOR; | ||
return string; | ||
}; | ||
@@ -119,0 +126,0 @@ |
@@ -15,3 +15,3 @@ { | ||
], | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"main": "cedar.js", | ||
@@ -18,0 +18,0 @@ "homepage": "http://github.com/zerious/cedar", |
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
12153
233