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

Expose assignOptions #530

Merged
merged 6 commits into from
Jul 25, 2018
Merged

Expose assignOptions #530

merged 6 commits into from
Jul 25, 2018

Conversation

szmarczak
Copy link
Collaborator

IOW: the correct way to inherit from options.

@szmarczak szmarczak mentioned this pull request Jul 19, 2018
7 tasks
@@ -11,7 +11,16 @@ Configure a new `got` instance with the provided settings.<br>

##### [options](readme.md#options)

To inherit from parent, set it as `got.defaults.options` or use [object spread](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax#Spread_in_object_literals).
To inherit from parent, set it as `got.defaults.options` or use `got.assignOptions(defaults.options, options)`.<br>
Avoid using [object spread](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax#Spread_in_object_literals) as it may give unwanted result:
Copy link
Owner

Choose a reason for hiding this comment

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

as it may give unwanted result: => as it doesn't work recursively:

@sindresorhus
Copy link
Owner

Makes sense to me, but then assignOptions needs to be documented properly in the API docs: https://github.com/sindresorhus/got#api

@szmarczak
Copy link
Collaborator Author

Yeah, completely forgot about this.

@sindresorhus sindresorhus merged commit 8cccd8a into sindresorhus:master Jul 25, 2018
@szmarczak szmarczak deleted the expose-ao branch January 17, 2019 18:54
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