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

Add ability to use a custom comparator instead a default equals - '==' #28

Closed
wants to merge 2 commits into from

Conversation

pomozoff
Copy link

It's not enough to use a default values equality for my project and I extended the code with ability to init a Changeset with a custom comparator.
If you will find this change helpful, please, consider it to merge to your project.

@muescha
Copy link

muescha commented Jan 13, 2017

just a short code review:

is the new comperator also nessesary in the extension of Edit item?

extension Edit: Equatable {}
public func ==

@@ -76,7 +83,28 @@ public struct Changeset<T: Collection> where T.Iterator.Element: Equatable, T.In
- returns: An array of `Edit` elements.
*/
public static func edits(from s: T, to t: T) -> [Edit<T.Iterator.Element>] {

return edits(from: s, to: t) { $0 == $1 }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just do edits(from: s, to: t, comparator: ==). No need to create an extra closure.

@muescha
Copy link

muescha commented Mar 24, 2017

you should add some code examples in README.md in section Usage

@osteslag osteslag force-pushed the master branch 2 times, most recently from 1f8b3e1 to fa8c088 Compare March 29, 2017 07:05
@klaaspieter klaaspieter mentioned this pull request Mar 9, 2018
@osteslag
Copy link
Owner

Fixed by #45.

@osteslag osteslag closed this Mar 14, 2018
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

4 participants