1.0.0-alpha.3 • Published 3 years ago

@sofiakb/local-storage v1.0.0-alpha.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Contributors Forks Stargazers Issues MIT License

comment: <> (LinkedIn)

About The Library

comment: <> (The library allows to detect os system in PHP project.)

Built With

This section should list any major frameworks that you built your project using. Leave any add-ons/plugins for the acknowledgements section. Here are a few examples.

Prerequisites

Installation

npm install --save @sofiakb/local-storage

Usage

local-storage.set(string key, var value, object options)

Set local-storage with specified key and value with options. value can be a object. Available options are:

  • expires: Days of expiration.
  • days: Alias of expires.
  • path: Path of local-storage.
  • domain: Domain of local-storage.
  • secure: HTTPS only.
import local-storage from 'json-local-storage';

local-storage.set('test', 'test');		// test=test
local-storage.set('json-test', { name: '.modernator' });    // json-test={"name":".modernator"}

local-storage.set('ex-test', 'test', {
	expires: 1
});		// ex-test=test; expires= ...

local-storage.get(string key)

Get local-storage with key. If local-storage isn't exist, it returns undefined.

import local-storage from 'json-local-storage';

local-storage.get('test');		// test
local-storage.get('json-test');	// Object { name: '.modernator' }

local-storage.delete(string key)

Delete local-storage with key.

import local-storage from 'json-local-storage';

local-storage.delete('test');
local-storage.get('test');		//

Roadmap

See the open issues for a list of proposed features (and known issues).

License

Distributed under the MIT License. See LICENSE for more information.