Download/mics

README suggests classes can be constructed using `new` but this does not appear to be the case.

Opened this issue · 2 comments

yyny commented

As shown and stated here.

Relevant example shown in README:

var looker = new Looker()     // > A looker is born!
looker.look()                 // > Looking good!
looker instanceof Looker      // true

Specifically, line 45 of index.js contains code which eventually returns an instance of (...args) => new Class(...args) (which has been like this for over 6 months ago), which cannot be called as a constructor (Since it is an arrow function).

new (() => {}); //=> Uncaught TypeError: (intermediate value) is not a constructor
                //=>    at <anonymous>:1:1

Using function(...args) { return new Class(...args) } instead would make the code work (without compilation) for platforms that disallow arrow functions as constructors (As required by ES6).

Yeah this is a bummer. I really like this library, powerful tool in my toolbelt. But the opinionated decision of trying to work around usingnew gets me down. Honestly I prefer new. It's easier to read when something is being instantiated in the middle of a few hundred lines of code.

Hi guys, I see what the problem is and will look at this soon.
Sorry for the late response but this is Open Source and I do it in my spare time.