Skip to content

Instantly share code, notes, and snippets.

@simongong
Last active August 29, 2015 14:05
Show Gist options
  • Save simongong/6d945c600d847865f8c4 to your computer and use it in GitHub Desktop.
Save simongong/6d945c600d847865f8c4 to your computer and use it in GitHub Desktop.
JavaScript: jsExtend
var isFunction = function(target){
var getType = {};
return !!target &&
(getType.toString.call(target) === '[object Function]' ||
typeof target === 'function');
};
var objectExtend = function(where) {
Array.prototype.slice.call(arguments, 1).forEach(function(source) {
var key;
for (key in source) {
if (source.hasOwnProperty(key)) {
where[key] = source[key];
}
}
});
return where;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment