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

Default Value option for 'get' function. #247

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Default Value option for 'get' function. #247

wants to merge 6 commits into from

Conversation

mmcrockett
Copy link

I noticed @ayman-alkom created some pull requests with the same idea but it seems it never got completed. I followed the same idea but added the necessary test cases.

I chose not to store the default value since I felt this violated a principle of 'get' shouldn't do any saving of data. I don't have a strong opinion on this and I created test cases that explicitly show this assumption so it can easily be changed.

@eymen-elkum
Copy link

Hi @mmcrockett
It seems that this feature is required, but if the default value will not be saved then we can replace the PR with this simple script:
var variable = localStorageService.get('key') || default_val;

@ghost
Copy link

ghost commented Nov 8, 2016

What's up here?

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

Successfully merging this pull request may close these issues.

None yet

2 participants