Comparing version 3.1.0-alpha.8 to 3.1.0-alpha.9
@@ -17,5 +17,6 @@ "use strict"; | ||
var Stat = function () { | ||
function Stat(name, samples) { | ||
function Stat(name, type) { | ||
(0, _classCallCheck2["default"])(this, Stat); | ||
this.name = name; | ||
this.type = type; | ||
this.sampleSize = 1; | ||
@@ -22,0 +23,0 @@ this.reset(); |
@@ -28,6 +28,12 @@ "use strict"; | ||
value: function get(name) { | ||
this.stats[name] = this.stats[name] || new _stat["default"](name); | ||
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'count'; | ||
this.stats[name] = this.stats[name] || new _stat["default"](name, type); | ||
return this.stats[name]; | ||
} | ||
}, { | ||
key: "size", | ||
value: function size() { | ||
return Object.keys(this.stats).length; | ||
} | ||
}, { | ||
key: "reset", | ||
@@ -34,0 +40,0 @@ value: function reset() { |
import getHiResTimestamp from '../utils/hi-res-timestamp'; | ||
export default class Stat { | ||
constructor(name, samples) { | ||
constructor(name, type) { | ||
this.name = name; | ||
this.type = type; | ||
this.sampleSize = 1; | ||
@@ -6,0 +7,0 @@ this.reset(); |
@@ -11,6 +11,11 @@ import Stat from './stat'; | ||
get(name) { | ||
this.stats[name] = this.stats[name] || new Stat(name); | ||
let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'count'; | ||
this.stats[name] = this.stats[name] || new Stat(name, type); | ||
return this.stats[name]; | ||
} | ||
size() { | ||
return Object.keys(this.stats).length; | ||
} | ||
reset() { | ||
@@ -17,0 +22,0 @@ for (const key in this.stats) { |
@@ -6,6 +6,7 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; | ||
var Stat = function () { | ||
function Stat(name, samples) { | ||
function Stat(name, type) { | ||
_classCallCheck(this, Stat); | ||
this.name = name; | ||
this.type = type; | ||
this.sampleSize = 1; | ||
@@ -12,0 +13,0 @@ this.reset(); |
@@ -19,6 +19,12 @@ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; | ||
value: function get(name) { | ||
this.stats[name] = this.stats[name] || new Stat(name); | ||
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'count'; | ||
this.stats[name] = this.stats[name] || new Stat(name, type); | ||
return this.stats[name]; | ||
} | ||
}, { | ||
key: "size", | ||
value: function size() { | ||
return Object.keys(this.stats).length; | ||
} | ||
}, { | ||
key: "reset", | ||
@@ -25,0 +31,0 @@ value: function reset() { |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "3.1.0-alpha.8", | ||
"version": "3.1.0-alpha.9", | ||
"keywords": [ | ||
@@ -36,3 +36,3 @@ "javascript", | ||
}, | ||
"gitHead": "b9b1d242d5a9722157df9f3f4232bcc6d0da2709" | ||
"gitHead": "fc5d2446ed49307e9caa4f4e774c18d1229f901d" | ||
} |
import getHiResTimestamp from '../utils/hi-res-timestamp'; | ||
export default class Stat { | ||
constructor(name, samples) { | ||
constructor(name, type) { | ||
this.name = name; | ||
this.type = type; | ||
this.sampleSize = 1; | ||
@@ -7,0 +8,0 @@ this.reset(); |
@@ -11,7 +11,11 @@ import Stat from './stat'; | ||
// Acquire a stat. Create if it doesn't exist. | ||
get(name) { | ||
this.stats[name] = this.stats[name] || new Stat(name); | ||
get(name, type = 'count') { | ||
this.stats[name] = this.stats[name] || new Stat(name, type); | ||
return this.stats[name]; | ||
} | ||
size() { | ||
return Object.keys(this.stats).length; | ||
} | ||
// Reset all stats | ||
@@ -18,0 +22,0 @@ reset() { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
4267
0
329532
122