Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@abasb75/fraction

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@abasb75/fraction

formula computer

latest
Source
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

add to your node js project :


npm install @abasb75/fraction --save

usage example :


import {compute , parse , renderTree} from '@abasb75/fraction';

const computeTest = compute('2+4');
console.log(computeTest);
//result : 6

const computeTest2 = compute('(2+4)/3',()=>{});
console.log(computeTest2);
//result : 2

const computeTest3 = compute('2/5*6/7',()=>{
    // this function execute when error occurred
    console.log('error')
});
console.log(computeTest3);
//result : 0.34285714285714286

const parseTest = parse('2+4',()=>{});
console.log(parseTest);
/*
result :
{
  type: 'plus',
  a: { type: 'number', value: '2' },
  b: { type: 'number', value: '4' }
}
*/


const renderTreeTest = renderTree('2+4',()=>{});
console.log(renderTreeTest);
/*
result :
+
├─ 2
└─ 4
}
*/

const parseInValid = parse('(3+',()=>{
    console.log('an error occurred')
})
//result : an error occurred


Keywords

react fraction

FAQs

Package last updated on 01 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts