speedometer
Advanced tools
Comparing version 0.1.4 to 1.0.0
16
index.js
var tick = 1 | ||
var maxTick = 65535 | ||
var resolution = 4 | ||
var inc = function() { | ||
var inc = function () { | ||
tick = (tick + 1) & maxTick | ||
@@ -11,9 +11,9 @@ } | ||
module.exports = function(seconds) { | ||
module.exports = function (seconds) { | ||
var size = resolution * (seconds || 5) | ||
var buffer = [0] | ||
var pointer = 1 | ||
var last = (tick-1) & maxTick | ||
var last = (tick - 1) & maxTick | ||
return function(delta) { | ||
return function (delta) { | ||
var dist = (tick - last) & maxTick | ||
@@ -25,9 +25,9 @@ if (dist > size) dist = size | ||
if (pointer === size) pointer = 0 | ||
buffer[pointer] = buffer[pointer === 0 ? size-1 : pointer-1] | ||
buffer[pointer] = buffer[pointer === 0 ? size - 1 : pointer - 1] | ||
pointer++ | ||
} | ||
if (delta) buffer[pointer-1] += delta | ||
if (delta) buffer[pointer - 1] += delta | ||
var top = buffer[pointer-1] | ||
var top = buffer[pointer - 1] | ||
var btm = buffer.length < size ? 0 : buffer[pointer === size ? 0 : pointer] | ||
@@ -37,2 +37,2 @@ | ||
} | ||
} | ||
} |
{ | ||
"name": "speedometer", | ||
"version": "0.1.4", | ||
"version": "1.0.0", | ||
"repository": "git://github.com/mafintosh/speedometer", | ||
"description": "simple speed measurement in javascript", | ||
"license": "MIT", | ||
"keywords": [ | ||
@@ -7,0 +8,0 @@ "speed", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
2999
28
1