mergeDefaults
mergeDefaults
is a utility function that merges the default values with the values passed in. It is used to merge the default values with the values passed in by the user.
Usage
js
import {mergeDefaults} from '@we/nuxt/forms'
const defaults = {
foo: 'bar',
bar: 'foo',
}
const value = {
foo: 'baz',
}
mergeDefaults(value, defaults)
// { foo: 'baz', bar: 'foo' }
mergeDefaults(null, defaults)
// { foo: 'bar', bar: 'foo' }