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