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

How to set object for key? #23

Closed
sh977218 opened this issue Mar 2, 2020 · 3 comments
Closed

How to set object for key? #23

sh977218 opened this issue Mar 2, 2020 · 3 comments
Assignees
Labels

Comments

@sh977218
Copy link

sh977218 commented Mar 2, 2020

Is there any way I can do
this.localStorageService.set('myKey',{myValue: 1 })?

@bohoffi
Copy link
Owner

bohoffi commented Mar 2, 2020

@sh977218 as I didn't want to limit the librarys users to only one way of serialization it's up to you.
You could use JSON.stringify() for example to create the serialized object and JSON.parse() to get it back as an object.

Does this answer your question?

@bohoffi bohoffi self-assigned this Mar 2, 2020
@sh977218
Copy link
Author

sh977218 commented Mar 2, 2020

@bohoffi Thanks for the quick response. I guess I can do that. Still It would be nice to let value to be any.

@bohoffi
Copy link
Owner

bohoffi commented Mar 2, 2020

I can understand your request and openen a new feature request #24 to provide a default (de)serializer (using the mentioned JSON.stringify()/JSON.parse()) which will be used when omitting the (de)serializer paramter.

@bohoffi bohoffi closed this as completed Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants