-
Notifications
You must be signed in to change notification settings - Fork 8
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
Conversation
👍 |
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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; }; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
No description provided.