1.1.1 β€’ Published 4 years ago

localstorage-api v1.1.1

Weekly downloads
6
License
-
Repository
github
Last release
4 years ago

πŸ‘€πŸ‘‰This repo is unmaintained!πŸ‘ˆπŸ‘€:

If anyone fancies it, I reckon it could be improved by using Lodash, like so:

localStorage.foo = '{"bar":"buzz"}'
_.get(JSON.parse(localStorage.foo), 'bar')

localStorage API

Access local storage with a dot notation (e.g. ls.get('some.object.here'))

Install

$ npm install localstorage-api --save

Usage

Install

import ls from 'localstorage-api' or var ls = require('localstorage-api')

Set

To set a simple key / value in localStorage:

ls.set('some', { object: 123 })

If you check the browsers localStorage you will now see

keyvalue
some{ "object": 123 }

Get

To retrive this value:

ls.get('some')        // => { object: 123 }
ls.get('some.object') // => 123`

Has

To check a value:

ls.has('some')        // => true
ls.has('some.object') // => true
ls.has('some.thing')  // => false

Remove

To remove the key / value pair from localStorage:

ls.remove('some')

Clear

To clear all localStorage:

ls.clear()

License

MIT Β© Ed Williams

1.1.1

4 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.1.0

6 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago