{"id":15023313,"url":"https://github.com/osofem/molecules","last_synced_at":"2026-03-06T06:32:17.579Z","repository":{"id":57301187,"uuid":"98414262","full_name":"osofem/molecules","owner":"osofem","description":"Get atoms from a molucular formula","archived":false,"fork":false,"pushed_at":"2022-02-08T12:09:22.000Z","size":37,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-10T04:55:48.522Z","etag":null,"topics":["atom","chemistry","compounds","elements","formula","molecule"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/osofem.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-07-26T11:12:13.000Z","updated_at":"2022-11-24T07:07:17.000Z","dependencies_parsed_at":"2022-09-10T10:15:46.389Z","dependency_job_id":null,"html_url":"https://github.com/osofem/molecules","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/osofem/molecules","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osofem%2Fmolecules","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osofem%2Fmolecules/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osofem%2Fmolecules/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osofem%2Fmolecules/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osofem","download_url":"https://codeload.github.com/osofem/molecules/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osofem%2Fmolecules/sbom","scorecard":{"id":713780,"data":{"date":"2025-08-11","repo":{"name":"github.com/osofem/molecules","commit":"5c4bb7dee8369d7c3ffb89b3b2ccacf6cef32a97"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/14 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":4,"reason":"6 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T08:54:16.372Z","repository_id":57301187,"created_at":"2025-08-22T08:54:16.372Z","updated_at":"2025-08-22T08:54:16.372Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30164594,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T04:43:31.446Z","status":"ssl_error","status_checked_at":"2026-03-06T04:40:30.133Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["atom","chemistry","compounds","elements","formula","molecule"],"created_at":"2024-09-24T19:58:56.384Z","updated_at":"2026-03-06T06:32:17.551Z","avatar_url":"https://github.com/osofem.png","language":"TypeScript","readme":"# molecules.js\r\n\r\nGet the number of each atom from a molecular formula\r\n\r\n### Installation\r\n\r\n```javascript\r\nnpm i molecules.js\r\n```\r\n  \r\n### Usage\r\n\r\n```javascript\r\nconst Molecules = require('molecules.js');\r\nconst mc = new Molecules();\r\nconsole.log(mc.getMolecules(\"H2O\")); //This logs object {H:2, O: 1}\r\nconsole.log(mc.getMolecules(\"H2SO4\")); //This logs object {H:2, S: 1, O: 4}\r\nconsole.log(mc.getMolecules(\"C6H12O6\")); //This logs object {C: 6, H: 12, O: 6}\r\nconsole.log(mc.getMolecules(\"C17H21NO4\")); //This logs object {C: 17, H: 21, N: 1, O: 4}\r\nconsole.log(mc.getMolecules(\"Mg(OH)2\")); //This logs object {Mg: 1, O: 2, H: 2}\r\nconsole.log(mc.getMolecules(\"K4[ON(SO3)2]2\")); //This logs object {K: 4, O: 14, N: 2, S: 4}\r\nconsole.log(mc.getMolecules(\"(C5H5)Fe(CO)2CH3\")); //This logs object {C: 8, H: 8, Fe: 1, O: 2}\r\nconsole.log(mc.getMolecules(\"{[Co(NH3)4(OH)2]3Co}(SO4)3\")); //This logs object {Co: 4, N: 12, H: 42, O: 18, S: 3}\r\nconsole.log(mc.getMolecules(\"2Na3PO4.12H2O\")); //This logs object { Na: 6, P: 2, O: 20, H: 24 }\r\nconsole.log(mc.getMolecules(\"2Na3PO4.12H2O.P9\")); //This logs object { Na: 6, P: 11, O: 20, H: 24 });\r\n```\r\n\r\n### Rule\r\n1. The atomic symbols should always start with a capital letter followed by a small letter if the symbol is double lettered. E.g. `H` - Hydrogen, `C` - Carbon, `O` - Oxygen, `Co` - Cobalt (not CO), `CO` - Carbon Monoxide.\r\n2. The `()`, `[]` and or `{}` brackets can be used to group the elements but should be properly nested.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosofem%2Fmolecules","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosofem%2Fmolecules","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosofem%2Fmolecules/lists"}