Newbie Paintball Master

    level-wrangler

    2.2.0 • Public • Published

    level-wrangler Build Status Dependency Status

    Defines and stores json models by indices within a leveldb

    npm i -S level-wrangler
    

    Example

    var level = require( 'level-party' )( '/tmp/.db' );
    var sub = require( 'level-sublevel' )( level );
    var db = require( 'level-wrangler' )( sub.sublevel( 'users', {
        encoding: 'json'
    }));
     
    var users = db.createFactory( 'users', {} );

    Finding stuff

    users.findAll()
        .then( res => {
            streamify( res.map( user => {
                return user.name
            }) ).pipe( process.stdout );
        })
        .catch( ... );

    Hiding Storing stuff

    var user = users.create({
        username: 'Jack',
        password: 'wr4angl1ng'
    });
     
    user.save();

    Getting rid of stuff

    user.remove()
        .then( ... )
        .catch( ... )

    Check out the test suite for more use examples.

    Contributing

    npm run watch
    

    Test it up

    npm test
    

    V2 Goals

    • non-intrusive-wrangler, give it a level instance with whatever plugins you want.
    • minimal model-schema that allows indexable props
    • Pluggable—stuff like validation should be an extended module
    • ES6 and babel—yuuup

    Install

    npm i level-wrangler

    DownloadsWeekly Downloads

    31

    Version

    2.2.0

    License

    ISC

    Last publish

    Collaborators

    • mattstyles