storage-dao
TypeScript icon, indicating that this package has built-in type declarations

0.0.8 • Public • Published

storage-DAO

a data access object that wraps the storage api

download

npm i storage-dao

or

yarn add storage-dao

import

module:

import WebStorage from 'storage-dao';

browser:

<script src="../dist/webStorage.js"></script>

Usage

const LS = new WebStorage({
        preId: 'Grewer__',
    });

export default LS

config

attribute must default desc
preId yes - pre key id
timeSign no '-' The interval between the timestamp and the true value in value
type no 'localStorage' localStorage or sessionStorage
encrypt no btoa Encryption method
decrypt no atob Decryption method
timeGap no 12 hour Value expiration time

methods typing

interface IResult {
  status: number
  key: string
  value: string | null
}
{
  set: (key: string, value: string, time?: string | number) => IResult
  get: (key: string) => IResult
  remove: (key: string) => { status: number, value: null | string }
}

Change Log

  • 1.0.0 : official release
  • version < 1.0.0 : developing

Package Sidebar

Install

npm i storage-dao

Weekly Downloads

1

Version

0.0.8

License

MIT

Unpacked Size

9.21 kB

Total Files

5

Last publish

Collaborators

  • grewer-user