Neatly Positioned Magazines
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    modules-weightpublic

    modules-weight

    Provides a way to store modules associated with a weight and get them sorted.

    Instructions

    Installation:

    npm install modules-weight
    

    Tests:

    npm test
    

    Usage

    The module itself is a function that will return a new storage object. So the first thing to do is call this function.

    var weight = require( 'modules-weight' );
    
    var modulesList = weight();
    

    To add a module to the list, the set() method is provided. It accepts two arguments: a module and a weight.

    modulesList.set( module /* object */, weight /* number */ );
    

    Once you've added several modules with their weight, getting them in a sorted order is as simple as:

    modulesList.get();
    

    The get() method returns an array of modules sorted by their weight.

    Contributors

    License

    Copyright (c) 2012 Florian Margaine Licensed under the MIT license.

    Keywords

    none

    install

    npm i modules-weight

    Downloadsweekly downloads

    1

    version

    0.1.0

    license

    none

    repository

    github.com

    last publish

    collaborators

    • avatar