Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
super simple synchronous json storage
branch: master

This branch is 5 commits behind icodeforlove:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
.gitignore
.npmignore
Readme.md
index.js
package.json

Readme.md

cubby

super simple synchronous json storage

this was originally created to provide a way to store data for a few command-line tools, and is not geared towards performance

installation

$ npm install cubby

usage

var Cubby = require('cubby'),
    cubby = new Cubby();

cubby.set('foo', 'bar');

console.log(cubby.get('foo'));

or

cubby.set({
    one: 'one',
    two: 'two',
    three: {
        nested: true
    }
});

console.log(cubby.get('one')); // returns one
console.log(cubby.getPath('three.nested')); // returns true

multiple files

by default creating a cubby will result in a cubby.json file, but you can change this by providing a file path

var cubbyOne = new Cubby({file: 'something-one.json'}),
    cubbyTwo = new Cubby({file: 'something-two.json'});

paths

cubby.setPath('one.two.three', true);
cubby.getPath('one.two.three');
cubby.getPath('one.two.three.four'); // returns undefined when value doesn't exist
Something went wrong with that request. Please try again.