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

sparkline

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sparkline - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

15

lib/sparkline.js

@@ -15,2 +15,6 @@ /*

function lshift(n, bits) {
return Math.floor(n) * Math.pow(2, bits);
}
sparkline = function(numbers, options) {

@@ -20,10 +24,17 @@ options = options || {};

min = typeof options.min === 'number' ? options.min : Math.min.apply(null, numbers),
html = typeof options.html === 'boolean' ? options.html : false,
results = [],
f, i;
f = ~~(((max - min) << 8) / (ticks.length - 1));
f = Math.floor(lshift(max - min, 8) / (ticks.length - 1));
if (f < 1) { f = 1; }
for (i = 0; i < numbers.length; i++) {
results.push(ticks[~~(((numbers[i] - min) << 8) / f)]);
var value = ticks[Math.floor(lshift(numbers[i] - min, 8) / f)];
if (html) {
value = '<span title="' + numbers[i] + '">' + value + '</span>';
}
results.push(value);
}

@@ -30,0 +41,0 @@

12

package.json
{
"name": "sparkline",
"description": "A JavaScript implementation of 'spark'.",
"version": "0.1.2",
"version": "0.2.0",
"homepage": "https://github.com/shiwano/sparkline",

@@ -34,12 +34,12 @@ "author": {

"devDependencies": {
"grunt-contrib-jshint": "~0.6.4",
"grunt-contrib-nodeunit": "~0.2.1",
"grunt-contrib-watch": "~0.5.3",
"grunt": "~0.4.1"
"grunt-contrib-jshint": "~1.1.0",
"grunt-contrib-nodeunit": "~1.0.0",
"grunt-contrib-watch": "~1.0.0",
"grunt": "~1.0.1"
},
"keywords": ["spark", "graph"],
"dependencies": {
"nopt": "~2.1.2",
"nopt": "~4.0.1",
"here": "0.0.2"
}
}

@@ -42,2 +42,3 @@ # sparkline [![Build Status](https://secure.travis-ci.org/shiwano/sparkline.png?branch=master)](http://travis-ci.org/shiwano/sparkline)

## Release History
* 2017-06-23   v0.2.0   Add html option, and fix overflow bug.
* 2015-07-17   v0.1.2   Add min/max options

@@ -44,0 +45,0 @@ * 2013-06-01   v0.1.1   Support AMD and bower

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