fraction-math-js
Advanced tools
+16
-8
@@ -104,4 +104,12 @@ "use strict" | ||
| } | ||
| this.getn=()=>value[0]; | ||
| this.getd=()=>value[1]; | ||
| this.n=value[0];//numerator | ||
| this.d=value[1];//denominator | ||
| Object.defineProperties(this,{ | ||
| "n":{ | ||
| "writable":false | ||
| }, | ||
| "d":{ | ||
| "writable":false | ||
| } | ||
| }); | ||
| //define closure function for read the value; | ||
@@ -114,2 +122,8 @@ } | ||
| } | ||
| toJSON(){ | ||
| return this.toString(); | ||
| } | ||
| toBigNumber(){ | ||
| return this.n.dividedBy(this.d); | ||
| } | ||
| plus(y){ | ||
@@ -152,8 +166,2 @@ let x=this; | ||
| } | ||
| get n(){//numerator | ||
| return this.getn(); | ||
| } | ||
| get d(){//denominator | ||
| return this.getd(); | ||
| } | ||
| get value(){ | ||
@@ -160,0 +168,0 @@ return [this.n,this.d];//get value |
+1
-1
| { | ||
| "name": "fraction-math-js", | ||
| "version": "0.1.7", | ||
| "version": "0.1.8", | ||
| "description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
21452
0.5%219
3.79%