diegohaz / schm

Composable schemas for JavaScript and Node.js

Home Page:https://git.io/schm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

deepmerge in defaultSchmea merge function

maloguertin opened this issue · comments

In defaultSchema merge function you have:

const merged = merge({}, this, ...schemas)

is there a reason for using lodash' deepMerge instead of a simple reduce:

const merged = schemas.reduce((merged, schema) => ({...merged, ...schema}), this)

Using lodash merge makes it incredibly slow with a lot of refs to other schemas and even worse if you want to use self referencing