npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@regru/deps-normalize

v2.5.0

Published

Dependencies normalization for gulp-bem

Downloads

23

Readme

deps-normalize

NPM version Build Status Dependency Status

This module used to normalize require and expect properties in BEM object.

Usage


var normalize = require('deps-normalize');

normalize(undefined);               // []
normalize({ block: 'block' });      // [ { block: 'block' } ]
normalize({ elem: 'elem' });        // [ { elem: 'elem' } ]

// See more examples in tests

API

normalize(dependencies, [options])

Runs normalization of dependencies. Returns array of normalized dependencies.

dependencies

Type: Object / String

options

Type: Object

  • parseString - contains Function, that will parse dependencies if they passed as string.

Normalization

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).

License

MIT (c) 2014 Vsevolod Strukchinsky