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

get rid of can-util #75

Merged
merged 3 commits into from
Jul 4, 2018
Merged

get rid of can-util #75

merged 3 commits into from
Jul 4, 2018

Conversation

cherifGsoul
Copy link
Member

can-list.js Outdated
var canReflect = require('can-reflect');
var isPromise = canReflect.isPromise;
var makeArray = canReflect.toArray;
Copy link
Member

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.

Copy link
Member Author

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 || []));
Copy link
Member

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)

Copy link
Member Author

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 || [])));
Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed!

@chasenlehara chasenlehara merged commit 6e39bfe into master Jul 4, 2018
@chasenlehara chasenlehara deleted the can-util-removal branch July 4, 2018 01:45
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

2 participants