1.1.1 β€’ Published 5 years ago

localstorage-api v1.1.1

Weekly downloads
6
License
-
Repository
github
Last release
5 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

5 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.1.0

7 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago