avoiding new in classes

July 15, 2015 ยท View on GitHub

// Allows: // funkyParser()

module.exports = function createFunkyParser(opt) { return new FunkyParser(opt) }

function FunkyParser(opt) { // make params optional opt = opt || {}

this.foo = opt.foo || 'default'

// handle other options... ... }