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

Remove "ember-lodash" dependency #22

Merged
merged 1 commit into from
Jun 20, 2016
Merged

Conversation

Turbo87
Copy link
Collaborator

@Turbo87 Turbo87 commented Jun 19, 2016

This PR removes the ember-lodash dependency. Importing all of lodash just for these two functions seems a bit wasteful to me unless you're already using it anyway.

@Turbo87
Copy link
Collaborator Author

Turbo87 commented Jun 19, 2016

Travis failure seems unrelated

@@ -116,31 +114,34 @@ export default Ember.Service.extend({
_filterCachedFastBootCookies(fastBootCookiesCache) {
let { hostname, path: requestPath, protocol } = this.get('_fastBoot.request');

return _collection.reduce(fastBootCookiesCache, (acc, cookie, name) => {
Copy link
Member

Choose a reason for hiding this comment

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

return Ember.A(_collection).reduce(…

should work here as well, using for … in with continue feels much worse than using reduce.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

return Ember.A(_collection).reduce(… doesn't work because we're iterating over fastBootCookiesCache, not _collection. return Ember.A(fastBootCookiesCache).reduce(… however also doesn't work because fastBootCookiesCache is an object, not an array. it seems that the only reason for using lodash here was that lodash can iterate over the key-value pairs of an object directly, but I don't think that's worth the big dependency if a simple for-in loop can do the same.

Copy link
Member

Choose a reason for hiding this comment

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

Ah right. I guess we could keys(fastBootCookiesCache).reduce(… then though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, that seems to work too. I've updated the PR with that suggestion.

@marcoow marcoow merged commit f0f8bd9 into mainmatter:master Jun 20, 2016
@marcoow
Copy link
Member

marcoow commented Jun 20, 2016

🎉

@Turbo87 Turbo87 deleted the remove-lodash branch June 20, 2016 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants