
Security News
Node.js Drops Bug Bounty Rewards After Funding Dries Up
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.
Jada is a simple, lightweight library for storing data. It does not update localStorage, nor does it provide hooks for syncing data to a server. It simply gets and sets data, and provides hooks for listening to when data has been set both before and after
Jada is a simple, lightweight library for storing data. It does not update localStorage, nor does it provide hooks for syncing data to a server. It simply gets and sets data, and provides hooks for listening to when data has been set both before and after.
Jada is 2.6kb in size when minified.
var datastore = Jada.create();
function listenerFired (label, key, oldValue, newValue) {
var currentValue = datastore.get(key);
console.log(label);
console.log('=============')
console.log(' Key: ' + key);
console.log('Current Value: ' + currentValue);
console.log(' Old Value: ' + oldValue);
console.log(' New Value: ' + newValue);
console.log('');
}
// Fires twice,
// once before setting 'my-key' and
// once before setting 'my-other-key'
//
// This callback will fire before any key is set.
datastore.before(function (key, oldValue, newValue) {
listenerFired('Before All', key, oldValue, newValue);
});
// Fires twice,
// once after setting 'my-key' and
// once after setting 'my-other-key'
//
// This callback will fire after any key is set.
datastore.after(function (key, oldValue, newValue) {
listenerFired('After All', key, oldValue, newValue);
});
// Fires once,
// once before setting 'my-key'
//
// This callback will fire once before the specified key is set.
datastore.before('my-key', function (key, oldValue, newValue) {
listenerFired('Before my-key', key, oldValue, newValue);
});
// Fires once,
// once after setting 'my-key'
//
// This callback will fire once after the specified key is set.
datastore.after('my-key', function (key, oldValue, newValue) {
listenerFired('After my-key', key, oldValue, newValue);
});
// Sets 'my-key' to the value 'Hello, world!'
datastore.set('my-key', 'Hello, World!');
// Sets 'my-other-key' to the value 'Goodbye, Bob!'
datastore.set('my-other-key', 'Goodbye, Bob!');
// This will log the value 'Hello, World!'
// for the key 'my-key'.
console.log(datastore.get('my-key'));
// This will log the value 'Goodbye, Bob!'
// for the key 'my-other-key'.
console.log(datastore.get('my-other-key'));
The above will output the following log:
Before All
=============
Key: my-key
Current Value: undefined
Old Value: undefined
New Value: Hello, World!
Before my-key
=============
Key: my-key
Current Value: undefined
Old Value: undefined
New Value: Hello, World!
After All
=============
Key: my-key
Current Value: Hello, World!
Old Value: undefined
New Value: Hello, World!
After my-key
=============
Key: my-key
Current Value: Hello, World!
Old Value: undefined
New Value: Hello, World!
Before All
=============
Key: my-other-key
Current Value: undefined
Old Value: undefined
New Value: Goodbye, Bob!
After All
=============
Key: my-other-key
Current Value: Goodbye, Bob!
Old Value: undefined
New Value: Goodbye, Bob!
Hello, World!
Goodbye, Bob!
The Jada API consists of a very simple set of verbs for manipulating and listening to the data within your store.
Create is the sole method on the Jada object. It is used to create a datastore instance.
Usage
Creating a datastore with no predefined values.
var datastore = Jada.create();
Creating a datastore with predefined values.
var datastore = Jada.create({ 'my-key': 'Hello, World!'});
console.log(datastore.get('my-key')); // outputs 'Hello, World!'
Get the current value associated with the specified key.
Usage
var datastore = Jada.create({ 'key': [1, 2, 3] });
var val = datastore.get('key');
console.log(val); // outputs [ 1, 2, 3 ]
Sets a key to the specified value.
Usage
var datastore = Jada.create();
datastore.set('my-key', { name: 'Jesse' });
var val = datastore.get('my-key');
console.log(val); // outputs { name: 'Jesse' }
Removes both the key and value from the datastore.
Usage
var datastore = Jada.create({ name: 'Jesse' });
console.log(datastore.get('name')); // outputs 'Jesse'
datastore.remove('name');
console.log(datastore.get('name')); // outputs undefined
Dumps the entire contents of the data store as a javascript object.
Usage
var datastore = Jada.create({ name: 'Jesse' });
console.log(datastore.dump()); // outputs { name: 'Jesse' }
Returns an array of all the keys within the datastore.
Usage
var datastore = Jada.create({ name: 'Jesse', height: '4 foot nothin' });
console.log(datastore.keys()); // outputs [ 'name', 'height' ]
Clears all the data out of the datastore.
Usage
var datastore = Jada.create({ name: 'Jesse' });
console.log(datastore.dump()); // outputs { name: 'Jesse' }
datastore.clear();
console.log(datastore.dump()); // outputs {}
The before listener fires before a key is set. The key is optional, if only a callback is provided, then the callback will fire before all keys are set.
Usage
var datastore = Jada.create({ name: 'Jesse', height: '4 foot nothin' });
// Only fires when 'name' is set.
datastore.before('name', function (key, oldValue, newValue) {
var currentValue = datastore.get(key);
console.log(currentValue === oldValue); // outputs true
});
// Fires before any key is set
datastore.before(function (key, oldValue, newValue) {
console.log(key);
});
datastore.set('name', 'Fred'); // outputs true
// outputs 'name'
datastore.set('height', '6 foot'); // outputs 'height'
The after listener fires after a key is set. The key is optional, if only a callback is provided, then the callback will fire after all keys are set.
Usage
var datastore = Jada.create({ name: 'Jesse', height: '4 foot nothin' });
// Only fires after 'name' is set.
datastore.after('name', function (key, oldValue, newValue) {
var currentValue = datastore.get(key);
console.log(currentValue === newValue); // outputs true
});
// Fires after any key is set
datastore.after(function (key, oldValue, newValue) {
console.log(key);
});
datastore.set('name', 'Fred'); // outputs true
// outputs 'name'
datastore.set('height', '6 foot'); // outputs 'height'
FAQs
Jada is a simple, lightweight library for storing data. It does not update localStorage, nor does it provide hooks for syncing data to a server. It simply gets and sets data, and provides hooks for listening to when data has been set both before and after
We found that jada demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.