:metal: KnockoutJS Goodies Monorepo
This package is intended for consumption via the [@profiscience/knockout-contrib] metapackage
defaults(dest, defaultValues[, mapArrays = false])
Creates observables for enumerable properties of defaultValues
where undefined in the destination object.
If mapArrayElements
is true, array elements will be created using utils.fromJS.
import { defaults } from '@profiscience/knockout-contrib'
const foos = { foo: 'foo' }
defaults(foos, { foo: 'bar', bar: 'bar' })
foos()
// { foo: 'foo', bar: 'bar' }