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

Introduce CKEDITOR.tools.object.merge function #1053

Closed
mlewand opened this issue Oct 16, 2017 · 0 comments
Closed

Introduce CKEDITOR.tools.object.merge function #1053

mlewand opened this issue Oct 16, 2017 · 0 comments
Assignees
Labels
changelog:api A changelog entry should be put in the API section of the changelog. good first issue Relatively easy to fix. This is a perfect issue if you are willing to create a Pull Request. target:major Any docs related issue that should be merged into a major branch. type:feature A feature request.
Milestone

Comments

@mlewand
Copy link
Contributor

mlewand commented Oct 16, 2017

Are you reporting a feature request or a bug?

New feature

Provide detailed reproduction steps (if any)

We need a function to recursively merge objects.

This function should take 2 params obj1, obj2 and return the object that is a result of merging the two. Keep in mind that neither obj1 nor obj2 should be modified by this function (add a TC for that).

If the same primitive value is available in obj1 and obj2, the value from obj2 should be used.

This function should land in CKEDITOR.tools.object namespace, as a merge function.

If possible function may do a feature detection and use Object.assign.

Examples

{
	one: 1,
	conflicted: 10,
	obj: {
		nested1: 1
	}
}
{
	two: 2,
	conflicted: 20,
	obj: {
		nested2: 2
	}
}

Should result with the following object:

{
	one: 1,
	two: 2,
	conflicted: 20,
	obj: {
		nested1: 1,
		nested2: 2
	}
}
@mlewand mlewand changed the title Add CKEDITOR.tools.object.merge function Introduce CKEDITOR.tools.object.merge function Oct 16, 2017
@mlewand mlewand added changelog:api A changelog entry should be put in the API section of the changelog. good first issue Relatively easy to fix. This is a perfect issue if you are willing to create a Pull Request. type:feature A feature request. labels Oct 16, 2017
@mlewand mlewand added this to the 4.8.0 milestone Oct 16, 2017
@Comandeer Comandeer self-assigned this Oct 16, 2017
f1ames added a commit that referenced this issue Oct 17, 2017
Introduce CKEDITOR.tools.object.merge  - #1053
@f1ames f1ames added the target:major Any docs related issue that should be merged into a major branch. label Oct 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog:api A changelog entry should be put in the API section of the changelog. good first issue Relatively easy to fix. This is a perfect issue if you are willing to create a Pull Request. target:major Any docs related issue that should be merged into a major branch. type:feature A feature request.
Projects
None yet
Development

No branches or pull requests

3 participants