
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
deps-normalize
Advanced tools
This module used to normalize require
and expect
properties in BEM object.
var normalize = require('deps-normalize');
normalize(undefined); // []
normalize({ block: 'block' }); // [ { block: 'block' } ]
normalize({ elem: 'elem' }); // [ { elem: 'elem' } ]
// See more examples in tests
Runs normalization of dependencies. Returns array of normalized dependencies.
Type: Object
/ String
Type: Object
parseString
- contains Function
, that will parse dependencies
if they passed as string.Dependencies should contain deps objects (or String
). We do not support full specification. Those objects are equivalents of BEM objects, but with additional properties, that reduces boilerplate code. After they are normalized, they can be converted to BEM objects.
elems
- contains Array
of String
(if it contains String
it will be wrapped in array).mods
- contains Object
with keys as modificators names and values as modificators values. Values can be Number
, Boolean
, String
or Array
of String
.If deps object contain elems
or mods
it will be splitted in multiple BEM objects. It will not take multiplication of elems
and mods
, if both are present in deps object. Instead it will be interpretated as two deps objects: one with elems
and other with mods
.
normalize({ elems: ['e1', 'e2'], mods: {m1: 1, m2: [2, 3]} });
// [
// { block: 'b', elem: 'e1' },
// { block: 'b', elem: 'e2' },
// { block: 'b', modName: 'm1', modVal: 1 },
// { block: 'b', modName: 'm2', modVal: 2 },
// { block: 'b', modName: 'm2', modVal: 3 }
// ]
level
, block
, elem
, mod
and value
properties will be taken from current processing object.
Note: you can not have elem
with elems
in one deps object (same applies to mod
and mods
).
MIT (c) 2014 Vsevolod Strukchinsky
FAQs
Dependencies normalization for gulp-bem
The npm package deps-normalize receives a total of 7 weekly downloads. As such, deps-normalize popularity was classified as not popular.
We found that deps-normalize demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Security News
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.