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

Allow to set own messages comparator #66

Open
jeron-diovis opened this issue Jul 14, 2016 · 3 comments
Open

Allow to set own messages comparator #66

jeron-diovis opened this issue Jul 14, 2016 · 3 comments

Comments

@jeron-diovis
Copy link

jeron-diovis commented Jul 14, 2016

I pass a rendered React elements as messages. As they are objects, they are never equal, so preventDuplicates feature does not work for me.
So, how about introducing a new prop, which will accept a comparator function? It will allow for everyone to implement any specific logic he needs, and will require a very few changes.

Also: you import entire Lodash and only use _.includes. Lodash is huge, it's a horrible dependency.
You can instead do import includes from "lodash/includes", it will save a LOT of bytes. Or just check messageList.indexOf(message) – actually, this is the only thing needed here, isn't it?

@RangarajKaushikSundar
Copy link
Collaborator

You make some good points. I agree that Lodash can be replaced with a lighter implementation. I would strongly recommend you to fork toastr and create a pull request incorporating these changes. Please advise. Cheers!

@tomchentw
Copy link
Owner

The lodash issue can be fixed by using babel-plugin-lodash. Does anyone want to create a PR to fix this?

@RangarajKaushikSundar
Copy link
Collaborator

RangarajKaushikSundar commented Aug 1, 2016

@tomchentw I will create a pull request ASAP.

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

No branches or pull requests

3 participants