[Pkg-javascript-commits] [node-tap-mocha-reporter] 84/137: be a factory if not called as a constructor

Bastien Roucariès rouca at moszumanska.debian.org
Thu Sep 7 09:49:29 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-tap-mocha-reporter.

commit 82d78c3bdf434134089a45dbea7b0708570f55c4
Author: isaacs <i at izs.me>
Date:   Sun Jan 31 11:58:29 2016 -0800

    be a factory if not called as a constructor
    
    Fix #9
---
 index.js | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/index.js b/index.js
index e3a0343..46c5663 100755
--- a/index.js
+++ b/index.js
@@ -22,6 +22,9 @@ util.inherits(Formatter, Writable)
 
 var exitCode
 function Formatter (type, options) {
+  if (!(this instanceof Formatter)) {
+    return new Formatter(type, options)
+  }
   if (!reporters[type]) {
     console.error('Unknown format type: %s\n\n%s', type, avail())
     type = 'silent'

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-tap-mocha-reporter.git



More information about the Pkg-javascript-commits mailing list