Entry 12753

couchdb.json.datastructure.stats

   

Submitted by mathgladiator on Dec. 17, 2010 at 5:45 a.m.
Language: JavaScript. Code size: 755 bytes.

function(doc) {

var type_signature = function(prefix,anything)
{
        var typ = typeof(anything);
        var sig = [];
        if(anything=='null') return ['null'];
        if(typ=='object')
        {
                for(var key in anything)
                {
                        var subtypes = type_signature(prefix.concat(["." + key]),anything[key]);
                        for(var idx in subtypes)
                        {
                                sig[sig.length] = subtypes[idx];
                        }
                }
                return sig;
        }

        return [prefix.concat([typ])];
}
var types = type_signature([doc.ns],doc)
for(var k = 0; k < types.length; k++)
	emit( types[k] , 1);

}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).