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

Add an object.append() method #1381

Closed
kanongil opened this issue Dec 18, 2017 · 1 comment
Closed

Add an object.append() method #1381

kanongil opened this issue Dec 18, 2017 · 1 comment
Assignees
Labels
feature New functionality or improvement
Milestone

Comments

@kanongil
Copy link
Contributor

While the object.keys(schema) method allows an existing schema to be extended, the behaviour when no keys are present does not align with what I expect. Namely undefined, null, & {} does not extend the existing schema, but for some reason replaces it.

This means that if I want to optionally extend a schema, I will need to manually test the extension for these values, to avoid calling object.keys() with it.

As such, I would like to propose an object.append(schema) method, which will do nothing for these values, and otherwise do what object.keys(schema) does.

@Marsup
Copy link
Collaborator

Marsup commented Dec 18, 2017

I guess there's no harm in having a utility method skipping this, fwiw those behaviors are well documented.
I'll take a PR.

@Marsup Marsup added this to the 13.2.0 milestone Mar 9, 2018
@Marsup Marsup self-assigned this Mar 9, 2018
@Marsup Marsup closed this as completed in 1993de4 Mar 9, 2018
Marsup added a commit that referenced this issue Mar 9, 2018
Add an object.append() method. Fixes #1381.
@hueniverse hueniverse added feature New functionality or improvement and removed request labels Sep 19, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Mar 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New functionality or improvement
Projects
None yet
Development

No branches or pull requests

3 participants