UNPKG

@mightyplow/jslib

Version:

js helpers library

17 lines (15 loc) 827 B
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /** * Populates an object with default values. * * @memberOf object * @param {Object} obj - the object to populate the values on * @param {Object} values - the default values to populate on the target object * @return {Object} a new object with the default values and the object values */ var defaults = function defaults() { var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var values = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; return _extends({}, values, obj); }; export default defaults;