chemybal
v1.0.4
Published
Simple Chemical Equation Balancer
Downloads
10
Maintainers
Readme
📝 Description
chemybal - Simple chemical equation balancer. Calculates and inserts coefficients in any valid equation.
🔧 Setup
chemybal is easy to setup, just do:
npm i chemybal
📕 Usage
To require chemybal in your program do:
const chemybal = require("chemybal");
Ways to call chemybal from your program:
// Standard mode
const equation = "Mg + HCl → MgCl₂ + H₂";
console.log(chemybal(equation));
/* Output:
Mg + 2HCl → MgCl₂ + H₂
*/
// Coefficients Only - ^1.0.3
const equation = "H₂SO₄ + Cu → CuSO₄ + H₂O + SO₂"
console.log(chemybal.coefsOnly(equation));
/*
Output:
[ 2, 1, 1, 2, 1 ]
*/
📰 Notes
- (1.0.0 - 1.0.1) Equations with oxidation numbers result an incorrect result. Fixed in (^1.0.2)
- (^1.0.2) This module understands super/subscript numbers. No need to convert to normal numbers.
- (^1.0.2) In equations you can use both
"="
and"→"
. Module understands both.
👨⚖️ License
chemybal by EEHoveckis is licensed under a Creative Commons Attribution 4.0 International License.
Permissions beyond the scope of this license may be available on request.