Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babar

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babar - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

31

lib/babar.js

@@ -21,8 +21,11 @@ // Generated by CoffeeScript 1.6.3

pointsMinMaxUniqueX = function(points) {
var maxX, maxY, minX, minY, uniqueX, valX, _ref;
var maxX, maxY, minX, minY, valX, _ref;
valX = [];
_ref = points.reduce(function(prev, point) {
var _ref;
return [Math.min(prev[0], point[0]), Math.max(prev[1], point[0]), Math.min(prev[2], point[1]), Math.max(prev[3], point[1]), (_ref = point[0], __indexOf.call(valX, _ref) < 0) ? valX.push(point[0]) : void 0];
}, [Infinity, -Infinity, Infinity, -Infinity]), minX = _ref[0], maxX = _ref[1], minY = _ref[2], maxY = _ref[3], uniqueX = _ref[4];
if (_ref = point[0], __indexOf.call(valX, _ref) < 0) {
valX.push(point[0]);
}
return [Math.min(prev[0], point[0]), Math.max(prev[1], point[0]), Math.min(prev[2], point[1]), Math.max(prev[3], point[1])];
}, [Infinity, -Infinity, Infinity, -Infinity]), minX = _ref[0], maxX = _ref[1], minY = _ref[2], maxY = _ref[3];
return {

@@ -97,3 +100,3 @@ minX: minX,

createBkt = function(points, numBkts, minX, diffX) {
var bkt, p, u, x, y, _i, _len;
var bkt, i, p, u, x, y, _i, _j, _len, _ref;
bkt = [];

@@ -109,2 +112,7 @@ for (_i = 0, _len = points.length; _i < _len; _i++) {

}
for (i = _j = 0, _ref = bkt.length; 0 <= _ref ? _j < _ref : _j > _ref; i = 0 <= _ref ? ++_j : --_j) {
if (!bkt[i]) {
bkt[i] = [];
}
}
return bkt;

@@ -114,9 +122,14 @@ };

avgBkt = function(bkt) {
var values, _i, _len, _results;
var prev, values, _i, _len, _results;
prev = 0;
_results = [];
for (_i = 0, _len = bkt.length; _i < _len; _i++) {
values = bkt[_i];
_results.push(1 / values.length * values.reduce(function(prev, curr) {
return prev + curr[1];
}, 0));
if (values.length) {
_results.push(prev = 1 / values.length * values.reduce(function(prev, curr) {
return prev + curr[1];
}, 0));
} else {
_results.push(prev);
}
}

@@ -186,3 +199,3 @@ return _results;

for (u = _j = 0; 0 <= numBkts ? _j < numBkts : _j > numBkts; u = 0 <= numBkts ? ++_j : --_j) {
lbl = 1 + roundToFixed(minX + u * diffX / (numBkts - 1), xFractions);
lbl = roundToFixed(minX + u * diffX / (numBkts - 1), xFractions);
lblXW = Math.max(lblXW, lbl.length);

@@ -189,0 +202,0 @@ }

{
"name": "babar",
"version": "0.0.2",
"version": "0.0.3",
"description": "CLI bar charts",

@@ -5,0 +5,0 @@ "main": "lib/babar.js",

@@ -44,3 +44,3 @@ # Babar

While it does it best to render the data automatically, you can also pass along some options.
While it does its best to render the data automatically, you can also pass along some options.

@@ -63,4 +63,4 @@ var babar = require('babar');

* **height=15**: output will fit in specified height
* **xFractions**: number of fractions for x labels, does it best by default
* **yFractions**: number of fractions for y labels, does it best by default
* **xFractions**: number of fractions for x labels, does its best by default
* **yFractions**: number of fractions for y labels, does its best by default

@@ -67,0 +67,0 @@ ## License

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc