Allow creating instance without new
This commit is contained in:
parent
69aec2fd4d
commit
3208ca2a44
@ -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…
Reference in New Issue
Block a user