'use strict'; var typeOf = require('kind-of'); /** * Expose `extend` */ module.exports = extend; /** * Extend `o` with properties of other `objects`. * * @param {Object} `o` The target object. Pass an empty object to shallow clone. * @param {Object} `objects` * @return {Object} */ function extend(o) { if (typeOf(o) !== 'object') { return {}; } var args = arguments; var len = args.length - 1; for (var i = 0; i < len; i++) { var obj = args[i + 1]; if (typeOf(obj) === 'object' && typeOf(obj) !== 'regexp') { for (var key in obj) { if (obj.hasOwnProperty(key)) { o[key] = obj[key]; } } } } return o; };