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

Adding remove all #123

Closed
wants to merge 1 commit into from
Closed

Conversation

luanpotter
Copy link

This is an interesting feature that I tend to use in several places in most of my projects.
I believe it would be a neat addition to the api.
I'm open to suggestions, of course :)

@FagnerMartinsBrack
Copy link
Member

We refrain from adding additional features to support unless there is enough evidence to justify the cost. Is there anything that should be done in js-cookie side that prevents you from extending js-cookie and doing something like this locally?

Cookies.removeAll = function (attributes) {
    Object.keys(Cookies.get()).forEach(function (cookie) {
        Cookies.remove(cookie, attributes);
    });
 };

js-cookie was created to remove the complexity of handling cookies and allow functional code like that to be created in the developer side. I see no reason for adding a new method that do not have the same benefit of abstracting document.cookie = String

That would be an amazing one-line-like module though, and I would certainly use it to remove all cookies accessible in the current page.

@carhartl

@luanpotter
Copy link
Author

No, it works with the extension -- in fact, I do that already in my projects.

I agree it would be overall clutter. And you gave a nice idea. I will see about making this one-line separate npm module, and so those who want can add this functionality with negligible effort, while not starting to attach little bits sparsely hanging around in the lib.

Thanks for the quick feedback!

@FagnerMartinsBrack
Copy link
Member

When you create it, please link here for other ppl to find out. Maybe we can add something in the wiki linking to the module as a plugin? A self-answered question in StackOverflow would be amazing for SEO and visiblity too if the question constructs the url as remove-all-cookies-using-javascript ;)

@luanpotter
Copy link
Author

@FagnerMartinsBrack
Copy link
Member

👍

@FagnerMartinsBrack FagnerMartinsBrack added this to the v2.1.1 milestone Jan 13, 2016
@FagnerMartinsBrack
Copy link
Member

I have contributed with a PR for your repo, see luanpotter/js-cookie-remove-all#1
Since we are delegating this to js-cookie-remove-all, I will assume the issue as solved, thanks!

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

Successfully merging this pull request may close these issues.

2 participants