Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ferferga
Copy link

@ferferga ferferga commented Aug 27, 2023

πŸ”— Linked issue

Fixes #48

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

  • Minor code improvement by using optional chaining as well when checking for merger function
  • Create defuSchema for removing keys not present in the default object

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@ferferga
Copy link
Author

ferferga commented Oct 7, 2023

@pi0 Can I get a review in this please?

@ferferga ferferga changed the title feat: create defuSchema and optional chaining feat: create defuSchema Oct 25, 2023
@ferferga ferferga mentioned this pull request Oct 25, 2023
8 tasks
@ferferga ferferga requested a review from pi0 October 25, 2023 07:16
@ferferga
Copy link
Author

ferferga commented Nov 6, 2023

@pi0 Can I get a re-review of this please? Would be realy useful to have this upstream already πŸ˜…

@ferferga ferferga requested a review from pi0 November 8, 2023 22:28
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

Thanks! (i will try to merge and release by this week)

@pi0 pi0 changed the title feat: create defuSchema feat: add `defuSchema Nov 8, 2023
@pi0
Copy link
Member

pi0 commented Nov 8, 2023

Once last thing, it is missing in https://github.com/unjs/defu/blob/main/lib/defu.cjs

@pi0 pi0 changed the title feat: add `defuSchema feat: add defuSchema Nov 8, 2023
@ferferga
Copy link
Author

ferferga commented Nov 9, 2023

@pi0 Done!

@ferferga
Copy link
Author

ferferga commented Jan 6, 2024

@pi0 Hey sorry for pinging again about this... But it would be really useful to have this upstream!

@ferferga
Copy link
Author

@pi0 I fixed the conflicts after the merge of #121

Comment on lines +137 to +145
console.log(
defuSchema(
{ a: 1, b: 2, c: 3, d: 4 },
{ a: 2, c: 4, d: 6, e: 8 }
)
);
// => { a: 1, c: 3, d: 4, e: 8 }
``

Choose a reason for hiding this comment

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

defuSchema(
      { a: 1, b: 2, c: 3, d: 4 },
      { a: 2, c: 4, d: 6, e: 8 }
  )
  // => { a: 2, b: 2, c:4, d: 6 }

You can check the issua that is opened, the output should be like this. It is useful to review your code.

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.

request: schema support

3 participants