piggy-bank 🐷
Simple, local JSON file store
Table of Contents
About
- Simple local persistence in a JSON file you specify
- Small API of
set
,get
,remove
&store
- Supports retreival of properties using regexp or dot path notation
- Supports setting properties using dot path notation
Install
This project uses node and npm.
$ npm install piggy-bank$ # OR $ yarn add piggy-bank
Usage
const piggyBank = // Creates a new JSON file at the path provided // Defaults to .piggy.json in OS home dir // Set properties on JSON filepiggyBankpiggyBankpiggyBankpiggyBank // ForcepiggyBank // Get the entire storeconsole // { foo: 1, bar: { baz: 1, foo: 1 }, baz: { foo: { bar: 1 } } } // Get from store using dot path notation or regular expressionsconsole // 1console // { baz: 1, foo: 1 }console // { foo: { bar: 1 } }console // undefinedconsole // { bar: 1 }console // [ 1, 1, { bar: 1 } ]console // { foo: 1, bar: 2, baz: 3 } // Set a new storeconst store = foo: 1 bar: 2 baz: 3 console // { foo: 1, bar: 2, baz: 3 } piggyBank // Remove key
Contribute
- Fork it and create your feature branch: git checkout -b my-new-feature
- Commit your changes: git commit -am 'Add some feature'
- Push to the branch: git push origin my-new-feature
- Submit a pull request
License
MIT