a zip code crypto-currency system good for red ONLY

12345678910111213141516171819202122232425262728293031323334
  1. /*jslint node:true */
  2. var fs = require('fs'),
  3. esprima = require('../esprima'),
  4. files = process.argv.splice(2),
  5. histogram,
  6. type;
  7. histogram = {
  8. Boolean: 0,
  9. Identifier: 0,
  10. Keyword: 0,
  11. Null: 0,
  12. Numeric: 0,
  13. Punctuator: 0,
  14. RegularExpression: 0,
  15. String: 0
  16. };
  17. files.forEach(function (filename) {
  18. 'use strict';
  19. var content = fs.readFileSync(filename, 'utf-8'),
  20. tokens = esprima.parse(content, { tokens: true }).tokens;
  21. tokens.forEach(function (token) {
  22. histogram[token.type] += 1;
  23. });
  24. });
  25. for (type in histogram) {
  26. if (histogram.hasOwnProperty(type)) {
  27. console.log(type, histogram[type]);
  28. }
  29. }