From 9aae77fd837f7a6ae9d8678e3695282bf1573881 Mon Sep 17 00:00:00 2001 From: Scott Thompson Date: Sat, 2 Sep 2017 14:32:21 +0100 Subject: [PATCH] Allow function to be passed & executed if enabled https://github.com/visionmedia/debug/issues/370#issuecomment-294376790 --- src/debug.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/debug.js b/src/debug.js index 77e6384a..c5417f72 100644 --- a/src/debug.js +++ b/src/debug.js @@ -221,5 +221,6 @@ function enabled(name) { function coerce(val) { if (val instanceof Error) return val.stack || val.message; + if (typeof val === 'function') return val(); return val; }