🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

fraction-math-js

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fraction-math-js - npm Package Compare versions

Comparing version
0.1.9
to
0.1.10
+5
-2
index.js

@@ -104,9 +104,9 @@ "use strict"

}
this.n=value[0];//numerator
this.d=value[1];//denominator
Object.defineProperties(this,{
"n":{
"value":value[0],//numerator
"writable":false
},
"d":{
"value":value[1],//denominator
"writable":false

@@ -125,2 +125,5 @@ }

}
valueOf(){
return this.toString();
}
toBigNumber(){

@@ -127,0 +130,0 @@ return this.n.dividedBy(this.d);

{
"name": "fraction-math-js",
"version": "0.1.9",
"version": "0.1.10",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -31,10 +31,12 @@ ## fraction-math-js

### Use
let x=F("1+2/3*5");//1+2/3*5 = 13/3
let x=F("1+2/3*5");//1+2/3*5 = 13/3 Infix
let y=F("1+",x);//1+x = 16/3
let z=F("+",1,y);//1+y = 19/3
let z=F("+",1,y);//1+y = 19/3 Prefix
let a=F(y,z,"+");//y+z = 35/3
let a=F(y,z,"+");//y+z = 35/3 Postfix
console.log("%s",F("+ 1 1"));//1+1=2 postfix and prefix need space
console.log(a.toString());//35/3

@@ -49,2 +51,5 @@

console.log(b.toString());//383/30
console.log(b.toBigNumber().toNumber());//12.766666666666667
### Run

@@ -51,0 +56,0 @@

"use strict"
let Frac=require("../").builder;
let assert=require('assert');
assert.ok((Frac("-1 + ( 2 + 3 ) * 5").toString())==="24","-1 + ( 2 + 3 ) * 5 = 24");//Infix -1+(2+3)*5=-1+5*5=-1+25=24
assert.ok(Frac("-1 + ( 2 + 3 ) * 5").toString()==="24","-1 + ( 2 + 3 ) * 5 = 24");//Infix -1+(2+3)*5=-1+5*5=-1+25=24
assert.ok(Frac("1 / 2").toString()==="1/2","1 / 2 = 1/2");//Infix 1/2=(1/2)

@@ -6,0 +6,0 @@ assert.ok(Frac("-1.1 + 1.1").toString()==="0","-1.1 + 1.1 = 0");//decimal -1.1+1.1=0