Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/deep-copy/ drwxr-xr-x | |
| Viewing file: Select action/file-type:
;(function (name, root, factory) {
if (typeof exports === 'object') {
module.exports = factory()
}
/* istanbul ignore next */
else if (typeof define === 'function' && define.amd) {
define(factory)
}
else {
root[name] = factory()
}
}('dcopy', this, function () {
/**
* Deep copy objects and arrays
*
* @param {Object/Array} target
* @return {Object/Array} copy
* @api public
*/
return function (target) {
if (/number|string|boolean/.test(typeof target)) {
return target
}
if (target instanceof Date) {
return new Date(target.getTime())
}
var copy = (target instanceof Array) ? [] : {}
walk(target, copy)
return copy
function walk (target, copy) {
for (var key in target) {
var obj = target[key]
if (obj instanceof Date) {
var value = new Date(obj.getTime())
add(copy, key, value)
}
else if (obj instanceof Function) {
var value = obj
add(copy, key, value)
}
else if (obj instanceof Array) {
var value = []
var last = add(copy, key, value)
walk(obj, last)
}
else if (obj instanceof Object) {
var value = {}
var last = add(copy, key, value)
walk(obj, last)
}
else {
var value = obj
add(copy, key, value)
}
}
}
}
/**
* Adds a value to the copy object based on its type
*
* @api private
*/
function add (copy, key, value) {
if (copy instanceof Array) {
copy.push(value)
return copy[copy.length - 1]
}
else if (copy instanceof Object) {
copy[key] = value
return copy[key]
}
}
}))
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0053 ]-- |