Skip to content

xNaii/js-collections

Repository files navigation

JS Collections

Javascript Collections to store arrays, objects

Usage

const collection = new Collection({ /* settings */ });

Settings

storageName - default: 'data-collection'

Adding

let arr = collection.addArray('shared-array', [
  /*data*/
]);

let obj = collection.addObject('shared-object', {
  /*data*/
});

Retrieving

let arr = collection.getArray('shared-array');

let obj = collection.getObject('shared-object');

Methods

Parameters Returns
addArray name, array array
getArray name immutable array or null
addObject name, object object
getObject name immutable object or null
store empty
retrieve empty
clearAll emtpy
clearInstance empty
clearStorage empty