1.1.4 • Published 7 years ago

little-storage v1.1.4

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

Little Storage

CircleCI npm.io npm

:package: little-storage is a localStorage wrapper that adds better support for storing arrays and objects.

Installation

yarn add little-storage

Usage

import ls from 'little-storage';
  • ls.set(key: string, value: any) - stores the given value at the key

  • ls.get(key: string) - returns the value stored at the given key

  • ls.push(key: string, value: any, maxSize = 0) - pushes the value to the end of an array stored at the key

    • if an array doesn't exist at the key, a new array will be created and the value stored in it.
    • the array size is limited by the maxSize. If it's full, it will remove the first item in the array before pushing.
    • if maxSize is 0, the size is unlimited.
  • ls.insert(key: string, value: any, maxSize = 0) - inserts the value to the beginning of an array stored at the key

    • if an array doesn't exist at the key, a new array will be created and the value stored in it.
    • the array size is limited by the maxSize. If it's full, it will remove the last item in the array before inserting.
    • if maxSize is 0, the size is unlimited.

License

little-storage is under the MIT license.


1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

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