Nodes/comfy-ovum/_.extendDeep
ComfyUI Node

_.extendDeep

The merge that reaches all the way down

By sfinktah·Created about a year ago·Updated 10 months ago· 7
_.extendDeep
  • obj
  • src
  • *

_.extendDeep is the deep version of _.extend: it merges dicts together, and when both sides have a nested dict at the same key, it merges those recursively instead of letting the later source clobber the whole subtree. That's the behavior the pack's own docstring doesn't spell out - the description is just the generic "Underscore method 'extendDeep'." - so here's the honest version: shallow _.extend says "key config is replaced wholesale"; _.extendDeep says "key config is merged field by field, and only leaves that differ get overwritten."

That makes it the right tool for layering nested configs: a base settings dict with a nested sampler object, overlaid with a per-run override that changes only sampler.schedule - and you want the rest of sampler intact.

How it works

Generated wrapper around underscore3, the bundled Python port of Underscore.js. It's a recursive merge:

  • For scalar values, the later source wins.
  • For nested dicts at the same key, both get merged recursively.
  • For lists, the behavior is replace-by-later (the port's extendDeep doesn't do the "union or append" trick some deep-merge libraries do) - in general, treat lists as overwritten, not appended.

Signature-wise the underlying method also takes a func argument in the port, but the generated node only exposes the primary obj and the src source socket, so you work with plain object merges through the UI.

Inputs and output

  • obj (any type) - the destination object being merged into.
  • src (any type) - the source dict to merge in; JSON allowed for arrays/objects.
  • Output: * (any type) - the merged object.

Installing it

Part of sfinktah/comfy-ovum ("comfy-ovum"):

  • ComfyUI Manager: search "comfy-ovum", install, restart.
  • Manual: cd ComfyUI/custom_nodes && git clone https://github.com/sfinktah/comfy-ovum, restart.

No model downloads; light dependencies; underscore3 bundled in the repo.

Where it earns its keep - and where it doesn't

Use it when you're merging nested configs and "replace the whole subtree" would lose data. Don't reach for it for flat merges - _.extend is cheaper and just as good there. Two cautions: deep merges are where correctness matters most, and the pack's own documentation for this node is the thinnest of the family, so test it on a representative nested dict before trusting it in a workflow you depend on. The README's standing warning that the underscore suite is work-in-progress applies here with extra force - this is one of the more complex methods in the set.

Categoryovum/underscore

Inputs (2)

NameTypeDefaultDescription
objopt*Primary input object. Also accepts _.CHAIN to continue chaining.
srcopt*src: JSON allowed for arrays/objects where applicable.

Outputs (1)

NameTypeDescription
**