Comparing version 1.0.0 to 1.0.1
# Changes | ||
## 1.0.1 | ||
- Fix `counter.inc(0)` and `counter.dec(0)` (Maximilian Antoni) | ||
## 1.0.0 | ||
@@ -4,0 +8,0 @@ |
@@ -14,7 +14,7 @@ 'use strict'; | ||
Counter.prototype.inc = function (n) { | ||
this._count += (n || 1); | ||
this._count += (arguments.length ? n : 1); | ||
}; | ||
Counter.prototype.dec = function (n) { | ||
this._count -= (n || 1); | ||
this._count -= (arguments.length ? n : 1); | ||
}; | ||
@@ -21,0 +21,0 @@ |
@@ -83,3 +83,3 @@ 'use strict'; | ||
p99 : percentiles[0.99], | ||
p999 : percentiles[0.999], | ||
p999 : percentiles[0.999] | ||
}; | ||
@@ -86,0 +86,0 @@ }; |
@@ -103,3 +103,3 @@ 'use strict'; | ||
'5MinuteRate' : this._m5Rate.rate(this._rateUnit), | ||
'15MinuteRate' : this._m15Rate.rate(this._rateUnit), | ||
'15MinuteRate' : this._m15Rate.rate(this._rateUnit) | ||
}; | ||
@@ -106,0 +106,0 @@ }; |
@@ -50,20 +50,8 @@ 'use strict'; | ||
Timer.prototype.toJSON = function () { | ||
var self = this; | ||
var result = {}; | ||
['meter', 'histogram'].forEach(function (metric) { | ||
var json = self['_' + metric].toJSON(); | ||
result[metric] = {}; | ||
var key; | ||
for (key in json) { | ||
if (json.hasOwnProperty(key)) { | ||
result[metric][key] = json[key]; | ||
} | ||
} | ||
}); | ||
return result; | ||
return { | ||
meter : this._meter.toJSON(), | ||
histogram : this._histogram.toJSON() | ||
}; | ||
}; | ||
module.exports = Timer; |
@@ -41,3 +41,3 @@ 'use strict'; | ||
elements: this.toArray(), | ||
score: this._score, | ||
score: this._score | ||
}); | ||
@@ -148,3 +148,3 @@ }; | ||
2 * index + 1, | ||
2 * index + 2, | ||
2 * index + 2 | ||
]; | ||
@@ -151,0 +151,0 @@ }; |
@@ -5,3 +5,3 @@ { | ||
"description": "This is an alternative port of Coda Hale's metrics library.", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"homepage": "https://github.com/felixge/node-measured", | ||
@@ -13,6 +13,9 @@ "engines": { | ||
"scripts": { | ||
"lint": "jslint --color './**/*.js'", | ||
"test-node": "mocha './test/**/test-*.js'", | ||
"test-browser": "mochify './test/**/test-*.js'", | ||
"test": "npm run lint && npm run test-node && npm run test-browser" | ||
"lint": "jslint --edition=latest --color './**/*.js'", | ||
"watch": "npm run test:node -- --watch", | ||
"test:node": "mocha './test/**/test-*.js'", | ||
"test:browser": "mochify './test/**/test-*.js'", | ||
"wd": "mochify --wd './test/**/test-*.js'", | ||
"pretest": "npm run lint", | ||
"test": "npm run test:node && npm run test:browser" | ||
}, | ||
@@ -23,3 +26,3 @@ "dependencies": { | ||
"devDependencies": { | ||
"jslint": "^0.7", | ||
"jslint": "^0.8", | ||
"mocha": "^2.1", | ||
@@ -26,0 +29,0 @@ "mochify": "^2.1", |
@@ -40,2 +40,7 @@ /*global describe, it, beforeEach, afterEach*/ | ||
it('#inc adds zero', function () { | ||
counter.inc(0); | ||
assert.equal(counter.toJSON(), 0); | ||
}); | ||
it('#dec works incrementally', function () { | ||
@@ -57,2 +62,7 @@ counter.dec(3); | ||
it('#dec substracts zero', function () { | ||
counter.dec(0); | ||
assert.equal(counter.toJSON(), 0); | ||
}); | ||
it('#reset works', function () { | ||
@@ -59,0 +69,0 @@ counter.inc(23); |
@@ -30,3 +30,3 @@ /*global describe, it, beforeEach, afterEach*/ | ||
'5MinuteRate' : 0, | ||
'15MinuteRate' : 0, | ||
'15MinuteRate' : 0 | ||
}); | ||
@@ -33,0 +33,0 @@ }); |
@@ -24,3 +24,3 @@ /*global describe, it, beforeEach, afterEach*/ | ||
'a': 3, | ||
'b': 5, | ||
'b': 5 | ||
} | ||
@@ -27,0 +27,0 @@ }); |
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
50082
37
1
1373