ssp-fake-storage

1.0.2 • Public • Published

fake-storage

Build Status Code Climate Development Dependency Status npm version

Node.js module to simulate the browser's Storage object (e.g. localStorage).

Use from JavaScript:

var localStorage = require('ssp-fake-storage');
localStorage.setItem('my_key', 'my_value');
localStorage.getItem('my_key'); ==> 'myvalue'
localStorage.key(0); ==> 'my_key'

Use from TypeScript:

/// <require path="typings/ssp-fake-storage.d.ts" />
import localStorage = require('ssp-fake-storage');
localStorage.setItem('my_key', 'my_value');
localStorage.getItem('my_key'); ==> 'myvalue'
localStorage.key(0); ==> 'my_key'

Methods:

Storage.setItem(key: string, value: string): void

Add an key-value pair to Storage.

Package Sidebar

Install

npm i ssp-fake-storage

Weekly Downloads

5

Version

1.0.2

License

MIT

Last publish

Collaborators

  • stpettersens