chemybal

1.0.3 • Public • Published

⚗️ chemybal

Simple Chemical Equation Balancer

📝 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.
Creative Commons Attribution 4.0 International License

/chemybal/

    Package Sidebar

    Install

    npm i chemybal

    Weekly Downloads

    3

    Version

    1.0.3

    License

    CC-BY-4.0

    Unpacked Size

    22.6 kB

    Total Files

    6

    Last publish

    Collaborators

    • eehoveckis