@jswork/next-mock-storage
v1.0.5
Published
Mock storage for mock storage api based on next.
Downloads
10
Maintainers
Readme
next-mock-storage
Mock storage for mock storage api based on next.
installation
npm install -S @jswork/next-mock-storage
apis
| api | params | description | | ---------- | ------ | -------------------------------- | | setItem | - | - | | getItem | - | - | | removeItem | - | - | | clear | - | - | | keys | - | Extend, not default storage api. | | _storage | - | For test. |
usage
import NxMockStorage from '@jswork/next-mock-storage';
const mockStorage = NxMockStorage.getInstance();
mockStorage.setItem('k1', 'v1');
mockStorage.setItem('k2', 'v2');
mockStorage.setItem('k3', 'v3');
mockStorage.removeItem('k3');
mockStorage.getItem('k3'); // null
license
Code released under the MIT license.