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 identity option for diff #174 #175

Merged
merged 4 commits into from
Jan 3, 2017
Merged

Conversation

ilyavf
Copy link
Contributor

@ilyavf ilyavf commented Dec 28, 2016

No description provided.

@matthewp
Copy link
Contributor

👍

@ilyavf ilyavf assigned ilyavf and unassigned justinbmeyer Dec 29, 2016
@ilyavf
Copy link
Contributor Author

ilyavf commented Dec 29, 2016

I think this is ready for a review.

*
* @param {ArrayLike} oldList the array to diff from
* @param {ArrayLike} newList the array to diff to
* @param {function} identity an optional identity function for comparing elements
Copy link
Contributor

Choose a reason for hiding this comment

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

@typdef {function(*,*)} can-util/diff/diff/typedefs.identity identify(a, b)

@param {*} a This is something.
@param  {can-util/diff/diff/typedefs.identity} identity(a, b)
  @option {*} a

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added a TODO for now.

* ```
*/
module.exports = exports = function(oldList, newList){
module.exports = exports = function(oldList, newList, identity){
identity = identity || function(a,b){ return a === b; };
Copy link
Contributor

Choose a reason for hiding this comment

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

don't re-create the identity function every time.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@justinbmeyer justinbmeyer merged commit 43897fe into master Jan 3, 2017
@justinbmeyer justinbmeyer deleted the identity-option-174 branch January 3, 2017 21:07
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

3 participants