Upsilon-VsCode/Client/node_modules/extend-shallow/index.js

37 lines
683 B
JavaScript
Raw Normal View History

2019-02-17 17:07:28 +00:00
'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;
};