Giter Site home page Giter Site logo

download / memorystorage Goto Github PK

View Code? Open in Web Editor NEW
50.0 50.0 12.0 1.14 MB

Memory-backed storage object that implements the Web Storage API

Home Page: http://download.github.io/memorystorage

License: Creative Commons Attribution 4.0 International

JavaScript 89.44% HTML 7.59% Handlebars 2.96%

memorystorage's People

Contributors

dependabot[bot] avatar download avatar greenkeeper[bot] avatar semmel avatar trukl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

memorystorage's Issues

Typings

Does anybody was creating typing for this package?

Add npm install to README

If you can install via npm, you might want to put that information in the readme. If I hadn't happened to go back to your project page to look at the links, I never would have known this was available in npm, and would have moved on to another library. ๐Ÿ‘

Incompatible property enumeration and toJSON method

Unfortunately I rely on things like Object.keys(localStorage) to give me the keys of all items stored.

var isolated = new MemoryStorage('my-app');
isolated.setItem("test", JSON.stringify({ key: "value" }));
Object.keys(isolated);  
/// returns ["id", "length", "getItem", "setItem", "removeItem", "key", "clear", "test"]

localStorage.setItem("test", JSON.stringify({ key: "value" }));
Object.keys(localStorage); 
/// returns ["test"] 

It might be related, also that the output of applying JSON.stringify is not compatile to localStorage. It should be

JSON.stringify(localStorage)
// returns {"test":"{\"key\":\"value\"}"}

but instead it is

JSON.stringify(isolated)
// returns {"id":"my-app","length":1,"test":"{\"key\":\"value\"}"}

Perhaps one should define a .toJSON method to fix that behaviour.

With best regards
Semmel

Push v0.9.10 to NPM

Hi,

Looks like v0.9.10 never got pushed to NPM. Would you mind doing that?

Thanks!

Cannot find module memorystorage

Hi, I'm confused about the documentation and different header sizes. I.e. where does 'Installation' end? My troubles could be because of this.

I did:

npm install --save memorystorage

And then in my Angular CLI project ES2015:

import MemoryStorage from 'memorystorage';
....
this.storage = new MemoryStorage();

but my ng serve spits out cannot find module 'memorystorage'. It is there in my npm folder and other packages like moment work.

Also could be a Typescript issue, ... since that't not ES2015.

In my package.json: "memorystorage": "^0.11.0",

Any ideas about this?

Errors in comments for examples

Some the statements below are not matching the comments. Better to tidy them up?

store.setItem('myString', 'Hello MemoryStorage!');
store.myObject = JSON.stringify({my: 'object'}));
alert(store.getItem('My string')); // alerts 'Hello MemoryStorage!'
alert(store['My string']); // alerts 'Hello MemoryStorage!'
alert(store.length); // alerts '2'
alert(store.key(1)); // alerts 'My object'
store.removeItem('My string');
alert(store.length); // alerts '1'
store.clear();
alert(store.length); // alerts '0'

Invalid exports in package.json

With recent NPM and node updates, for example node 12.18.0 and npm 6.14.4, there is a more strict check on the package.json.

Error [ERR_INVALID_PACKAGE_TARGET] [ERR_INVALID_PACKAGE_TARGET]: Invalid "exports" main target "MemoryStorage" defined in the package config /var/www/restref-site/node_modules/memorystorage/package.json; targets must start with "./"

This prevents the use of this package.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.