deepmerge icon indicating copy to clipboard operation
deepmerge copied to clipboard

Support merge generators

Open SettingDust opened this issue 2 years ago • 3 comments

Prerequisites

  • [X] I have written a descriptive issue title
  • [X] I have searched existing issues to ensure the feature has not already been requested

🚀 Feature Proposal

Support merge generators

Motivation

No response

Example

const values1 = function * () {
  yield * [0, 1, 2, 3, 4]
}
const values2 = function * () {
  yield * [5, 6, 7, 8, 9]
}

deepmerge(values1, value2) // generator like 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 <- ordered
const values1 = async function * () {
  yield * [0, 1, 2, 3, 4]
}
const values2 = async function * () {
  yield * [5, 6, 7, 8, 9]
}

deepmerge(values1, value2) // async generator like 0, 1, 5, 2, 6, 7, 3, 4, 8, 9 <- no order

SettingDust avatar May 11 '23 08:05 SettingDust

I think this should be a separate function than the main deepmerge.

Overall, I think this might be better implemented as a new utility module.

mcollina avatar May 13 '23 16:05 mcollina