Hey fellow automators, I’ve been doing more and more with Scriptable. In doing so, I found the need to use a Key-Value Database several times. Today I decided I’d create a general-use version that anyone can use.
Introducing, KeyValueDB:
KeyValueDB
In order to use KeyValueDB, download the script and put it in your Scriptable folder.
Notes:
- Local storage only currently
- Uses JSON internally to store data
Usage:
Import the file
var KeyValueDB = importModule('KeyValueDB');
var db = new KeyValueDB('YourProjectName');
Get a value by key
var val = db.getValue(key)
Set a value by key
db.setValue(key, value)
Append a value to an array with the specified key
db.append(key, pushedValue)
Get everything
var object = db.getAll()