Allow creating instance without new
This commit is contained in:
parent
69aec2fd4d
commit
3208ca2a44
|
@ -23,6 +23,10 @@
|
|||
*/
|
||||
|
||||
function Unit(amount, code) {
|
||||
if (!(this instanceof Unit)) {
|
||||
return new Unit(amount, code);
|
||||
}
|
||||
|
||||
this._value = this._from(amount, code);
|
||||
|
||||
var self = this;
|
||||
|
|
Loading…
Reference in New Issue