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/fast-safe-stringify/ drwxr-xr-x | |
| Viewing file: Select action/file-type: module.exports = stringify
stringify.default = stringify
function stringify (obj) {
decirc(obj, '', [], null)
return JSON.stringify(obj)
}
function Circle (val, k, parent) {
this.val = val
this.k = k
this.parent = parent
this.count = 1
}
Circle.prototype.toJSON = function toJSON () {
if (--this.count === 0) {
this.parent[this.k] = this.val
}
return '[Circular]'
}
function decirc (val, k, stack, parent) {
if (typeof val === 'object' && val !== null) {
if (typeof val.toJSON === 'function') {
if (val instanceof Circle) {
val.count++
return
}
if (val.toJSON.forceDecirc === undefined) {
return
}
}
for (var i = 0; i < stack.length; i++) {
if (stack[i] === val) {
parent[k] = new Circle(val, k, parent)
return
}
}
stack.push(val)
for (var key in val) {
if (Object.prototype.hasOwnProperty.call(val, key)) {
decirc(val[key], key, stack, val)
}
}
stack.pop()
}
}
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.005 ]-- |