Skip to content

fix collection exec for get type - #7

Open
serp-dev wants to merge 1 commit into
2do2go:masterfrom
serp-dev:fix/collection-exec-for-get-request-type
Open

fix collection exec for get type#7
serp-dev wants to merge 1 commit into
2do2go:masterfrom
serp-dev:fix/collection-exec-for-get-request-type

Conversation

@serp-dev

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread lib/collection.js
_.isObject(options.data) &&
_([
'post', 'patch', 'put'
]).contains((options.type || params.type).toLowerCase())

@artzhookov artzhookov Mar 23, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it's a good practice to split such huge constructions to smaller pieces to prevent unreadable if conditions.
In this case I'd define a type variable var type = (options.type || params.type).toLowerCase(); above and change this line to

_(['post', 'patch', 'put']).contains(type)

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.

2 participants