Namespace: Utils

Utils

Source:

Methods


<static> defaults(defs, opts)

Takes an object of defaults and an object of options or a function that sets the options to 'this'

Parameters:
Name Type Description
defs Object

An object of defaults

opts Object | function

An object of options, or a function

Source:
Returns:
Type
Object
Examples
// uses an object as the options
// returns {a: 'one', b: 2, c: {d: 3, e: 'four'}}
Utils.defaults({a: 1, b: 2, c: {d: 3, e: 4}}, {a: 'one', c: {e: 'four'}})
// uses a function to set the options
// returns {a: 'one', b: 2, c: {d: 3, e: 'four'}}
Utils.defaults({a: 1, b: 2, c: {d: 3, e: 4}}, function(){
  this.a = 'one';
  this.c.e = 'four';
})