| Server IP : 68.183.124.220 / Your IP : 216.73.217.137 Web Server : Apache/2.4.18 (Ubuntu) System : Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : gavin ( 1000) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/gavin/workspace/readjs/node_modules/whet.extend/lib/ |
Upload File : |
// Generated by CoffeeScript 1.3.3
/*
* whet.extend v0.9.7
* Standalone port of jQuery.extend that actually works on node.js
* https://github.com/Meettya/whet.extend
*
* Copyright 2012, Dmitrii Karpich
* Released under the MIT License
*/
(function() {
var extend, _findValue, _isClass, _isOwnProp, _isPlainObj, _isPrimitiveType, _isTypeOf, _prepareClone,
__slice = [].slice;
module.exports = extend = function() {
var args, copy, deep, name, options, target, _i, _len, _ref;
deep = arguments[0], target = arguments[1], args = 3 <= arguments.length ? __slice.call(arguments, 2) : [];
if (!_isClass(deep, 'Boolean')) {
args.unshift(target);
_ref = [deep || {}, false], target = _ref[0], deep = _ref[1];
}
if (_isPrimitiveType(target)) {
target = {};
}
for (_i = 0, _len = args.length; _i < _len; _i++) {
options = args[_i];
if (options != null) {
for (name in options) {
copy = options[name];
target[name] = _findValue(deep, copy, target[name]);
}
}
}
return target;
};
/*
Internal methods from now
*/
_isClass = function(obj, str) {
return ("[object " + str + "]") === Object.prototype.toString.call(obj);
};
_isOwnProp = function(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
};
_isTypeOf = function(obj, str) {
return str === typeof obj;
};
_isPlainObj = function(obj) {
var key;
if (!obj) {
return false;
}
if (obj.nodeType || obj.setInterval || !_isClass(obj, 'Object')) {
return false;
}
if (obj.constructor && !_isOwnProp(obj, 'constructor') && !_isOwnProp(obj.constructor.prototype, 'isPrototypeOf')) {
return false;
}
for (key in obj) {
key;
}
return key === void 0 || _isOwnProp(obj, key);
};
_isPrimitiveType = function(obj) {
return !(_isTypeOf(obj, 'object') || _isTypeOf(obj, 'function'));
};
_prepareClone = function(copy, src) {
if (_isClass(copy, 'Array')) {
if (_isClass(src, 'Array')) {
return src;
} else {
return [];
}
} else {
if (_isPlainObj(src)) {
return src;
} else {
return {};
}
}
};
_findValue = function(deep, copy, src) {
var clone;
if (deep && (_isClass(copy, 'Array') || _isPlainObj(copy))) {
clone = _prepareClone(copy, src);
return extend(deep, clone, copy);
} else {
return copy;
}
};
}).call(this);