Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
@dr/bem-helper
Advanced tools
Helper to create BEM-style classnames
npm install @dr/bem-helper
var bem = require("@dr/bem-helper");
var className = bem("dr-module", "list");
// className === "dr-module__list"
var className = bem("dr-module", { loaded: true });
// className === "dr-module dr-module--loaded"
// Get all applicable combinations for an element:
var className = bem("dr-module", "list", { expanded: true });
// className === "dr-module__list dr-module__list--expanded"
// Get a single classname for an element:
var className = bem.single("dr-module", "list", { expanded: true });
// className === "dr-module__list--expanded"
// Modifiers with values
// Get all applicable combinations for an element:
var className = bem("dr-module", "list", { expanded: true, rated: 3 });
// className === "dr-module__list dr-module__list--expanded dr-module__list--rated-3"
// Get a single classname for an element:
var className = bem.single("dr-module", "list", { rated: 3 });
// className === "dr-module__list--rated-3"
// Prebinding a helper
var block = "dr-module";
var boundBem = bem.bind(null, block);
// Get all applicable scoped combinations for an element:
var className = boundBem("list", { expanded: true });
// className === "dr-module__list dr-module__list--expanded"
var boundSingle = bem.single.bind(null, block);
// Get a single scoped classname for an element:
var className = boundSingle("list", { expanded: true });
// className === "dr-module__list--expanded"
A function that creates all applicable combinations of classnames for an element in BEM-style.
block
(string) - The block element for the classname....args
(string|object) - Optional. Elements are described by strings and modifiers are described by objects: keys are use as the modifier names and boolean values trigger whether the modifier is active, and any other type is used as a value; {expanded: true}
> "--expanded"
, {rating: 3}
> "--rating-3"
.Same as bem
above - but it only returns a single classname.
FAQs
Helper functions to create BEM-style classnames
We found that @dr/bem-helper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 55 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.