{"_id":"@ameyanagi/chemical-formula","_rev":"2-4c7c4a27c50b6d1fbb2a8ba4d2288e6e","name":"@ameyanagi/chemical-formula","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.2":{"name":"@ameyanagi/chemical-formula","version":"0.1.2","license":"MIT OR Apache-2.0","_id":"@ameyanagi/chemical-formula@0.1.2","maintainers":[{"name":"ameyanagi","email":"ryuichi@ameyanagi.com"}],"homepage":"https://github.com/Ameyanagi/chemical-formula-rs#readme","bugs":{"url":"https://github.com/Ameyanagi/chemical-formula-rs/issues"},"dist":{"shasum":"447284d9041294af7e15ae70b6dd5a093a21395d","tarball":"https://registry.npmjs.org/@ameyanagi/chemical-formula/-/chemical-formula-0.1.2.tgz","fileCount":7,"integrity":"sha512-WH704r4q31A4Co8S+ztmnzceeRGqdh+cw7pGw0R0qkSD7ofG9zVMqxh14AvRuVGiAIbKxLhBuG64Oq4earqf3Q==","signatures":[{"sig":"MEUCIQClzH6/Gy7eJxRQkySWoDaHqLXmga3o4wWYcXb00IqkmQIgFrYPIedDN3FlZ/Z6LB7lqPYNtEPk5Zhs7KDjItzHDJA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":212523},"main":"chemical_formula_wasm.js","types":"chemical_formula_wasm.d.ts","exports":{".":{"node":"./chemical_formula_wasm.js","types":"./chemical_formula_wasm.d.ts"}},"gitHead":"e8703d50ffff357226c85b9cc0895217eed59f50","_npmUser":{"name":"ameyanagi","email":"ryuichi@ameyanagi.com"},"repository":{"url":"git+https://github.com/Ameyanagi/chemical-formula-rs.git","type":"git","directory":"bindings/wasm"},"_npmVersion":"11.11.0","description":"Chemical formula parser with catalyst loading notation support","directories":{},"sideEffects":false,"_nodeVersion":"24.14.1","collaborators":["Ameyanagi <contact@ameyanagi.com>"],"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/chemical-formula_0.1.2_1779500630972_0.07736611445917752","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@ameyanagi/chemical-formula","collaborators":["Ameyanagi <contact@ameyanagi.com>"],"description":"Chemical formula parser with catalyst loading notation support","version":"0.1.3","license":"MIT OR Apache-2.0","repository":{"type":"git","url":"git+https://github.com/Ameyanagi/chemical-formula-rs.git","directory":"bindings/wasm"},"main":"chemical_formula_wasm.js","types":"chemical_formula_wasm.d.ts","sideEffects":false,"exports":{".":{"types":"./chemical_formula_wasm.d.ts","node":"./chemical_formula_wasm.js"}},"gitHead":"e4b43d321c5f5c3fd45b3a1156b973d6670ab36b","_id":"@ameyanagi/chemical-formula@0.1.3","bugs":{"url":"https://github.com/Ameyanagi/chemical-formula-rs/issues"},"homepage":"https://github.com/Ameyanagi/chemical-formula-rs#readme","_nodeVersion":"24.15.0","_npmVersion":"11.15.0","dist":{"integrity":"sha512-sQ6b28Bg0iTusu8CcOaUL0t1UDkrWrEDCgSro63hrBr1gXG3d3fjnC7UKO7+9SybtjMobLn4S3YRC91pvcxYow==","shasum":"0becf1afb0e2a094d5b5bf4809d8a826f36dacc4","tarball":"https://registry.npmjs.org/@ameyanagi/chemical-formula/-/chemical-formula-0.1.3.tgz","fileCount":7,"unpackedSize":214076,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@ameyanagi%2fchemical-formula@0.1.3","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCOlX4WGcAyCjMj3xQwDGL9NHtu0IPxZPTtfSfnOxfkrQIhAM6VPV/DBXSVecNZm3n6XiUsw3Rdt00caCG9PQh+OgvF"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:c45cde59-b8b0-4bc7-8b71-85b98041394a"}},"directories":{},"maintainers":[{"name":"ameyanagi","email":"ryuichi@ameyanagi.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/chemical-formula_0.1.3_1779574719816_0.9730257177912562"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-23T01:43:50.878Z","modified":"2026-05-23T22:18:40.286Z","0.1.2":"2026-05-23T01:43:51.159Z","0.1.3":"2026-05-23T22:18:39.980Z"},"bugs":{"url":"https://github.com/Ameyanagi/chemical-formula-rs/issues"},"license":"MIT OR Apache-2.0","homepage":"https://github.com/Ameyanagi/chemical-formula-rs#readme","repository":{"type":"git","url":"git+https://github.com/Ameyanagi/chemical-formula-rs.git","directory":"bindings/wasm"},"description":"Chemical formula parser with catalyst loading notation support","maintainers":[{"name":"ameyanagi","email":"ryuichi@ameyanagi.com"}],"readme":"# @ameyanagi/chemical-formula\n\nWASM/Node.js bindings for the Rust `chemical-formula` parser.\n\nUse this package to parse chemical formulas, convert between molecular and\nweight-percent representations, and calculate molecular weights. It supports\nordinary formulas such as `H2O`, weight-percent annotations such as\n`Pt5wt%/SiO2`, and flexible catalyst loading notation such as `1%Pt/SiO2`,\n`Pt1%/SiO2`, and `1wt%Pt@SiO2`.\n\n## Installation\n\n```sh\nnpm install @ameyanagi/chemical-formula\n```\n\nWith Bun:\n\n```sh\nbun add @ameyanagi/chemical-formula\n```\n\n## Quick Start\n\n```ts\nimport {\n  molecularWeight,\n  parseFormula,\n  toMolecularFormula,\n  toWtPercent,\n} from \"@ameyanagi/chemical-formula\";\n\nconst catalyst = parseFormula(\"1%Pt/SiO2\");\n\nconsole.log(catalyst);\n// {\n//   formula: \"Pt1wt%O2Si\",\n//   elements: [\"O\", \"Si\", \"Pt\"],\n//   stoichiometry: { O: 2, Si: 1 },\n//   wt_percent: { Pt: 1 }\n// }\n\nconst molecular = toMolecularFormula(\"1%Pt/SiO2\");\nconsole.log(molecular.stoichiometry.Pt);\n// 0.0031109624054201776\n\nconst water = toWtPercent(\"H2O\");\nconsole.log(water.wt_percent);\n// { H: 11.19067443796836, O: 88.80932556203165 }\n\nconsole.log(molecularWeight(\"H2O\"));\n// 18.015\n```\n\n## API\n\n```ts\ntype FormulaSummary = {\n  formula: string;\n  elements: string[];\n  stoichiometry: Record<string, number>;\n  wt_percent: Record<string, number>;\n};\n```\n\n- `parseFormula(input: string): FormulaSummary`\n- `toMolecularFormula(input: string): FormulaSummary`\n- `toWtPercent(input: string): FormulaSummary`\n- `molecularWeight(input: string): number`\n\nAll parsing and conversion errors are thrown as JavaScript errors.\n\n## Supported Notation Examples\n\nThese examples all describe 1 wt% Pt on silica:\n\n```ts\nparseFormula(\"1%Pt/SiO2\");\nparseFormula(\"Pt1%/SiO2\");\nparseFormula(\"1wt%Pt/SiO2\");\nparseFormula(\"Pt1wt%/SiO2\");\nparseFormula(\"1wt%Pt@SiO2\");\nparseFormula(\"1 wt % Pt / SiO2\");\n```\n\nBare `%` is interpreted as `wt%`.\n\nNested materials are supported:\n\n```ts\nconst composite = toWtPercent(\"(Pt5wt%/SiO2)50wt%(CeO2)50wt%\");\n\nconsole.log(composite.wt_percent.Pt);\n// 2.5000000000000004\n```\n\n## Package Notes\n\nThis package is generated from the Rust crate with `wasm-pack` and targets\nNode.js-compatible runtimes.\n","readmeFilename":"README.md"}