/var/www/greso.tech/server/nsm/node_modules/jsdoc/lib/jsdoc/util
Edit: /var/www/greso.tech/server/nsm/node_modules/jsdoc/lib/jsdoc/util/dumper.js (3532B)
/**
* Recursively print out all names and values in a data structure.
* @module jsdoc/util/dumper
*/
const util = require('util');
const OBJECT_WALKER_KEY = 'hasBeenSeenByWalkerDumper';
const SET_DEFINED = (typeof Set !== 'undefined');
class ObjectWalker {
constructor() {
this.seenItems = SET_DEFINED ? new Set() : [];
}
seen(object) {
let result;
if (SET_DEFINED) {
result = this.seenItems.has(object);
}
else {
result = object[OBJECT_WALKER_KEY];
}
return result;
}
markAsSeen(object) {
if (SET_DEFINED) {
this.seenItems.add(object);
}
else {
object[OBJECT_WALKER_KEY] = true;
this.seenItems.push(object);
}
}
removeSeenFlag(obj) {
if (SET_DEFINED) {
this.seenItems.delete(obj);
}
else {
delete obj[OBJECT_WALKER_KEY];
}
}
/* eslint-disable class-methods-use-this */
// some objects are unwalkable, like Java native objects
isUnwalkable(o) {
return o && typeof o === 'object' && typeof o.constructor === 'undefined';
}
isFunction(o) {
return (o && typeof o === 'function') || o instanceof Function;
}
isObject(o) {
return (o && o instanceof Object) ||
(o && typeof o.constructor !== 'undefined' && o.constructor.name === 'Object');
}
/* eslint-enable class-methods-use-this */
checkCircularRefs(o, func) {
if ( this.seen(o) ) {
return '
';
}
else {
this.markAsSeen(o);
return func(o);
}
}
walk(o) {
let result;
const self = this;
if ( this.isUnwalkable(o) ) {
result = '