JSPM

ascii-histogram

1.2.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 60
  • Score
    100M100P100Q83299F
  • License MIT

Ascii histograms

Package Exports

  • ascii-histogram

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ascii-histogram) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ascii-histogram

Ascii histograms for node.

     cats | ########################                                     | 6
  ferrets | ############################################################ | 15
     dogs | ########                                                     | 2
   koalas |                                                              | 0


     dogs | ==================== | 30
  ferrets | =============        | 20
     cats | ========             | 12
   koalas | ==                   | 3


  /data | ******************** | 150gb
   /srv | *                    | 5gb
   /etc |                      | 150mb

Installation

$ npm install ascii-histogram

Example

var histogram = require('ascii-histogram');
var bytes = require('bytes');

var data = {
  cats: 6,
  ferrets: 15,
  dogs: 2,
  koalas: 0
};

console.log();
console.log(histogram(data));

// customized

var data = {
  ferrets: 20,
  cats: 12,
  dogs: 30,
  koalas: 3
};

console.log();
console.log(histogram(data, { bar: '=', width: 20, sort: true }));

// value mapping

var data = {
  '/srv': bytes('5gb'),
  '/data': bytes('150gb'),
  '/etc': bytes('150mb')
};

console.log();
console.log(histogram(data, { bar: '*', width: 20, sort: true, map: bytes }));

License

MIT