0.1.2 • Published 4 years ago

reuben v0.1.2

Weekly downloads
5
License
MIT
Repository
github
Last release
4 years ago

reuben

A simple no-config JS document manager with a side of Redux.


Setting up a decent way of storing your JS objects in a decent way is a huge pain in the bum. reuben should help you out by allowing you to create folders using Redux and pop in your JSON objects or values as documents. This folder -> document way of thinking makes it easy to store and retrieve your information in a tidy way.

Usage

In order to start, create a folder:

import { folderActions } from 'reuben'

folderActions.createFolder('movies');

You can then pop in documents into the folder:

import { documentActions } from 'reuben'

getMovie('jurassicPark').then(
	(result) => documentActions.createDocument('movies', result)
)

The important thing here is that the item you’re importing has an id field at it’s highest level – this is how we’ll access it

Then in order to use it, we can retrieve it by using the following:

import { documentActions } from 'reuben'

const jurassicPark = documentActions.getDocument('movies', '1234')

console.log(jurassicPark)
// { id: '1234', name: 'Jurassic Park'…}

We can also update the documents:

import { documentActions } from 'reuben'

documentActions.updateDocument('movies','1234', { director: 'Steven Spielberg'})

Once we’re done. We can just delete it!

import { documentActions } from 'reuben'

documentActions.deleteDocument('1234');

Everything you do here can be viewed in any redux inspector. You don’t specifically have to use Redux at all, nor do you have to install it separately, it’s just that reuben uses it.