-
Notifications
You must be signed in to change notification settings - Fork 1
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
get rid of can-util #75
Conversation
can-list.js
Outdated
var canReflect = require('can-reflect'); | ||
var isPromise = canReflect.isPromise; | ||
var makeArray = canReflect.toArray; |
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.
It’s uncommon for us to write it like that; I would just use canReflect
where it’s needed.
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.
Fixed, many thanks 👍
can-list.js
Outdated
this.replace(instances); | ||
} else { | ||
teardownMapping = instances.length && mapHelpers.addToMap(instances, this); | ||
this.push.apply(this, makeArray(instances || [])); | ||
this.push.apply(this, canReflect.toArray(instances || [])); |
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.
It’d be nice if we changed this to check for instances
, something like:
instances === undefined ? [] : canReflect.toArray(instances)
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.
Fixed!
can-list.js
Outdated
@@ -737,7 +734,7 @@ assign(List.prototype, { | |||
} | |||
}); | |||
} else { | |||
this.splice.apply(this, [0, this.length].concat(makeArray(newList || []))); | |||
this.splice.apply(this, [0, this.length].concat(canReflect.toArray(newList || []))); |
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.
Same with this line; we shouldn’t pass an empty array to canReflect.toArray
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.
Fixed!
for canjs/canjs#4218