UNPKG

cannon

Version:

A lightweight 3D physics engine written in JavaScript.

24 lines (19 loc) 581 B
function Utils(){} module.exports = Utils; /** * Extend an options object with default values. * @static * @method defaults * @param {object} options The options object. May be falsy: in this case, a new object is created and returned. * @param {object} defaults An object containing default values. * @return {object} The modified options object. */ Utils.defaults = function(options, defaults){ options = options || {}; for(var key in defaults){ if(!(key in options)){ options[key] = defaults[key]; } } return options; };