https://github.com/chemicaltools/chemicaltools-js
Chemical Tools for Node.js
https://github.com/chemicaltools/chemicaltools-js
chemical javascript nodejs npm tools
Last synced: 6 months ago
JSON representation
Chemical Tools for Node.js
- Host: GitHub
- URL: https://github.com/chemicaltools/chemicaltools-js
- Owner: chemicaltools
- License: other
- Created: 2019-02-06T22:59:51.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2025-04-09T02:56:46.000Z (6 months ago)
- Last Synced: 2025-04-11T13:15:00.962Z (6 months ago)
- Topics: chemical, javascript, nodejs, npm, tools
- Language: JavaScript
- Size: 8.48 MB
- Stars: 2
- Watchers: 2
- Forks: 4
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# chemicaltools-js
[](https://996.icu)
[](https://github.com/njzjz/chemicaltools-js/blob/master/LICENSE.MIT)
[](https://github.com/njzjz/chemicaltools-js/blob/master/LICENSE.996ICU)
[](https://npmjs.com/package/chemicaltools)
[](https://codecov.io/gh/njzjz/chemicaltools-js)
[](https://npmjs.com/package/chemicaltools)
[](https://www.jsdelivr.com/package/npm/chemicaltools)Chemical Tools for JavaScript.
## Installion
### Install with npm
```sh
npm i chemicaltools
```And you can use in Node.js:
```js
chemicaltools = require('chemicaltools')
```### Use in a web page
Add script:
```html
```
## Usage
```js
console.log(JSON.stringify(chemicaltools.searchElement("Hf")));
// {"number":"72","name":"铪","symbol":"Hf","mass":"178.5","iupac":"Hafnium","origin":"Hafnia, the New Latin name for Copenhagen","pinyin":"ha","url":"https://i.loli.net/2018/03/31/5abf7a90c8da6.png"}
console.log(JSON.stringify(chemicaltools.calculateMass("C6H12O6")));
// {"name":"C6H12O6","mass":180.156,"peratom":[{"name":"氢","iupac":"Hydrogen","symbol":"H","atomnumber":12,"mass":"1.008","massper":6.714181043095984},{"name":"碳","iupac":"Carbon","symbol":"C","atomnumber":6,"mass":"12.01","massper":39.99866782122161},{"name":"氧","iupac":"Oxygen","symbol":"O","atomnumber":6,"mass":"16","massper":53.28715113568241}]}
console.log(JSON.stringify(chemicaltools.calculateGas(p = 3, V = 1, n = 1)));
// {"p":3,"V":1,"n":1,"T":0.36083714216983404}
console.log(JSON.stringify(chemicaltools.calculateAcid(0.1, [2, 7], true)));
// {"c":0.1,"pH":1.5683850420032601,"ion":[{"name":"H+","c":0.027015621187203295},{"name":"H2A","c":0.07298430582855843},{"name":"HA-","c":0.027015594171541573},{"name":"A2-","c":9.999989999984995e-8}]}
console.log(JSON.stringify(chemicaltools.calculateDeviation([2.232, 2.455, 2.742, 2.535, 2.362])));
// {"input":[2.232,2.455,2.742,2.535,2.362],"average":2.4652000000000003,"average_deviation":0.13864,"relative_average_deviation":0.05623884471848126,"standard_deviation":0.05160000000000009,"relative_standard_deviation":0.3721869590305834}
console.log(JSON.stringify(chemicaltools.makeQuestion("name", "iupac")));
// {"question":"铍","options":["Beryllium","Gallium","Lanthanum","Platinum"]}
console.log(JSON.stringify(chemicaltools.correctAnswer("铷", "Rubidiutm", "name", "iupac")));
// {"correct":false,"question":"铷","correct_answer":"Rubidium","answer":"Rubidiutm"}
```