Browse Source

Allow creating instance without new

patch-2
Yemel Jardi 10 years ago
parent
commit
3208ca2a44
  1. 4
      lib/unit.js

4
lib/unit.js

@ -23,6 +23,10 @@
*/ */
function Unit(amount, code) { function Unit(amount, code) {
if (!(this instanceof Unit)) {
return new Unit(amount, code);
}
this._value = this._from(amount, code); this._value = this._from(amount, code);
var self = this; var self = this;

Loading…
Cancel
Save