Skip to content

a library for projects that allow you to work with local and session storage in typescript

License

Notifications You must be signed in to change notification settings

MetaiR/simple-storage-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coverage Status Build Status

Simple Storage

a lightweight library for projects that allow you to work with local and session storage.

Installation

npm install simple-storage-tools --save
yarn add simple-storage-tools
bower install simple-storage-tools --save

Usage

first, you must import it.

Javascript

var Storage = require('simple-storage-tools').Storage;

TypeScript

import { Storage } from 'simple-storage-tools';

then you can use it like this:

let json = {
    value1: 'Hello',
    value2: 'World'
}

// it will store `json` as an session storage
Storage.set('some-storage', json); 

// it will store `json` as an local storage
Storage.set('some-storage', json, true);

// it will get storage from sessionStorage Object
let r = Storage.get('some-storage');
// it will get storage from localStorage Object
// let r = Storage.get('some-storage', true);

console.log(r.value1 + ' ' + r.value2); // print Hello World in console

you can see more examples here

Test

npm run test

Contribute

feel free to fork and do what ever you want (or send pull requests).

for contribute this project, first clone the project and go to project folder:

git clone https://github.com/MetaiR/simple-storage-tools.git
cd simple-storage-tools

then run:

npm install

after that you ready to go :D

About

a library for projects that allow you to work with local and session storage in typescript

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published