{"id":20129386,"url":"https://github.com/ryanmorr/bem","last_synced_at":"2026-05-28T23:31:19.068Z","repository":{"id":70575038,"uuid":"93336223","full_name":"ryanmorr/bem","owner":"ryanmorr","description":"Simple jQuery-like library to traverse and modify components according to the BEM methodology","archived":false,"fork":false,"pushed_at":"2024-01-24T18:42:50.000Z","size":243,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-01T00:22:28.681Z","etag":null,"topics":["bem","dom","javascript"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryanmorr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-04T19:22:31.000Z","updated_at":"2024-01-24T17:38:49.000Z","dependencies_parsed_at":"2024-11-13T20:35:40.739Z","dependency_job_id":"f817e207-f462-4aa7-a382-21651c40ba2e","html_url":"https://github.com/ryanmorr/bem","commit_stats":{"total_commits":48,"total_committers":1,"mean_commits":48.0,"dds":0.0,"last_synced_commit":"8bb859f257e33bb43f95b3b8fd1db8085c3c47aa"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/ryanmorr/bem","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanmorr%2Fbem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanmorr%2Fbem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanmorr%2Fbem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanmorr%2Fbem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanmorr","download_url":"https://codeload.github.com/ryanmorr/bem/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanmorr%2Fbem/sbom","scorecard":{"id":792236,"data":{"date":"2025-08-11","repo":{"name":"github.com/ryanmorr/bem","commit":"ebd3e5e253c8dfd3f58f00eb93b69a5d15d4113c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.7,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 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":"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":"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/node.js.yml:1","Info: no jobLevel write permissions found"],"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":10,"reason":"no dangerous workflow patterns detected","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":"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":"Pinned-Dependencies","score":3,"reason":"dependency not pinned by hash detected -- score normalized to 3","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/ryanmorr/bem/node.js.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/ryanmorr/bem/node.js.yml/master?enable=pin","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   1 npmCommand dependencies pinned"],"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":"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: UNLICENSE:0","Info: FSF or OSI recognized license: The Unlicense: UNLICENSE: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":0,"reason":"12 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-qwcr-r2fm-qrc7","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-pxg6-pf52-xh8x","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-cxjh-pqwp-8mfp","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-9wv6-86v2-598j","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q"],"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-23T07:53:17.350Z","repository_id":70575038,"created_at":"2025-08-23T07:53:17.350Z","updated_at":"2025-08-23T07:53:17.350Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33630999,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["bem","dom","javascript"],"created_at":"2024-11-13T20:34:01.874Z","updated_at":"2026-05-28T23:31:19.053Z","avatar_url":"https://github.com/ryanmorr.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bem\n\n[![Version Badge][version-image]][project-url]\n[![License][license-image]][license-url]\n[![Build Status][build-image]][build-url]\n\n\u003e Simple jQuery-like library to traverse and modify components according to the BEM methodology\n\n## Install\n\nDownload the [CJS](https://github.com/ryanmorr/bem/raw/master/dist/cjs/bem.js), [ESM](https://github.com/ryanmorr/bem/raw/master/dist/esm/bem.js), [UMD](https://github.com/ryanmorr/bem/raw/master/dist/umd/bem.js) versions or install via NPM:\n\n``` sh\nnpm install @ryanmorr/bem\n```\n\n## Usage\n\nBegin by querying for one or more block-level elements:\n\n``` javascript\nimport bem from '@ryanmorr/bem';\n\n// Query for a block via CSS selector string\nconst component = bem('.component');\n\n// Like jQuery, bem can handle a single element or a collection internally\ncomponent.length; //=\u003e 2\n\n// Reference single elements like you would in jQuery\ncomponent[0]; //=\u003e DOM element\n```\n\nQuery for element-level nodes of a block:\n\n``` javascript\n// Provide the root element name (you don't need to prefix with the block name)\nconst menuItems = bem('.menu').element('menu-item');\n\n// Class names are resolved internally according to the BEM methodology\nmenuItems[0].className; //=\u003e \"menu__menu-item\"\n```\n\nModify blocks/elements by adding and removing modifier classes:\n\n``` javascript\n// Add the \"menu--disabled\" modifier class to block(s)\nbem('.menu').modify('disabled'); \n\n// Add the \"menu__menu-item--highlighted\" modifier class to element(s)\nbem('.menu').element('menu-item').modify('highlighted'); \n\n// Remove the \"menu--color-red\" modifier class from the block(s)\nbem('.menu').unmodify('color-red');\n\n// Toggle adding/removing the \"menu--hidden\" modifier class\nbem('.menu').toggle('hidden'); \n\n// Returns true if the element has the \"menu__menu-item--active\" modifier class\nbem('.menu').element('menu-item').is('active');\n```\n\n## API\n\n### `bem(selector, ...modifiers?)`\n\nCreate a new `bem` instance by querying for the block(s) or explicity providing them and optionally provide modifiers to filter the blocks:\n\n```javascript\n// Supports CSS selector string\nconst block = bem('.block');\n\n// Supports an array/nodelist\nconst block = bem(document.querySelectorAll('.block'));\n\n// Supports a single DOM element\nconst block = bem(document.querySelector('.block'));\n\n// Filter blocks by providing one or more modifiers\nconst block = bem('.block', 'foo', 'bar');\n```\n\n------\n\n### `element(name, ...modifiers?)`\n\nQuery for element-level nodes by providing the name and optionally provide modifiers to filter the elements. Returns a new `bem` instance for the currently selected elements:\n\n```javascript\n// Provide the name minus the block prefix\nconst elements = bem('.block').element('element');\n\n// Filter elements by providing one or more modifiers\nconst elements = bem('.block').element('element', 'foo', 'bar');\n```\n\n------\n\n### `modify(...modifiers)`\n\nAdd one or more modifiers to the currently selected elements. Returns the `bem` instance to support method chaining:\n\n```javascript\n// Add a modifier to a block\nbem('.block').modify('foo');\n\n// Add multiple modifiers to an element\nbem('.block').element('element').modify('foo', 'bar');\n```\n\n------\n\n### `unmodify(...modifiers)`\n\nRemove one or more modifiers from the currently selected elements. Returns the `bem` instance to support method chaining:\n\n```javascript\n// Remove a modifier from a block\nbem('.block').unmodify('foo');\n\n// Remove multiple modifiers from an element\nbem('.block').element('element').unmodify('foo', 'bar');\n```\n\n------\n\n### `toggle(...modifiers)`\n\nToggle adding/removing one or more modifiers to/from the currently selected elements. Returns the `bem` instance to support method chaining:\n\n```javascript\n// Toggle adding/removing a modifer to/from a block\nbem('.block').toggle('foo');\n\n// Toggle adding/removing multiple modifers to/from an element\nbem('.block').element('element').toggle('foo', 'bar');\n```\n\n------\n\n### `is(...modifiers)`\n\nReturns true if the first element in a collection has one or more modifiers, otherwise it returns false:\n\n```javascript\n// Does the block have a modifier\nconst isFoo = bem('.block').is('foo');\n\n// Does the element have multiple modifiers\nconst isFooBar = bem('.block').element('element').is('foo', 'bar');\n```\n\n------\n\n### `on(...modifiers, callback)`\n\nSubscribe a callback function to be invoked when one or more modifiers have been added to a block/element. The callback function is passed the DOM element as the only argument. Returns the `bem` instance to support method chaining:\n\n```javascript\nbem('.block').on('foo', (el) =\u003e {\n    // Executed when the \"block--foo\" modifier class is added to the block/element\n});\n\nbem('.block').element('element').on('foo', 'bar', (el) =\u003e {\n     // Executed when the \"block__element--foo\" AND \"block__element--bar\"\n     // modifier classes have been added to the block/element\n});\n```\n\n------\n\n### `each(fn)`\n\nIterate through each element in the collection:\n\n```javascript\n// Loop through element-level nodes and maniuplate them individually\nbem('.block').element('element').each((el) =\u003e {\n    // Do something \n});\n```\n\n## License\n\nThis project is dedicated to the public domain as described by the [Unlicense](http://unlicense.org/).\n\n[project-url]: https://github.com/ryanmorr/bem\n[version-image]: https://img.shields.io/github/package-json/v/ryanmorr/bem?color=blue\u0026style=flat-square\n[build-url]: https://github.com/ryanmorr/bem/actions\n[build-image]: https://img.shields.io/github/actions/workflow/status/ryanmorr/bem/node.js.yml?style=flat-square\n[license-image]: https://img.shields.io/github/license/ryanmorr/bem?color=blue\u0026style=flat-square\n[license-url]: UNLICENSE","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanmorr%2Fbem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanmorr%2Fbem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanmorr%2Fbem/lists"}