Socket
Book a DemoInstallSign in
Socket

chem-eb

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chem-eb

Simple Chemical Equation Balancing

0.1.18
latest
Source
npmnpm
Version published
Weekly downloads
54
107.69%
Maintainers
1
Weekly downloads
 
Created
Source

Sky chem

chemLogo

A friend's kid is going to high school. I wrote a Chemical Equation Balancing code for him.

Install

npm i chem-eb

Test

npm test

Use

// equation use ->, =, - as split string
let balanceEq = require('chem-eb')
console.log(balanceEq('P+O2=P2O5')) // 4P + 5O2 = 2P2O5

// over-determined equation 会用到超定方程求解
console.log(balanceEq('Fe2S3O12+NaOH=Na2SO4+FeO3H3')) // Fe2S3O12 + 6NaOH = 3Na2SO4 + 2FeO3H3

console.log(balanceEq('Ca + NO3 -> Ca(NO3)2')) //  Ca + 2NO3 = Ca(NO3)2
console.log(balanceEq('Fe + Cl -> FeCl3')) // Fe + 3Cl = FeCl3
console.log(balanceEq('Ca(No3)2 + K3PO4 = Ca3(PO4)2 + KNo3')) //3Ca(No3)2 + 2K3PO4 = Ca3(PO4)2 + 6KNo3
console.log(
  balanceEq('K2Cr2O7 + H2SO4 + C2H5OH -> K2SO4 + Cr2(SO4)3 + H2O + CH3COOH') //2K2Cr2O7 + 8H2SO4 + 3C2H5OH = 2K2SO4 + 2Cr2(SO4)3 + 11H2O + 3CH3COOH
)

NOTICE:

when (OH)2 pls O2H2 input

TODO:

  • over-determined equation
  • Chemical functional groups unfold

Keywords

Chemical

FAQs

Package last updated on 16 Jan 2025

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.