Sha256: c46891fe81f7d99ea242471397c6a21650b670cf2d5847c4c65f36139067ec5a

Contents?: true

Size: 1.12 KB

Versions: 235

Compression:

Stored size: 1.12 KB

Contents

module.exports = sigmund
function sigmund (subject, maxSessions) {
    maxSessions = maxSessions || 10;
    var notes = [];
    var analysis = '';
    var RE = RegExp;

    function psychoAnalyze (subject, session) {
        if (session > maxSessions) return;

        if (typeof subject === 'function' ||
            typeof subject === 'undefined') {
            return;
        }

        if (typeof subject !== 'object' || !subject ||
            (subject instanceof RE)) {
            analysis += subject;
            return;
        }

        if (notes.indexOf(subject) !== -1 || session === maxSessions) return;

        notes.push(subject);
        analysis += '{';
        Object.keys(subject).forEach(function (issue, _, __) {
            // pseudo-private values.  skip those.
            if (issue.charAt(0) === '_') return;
            var to = typeof subject[issue];
            if (to === 'function' || to === 'undefined') return;
            analysis += issue;
            psychoAnalyze(subject[issue], session + 1);
        });
    }
    psychoAnalyze(subject, 0);
    return analysis;
}

// vim: set softtabstop=4 shiftwidth=4:

Version data entries

235 entries across 152 versions & 16 rubygems

Version Path
ilog-0.4.1 node_modules/sigmund/sigmund.js
ilog-0.4.0 node_modules/sigmund/sigmund.js
ilog-0.3.3 node_modules/sigmund/sigmund.js
ela-4.1.6 node_modules/sigmund/sigmund.js
ela-4.1.5 node_modules/sigmund/sigmund.js
ela-4.1.4 node_modules/sigmund/sigmund.js
ela-4.1.3 node_modules/sigmund/sigmund.js
ela-4.1.2 node_modules/sigmund/sigmund.js
ela-4.1.1 node_modules/sigmund/sigmund.js
ela-4.1.0 node_modules/sigmund/sigmund.js
ela-4.0.0 node_modules/sigmund/sigmund.js
ela-3.4.3 node_modules/sigmund/sigmund.js
ela-3.4.2 node_modules/sigmund/sigmund.js
ela-3.4.0 node_modules/sigmund/sigmund.js
ela-3.3.1 node_modules/sigmund/sigmund.js
ela-3.3.0 node_modules/sigmund/sigmund.js
ela-3.2.0 node_modules/sigmund/sigmund.js
ela-3.1.1 node_modules/sigmund/sigmund.js
ela-3.1.0 node_modules/sigmund/sigmund.js
ela-3.0.0 node_modules/sigmund/sigmund.js