Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set and get w/ JSON enhancement #2

Closed
jeffturcotte opened this issue Jun 28, 2010 · 1 comment
Closed

set and get w/ JSON enhancement #2

jeffturcotte opened this issue Jun 28, 2010 · 1 comment

Comments

@jeffturcotte
Copy link

Would be nice to find a way to use JSON.stringify & JSON.parse internally to allow for something like the following:

store.set('user', {name: 'jeff'});
var myobj = store.get('user');

set could detect whether the value is an object and then JSON.stringify
get could attempt a JSON.parse and simply return a string on an exception.

In any case, nice lib :-)

@marcuswestin
Copy link
Owner

If JSON was available in all browsers then set and get would be using JSON.stringify/JSON.parse each wrapped in try catch respectively.

store.js doesn't do that by default because it should not be dependent on JSON.js. If you choose to include JSON.js then it's trivial to wrap the library or modify it yourself.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants