UNPKG

cannon-es-control

Version:

A lightweight 3D physics engine written in JavaScript with control system tools

18 lines (16 loc) 554 B
export class Utils { /** * Extend an options object with default values. * @param options The options object. May be falsy: in this case, a new object is created and returned. * @param defaults An object containing default values. * @return The modified options object. */ static defaults(options: Record<string, any> = {}, defaults: Record<string, any>): Record<string, any> { for (let key in defaults) { if (!(key in options)) { options[key] = defaults[key] } } return options } }