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

objects.defaultsDeep #161

Closed
3 tasks done
jkvyff opened this issue Jan 6, 2020 · 2 comments
Closed
3 tasks done

objects.defaultsDeep #161

jkvyff opened this issue Jan 6, 2020 · 2 comments
Labels
enhancement New feature or request operator

Comments

@jkvyff
Copy link
Collaborator

jkvyff commented Jan 6, 2020

Merges properties recursively, but once a property is set, additional values of the same property are ignored.

Checklist

  • implementation
  • tests
  • jsdoc

Details

const obj1 = { a: { b: [3, 4] } };
const obj2 = { a: { b: [9, 18, 15], c: 3 } };
console.log(objects.defaultsDeep(obj1, obj2);
> { a: { b: [ 3, 4, 15 ], c: 3 } }

References

@jkvyff jkvyff added enhancement New feature or request operator labels Jan 6, 2020
@jkvyff jkvyff mentioned this issue Jan 6, 2020
@evanplaice
Copy link
Member

@jkvyff Is it just me or does this seem like the same thing as objects.deep?

Are objects.merge and objects.defaultDeep the same?

@evanplaice
Copy link
Member

evanplaice commented Jan 6, 2020

Added in v0.69

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request operator
Projects
None yet
Development

No branches or pull requests

2 participants