Git Product home page Git Product logo

storage-connector's Introduction

Storage Connector

A connector to work with local and session storage without different libs. The objective is to take most of the labelling process of storage and add some funcionalities.

Getting Started

These instructions will get you through installing and using deep-getter on your project.

Installing

Simply install using npm or yarn

npm install storage-connector

Using

This section will guide you through using storage-connector on your repository, showing how to use and what code you should replace for it.

const StorageConnector = require('storage-connector')

/* 
 * First you need to call the function, adding the prefix that will be preceding all the content, 
 * just for labelling and controlling purpouses
 * /

/* 
 * All the data will have 'test_' as the prefix of its label
 */
const testStorage = StorageConnector('test');

/* 
 * All the data will not have any prefix
 */
const defaultStorage = StorageConnector();

With this part instantiated all the rest of the get, set and delete actions and the extra ones can be made, all the methods can be seen on Docs section :

/*
 * SET operations
 */
testStorage.set('local', 'Local data that will be stored permanently on test_local');

testStorage.setOnSession('session', 'Session data that will be stored till the session end on test_session');

testStorage.setWithExpiration('expires', 'Data that will last 4 hours on localstorage', 4);

/*
 * GET operations
 */
testStorage.get('local');
// >> 'Local data that will be stored permanently on test_local'

testStorage.getOnSession('session');
// >> 'Session data that will be stored till the session end on test_session'

testStorage.get('expires');
// >> 'Data that will last 4 hours on localstorage'


/*
 * DELETE operations
 */

testStorage.remove('local');
testStorage.removeOnSession('session');

testStorage.get('local');
// >> null
testStorage.getOnSession('session');
// >> null


/*
 * CLEAN operations
 */

/*
 * Remove all the registries containing 'test_' prefix
 */
testStorage.clean();
testStorage.cleanSession();

Questions?

If you have any questions about using Storage Connector on your project, please open a new issue.

Filing a bug

If you found a bug, please open a new issue.

Contributing

This project is open for contributions. To suggest a new feature, please open a new issue. To fix a filed bug or implementing a feature, please fork this project, create a new branch containing your code and send a pull request. If you need any guidance, you can reach us out by creating a new issue.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

storage-connector's People

Contributors

matheusbnaguiar avatar

Stargazers

Roman avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.