Sha256: 8b679cc688b7f5a56dbde401c8d8048450d13f3d5a8a6956c5e549a8c41e3b65

Contents?: true

Size: 684 Bytes

Versions: 10

Compression:

Stored size: 684 Bytes

Contents

/*jslint node:true */
var fs = require('fs'),
    esprima = require('../esprima'),
    files = process.argv.splice(2),
    histogram,
    type;

histogram = {
    Boolean: 0,
    Identifier: 0,
    Keyword: 0,
    Null: 0,
    Numeric: 0,
    Punctuator: 0,
    RegularExpression: 0,
    String: 0
};

files.forEach(function (filename) {
    'use strict';
    var content = fs.readFileSync(filename, 'utf-8'),
        tokens = esprima.parse(content, { tokens: true }).tokens;

    tokens.forEach(function (token) {
        histogram[token.type] += 1;
    });
});

for (type in histogram) {
    if (histogram.hasOwnProperty(type)) {
        console.log(type, histogram[type]);
    }
}

Version data entries

10 entries across 6 versions & 2 rubygems

Version Path
sprockets-browserify-0.3.0 node_modules/browserify/node_modules/insert-module-globals/node_modules/lexical-scope/node_modules/astw/node_modules/esprima/examples/tokendist.js
sprockets-browserify-0.3.0 node_modules/browserify/node_modules/module-deps/node_modules/detective/node_modules/esprima/examples/tokendist.js
sprockets-browserify-0.2.0 node_modules/browserify/node_modules/insert-module-globals/node_modules/lexical-scope/node_modules/astw/node_modules/esprima/examples/tokendist.js
sprockets-browserify-0.2.0 node_modules/browserify/node_modules/module-deps/node_modules/detective/node_modules/esprima/examples/tokendist.js
ruby-wisp-source-0.8.0 vendor/node_modules/browserify/node_modules/module-deps/node_modules/detective/node_modules/esprima/examples/tokendist.js
ruby-wisp-source-0.8.0 vendor/node_modules/browserify/node_modules/insert-module-globals/node_modules/lexical-scope/node_modules/astw/node_modules/esprima/examples/tokendist.js
ruby-wisp-source-0.7.0 vendor/node_modules/browserify/node_modules/insert-module-globals/node_modules/lexical-scope/node_modules/astw/node_modules/esprima/examples/tokendist.js
ruby-wisp-source-0.7.0 vendor/node_modules/browserify/node_modules/module-deps/node_modules/detective/node_modules/esprima/examples/tokendist.js
sprockets-browserify-0.1.2 node_modules/module-deps/node_modules/detective/node_modules/esprima/examples/tokendist.js
sprockets-browserify-0.1.0 node_modules/module-deps/node_modules/detective/node_modules/esprima/examples/tokendist.js