@profiscience/knockout-contrib-utils-defaults
v2.1.4
Published
[![Version][npm-version-shield]][npm] [![Dependency Status][david-dm-shield]][david-dm] [![Peer Dependency Status][david-dm-peer-shield]][david-dm-peer] [![Dev Dependency Status][david-dm-dev-shield]][david-dm-dev] [![Downloads][npm-stats-shield]][npm-sta
Downloads
18
Readme
utils.defaults
This package is intended for consumption via the [@profiscience/knockout-contrib] metapackage
Usage
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' }