Socket
Socket
Sign inDemoInstall

@probe.gl/stats

Package Overview
Dependencies
Maintainers
6
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@probe.gl/stats - npm Package Compare versions

Comparing version 3.2.0-beta.2 to 3.2.0-beta.3

35

dist/es5/index.js

@@ -1,7 +0,32 @@

// STATS (PERFORMANCE PROFILING)
export { default as Stats } from './lib/stats';
export { default as Stat } from './lib/stat';
"use strict";
// UTILITIES
export { default as _getHiResTimestamp } from './utils/hi-res-timestamp';
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "Stats", {
enumerable: true,
get: function get() {
return _stats["default"];
}
});
Object.defineProperty(exports, "Stat", {
enumerable: true,
get: function get() {
return _stat["default"];
}
});
Object.defineProperty(exports, "_getHiResTimestamp", {
enumerable: true,
get: function get() {
return _hiResTimestamp["default"];
}
});
var _stats = _interopRequireDefault(require("./lib/stats"));
var _stat = _interopRequireDefault(require("./lib/stat"));
var _hiResTimestamp = _interopRequireDefault(require("./utils/hi-res-timestamp"));
//# sourceMappingURL=index.js.map

251

dist/es5/lib/stat.js

@@ -1,137 +0,160 @@

import getHiResTimestamp from '../utils/hi-res-timestamp';
"use strict";
export default class Stat {
constructor(name, type) {
this.name = name;
this.type = type;
this.sampleSize = 1;
this.reset();
}
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
setSampleSize(samples) {
this.sampleSize = samples;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
return this;
}
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
// Call to increment count (+1)
incrementCount() {
this.addCount(1);
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
return this;
}
var _hiResTimestamp = _interopRequireDefault(require("../utils/hi-res-timestamp"));
// Call to decrement count (-1)
decrementCount() {
this.subtractCount(1);
return this;
var Stat = function () {
function Stat(name, type) {
(0, _classCallCheck2["default"])(this, Stat);
this.name = name;
this.type = type;
this.sampleSize = 1;
this.reset();
}
// Increase count
addCount(value) {
this._count += value;
this._samples++;
this._checkSampling();
(0, _createClass2["default"])(Stat, [{
key: "setSampleSize",
value: function setSampleSize(samples) {
this.sampleSize = samples;
return this;
}
}, {
key: "incrementCount",
value: function incrementCount() {
this.addCount(1);
return this;
}
}, {
key: "decrementCount",
value: function decrementCount() {
this.subtractCount(1);
return this;
}
}, {
key: "addCount",
value: function addCount(value) {
this._count += value;
this._samples++;
return this;
}
this._checkSampling();
// Decrease count
subtractCount(value) {
this._count -= value;
this._samples++;
this._checkSampling();
return this;
}
}, {
key: "subtractCount",
value: function subtractCount(value) {
this._count -= value;
this._samples++;
return this;
}
this._checkSampling();
// Add an arbitrary timing and bump the count
addTime(time) {
this._time += time;
this.lastTiming = time;
this._samples++;
this._checkSampling();
return this;
}
}, {
key: "addTime",
value: function addTime(time) {
this._time += time;
this.lastTiming = time;
this._samples++;
return this;
}
this._checkSampling();
// Start a timer
timeStart() {
this._startTime = getHiResTimestamp();
this._timerPending = true;
return this;
}
// End a timer. Adds to time and bumps the timing count.
timeEnd() {
if (!this._timerPending) {
return this;
}
}, {
key: "timeStart",
value: function timeStart() {
this._startTime = (0, _hiResTimestamp["default"])();
this._timerPending = true;
return this;
}
}, {
key: "timeEnd",
value: function timeEnd() {
if (!this._timerPending) {
return this;
}
this.addTime(getHiResTimestamp() - this._startTime);
this._timerPending = false;
this._checkSampling();
this.addTime((0, _hiResTimestamp["default"])() - this._startTime);
this._timerPending = false;
return this;
}
this._checkSampling();
getSampleAverageCount() {
return this.sampleSize > 0 ? this.lastSampleCount / this.sampleSize : 0;
}
// Calculate average time / count for the previous window
getSampleAverageTime() {
return this.sampleSize > 0 ? this.lastSampleTime / this.sampleSize : 0;
}
// Calculate counts per second for the previous window
getSampleHz() {
return this.lastSampleTime > 0 ? this.sampleSize / (this.lastSampleTime / 1000) : 0;
}
getAverageCount() {
return this.samples > 0 ? this.count / this.samples : 0;
}
// Calculate average time / count
getAverageTime() {
return this.samples > 0 ? this.time / this.samples : 0;
}
// Calculate counts per second
getHz() {
return this.time > 0 ? this.samples / (this.time / 1000) : 0;
}
reset() {
this.time = 0;
this.count = 0;
this.samples = 0;
this.lastTiming = 0;
this.lastSampleTime = 0;
this.lastSampleCount = 0;
this._count = 0;
this._time = 0;
this._samples = 0;
this._startTime = 0;
this._timerPending = false;
return this;
}
_checkSampling() {
if (this._samples === this.sampleSize) {
this.lastSampleTime = this._time;
this.lastSampleCount = this._count;
this.count += this._count;
this.time += this._time;
this.samples += this._samples;
return this;
}
}, {
key: "getSampleAverageCount",
value: function getSampleAverageCount() {
return this.sampleSize > 0 ? this.lastSampleCount / this.sampleSize : 0;
}
}, {
key: "getSampleAverageTime",
value: function getSampleAverageTime() {
return this.sampleSize > 0 ? this.lastSampleTime / this.sampleSize : 0;
}
}, {
key: "getSampleHz",
value: function getSampleHz() {
return this.lastSampleTime > 0 ? this.sampleSize / (this.lastSampleTime / 1000) : 0;
}
}, {
key: "getAverageCount",
value: function getAverageCount() {
return this.samples > 0 ? this.count / this.samples : 0;
}
}, {
key: "getAverageTime",
value: function getAverageTime() {
return this.samples > 0 ? this.time / this.samples : 0;
}
}, {
key: "getHz",
value: function getHz() {
return this.time > 0 ? this.samples / (this.time / 1000) : 0;
}
}, {
key: "reset",
value: function reset() {
this.time = 0;
this.count = 0;
this.samples = 0;
this.lastTiming = 0;
this.lastSampleTime = 0;
this.lastSampleCount = 0;
this._count = 0;
this._time = 0;
this._count = 0;
this._samples = 0;
this._startTime = 0;
this._timerPending = false;
return this;
}
}
}
}, {
key: "_checkSampling",
value: function _checkSampling() {
if (this._samples === this.sampleSize) {
this.lastSampleTime = this._time;
this.lastSampleCount = this._count;
this.count += this._count;
this.time += this._time;
this.samples += this._samples;
this._time = 0;
this._count = 0;
this._samples = 0;
}
}
}]);
return Stat;
}();
exports["default"] = Stat;
//# sourceMappingURL=stat.js.map

@@ -1,5 +0,21 @@

import Stat from './stat';
"use strict";
export default class Stats {
constructor({ id, stats }) {
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _stat = _interopRequireDefault(require("./stat"));
var Stats = function () {
function Stats(_ref) {
var id = _ref.id,
stats = _ref.stats;
(0, _classCallCheck2["default"])(this, Stats);
this.id = id;

@@ -13,60 +29,81 @@ this.stats = {};

// Acquire a stat. Create if it doesn't exist.
get(name, type = 'count') {
return this._getOrCreate({ name, type });
}
(0, _createClass2["default"])(Stats, [{
key: "get",
value: function get(name) {
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'count';
return this._getOrCreate({
name: name,
type: type
});
}
}, {
key: "reset",
value: function reset() {
for (var key in this.stats) {
this.stats[key].reset();
}
get size() {
return Object.keys(this.stats).length;
}
// Reset all stats
reset() {
for (const key in this.stats) {
this.stats[key].reset();
return this;
}
}, {
key: "forEach",
value: function forEach(fn) {
for (var key in this.stats) {
fn(this.stats[key]);
}
}
}, {
key: "getTable",
value: function getTable() {
var table = {};
this.forEach(function (stat) {
table[stat.name] = {
time: stat.time || 0,
count: stat.count || 0,
average: stat.getAverageTime() || 0,
hz: stat.getHz() || 0
};
});
return table;
}
}, {
key: "_initializeStats",
value: function _initializeStats() {
var _this = this;
return this;
}
forEach(fn) {
for (const key in this.stats) {
fn(this.stats[key]);
var stats = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
stats.forEach(function (stat) {
return _this._getOrCreate(stat);
});
}
}
}, {
key: "_getOrCreate",
value: function _getOrCreate(stat) {
if (!stat || !stat.name) {
return null;
}
getTable() {
const table = {};
this.forEach(stat => {
table[stat.name] = {
time: stat.time || 0,
count: stat.count || 0,
average: stat.getAverageTime() || 0,
hz: stat.getHz() || 0
};
});
var name = stat.name,
type = stat.type;
return table;
}
if (!this.stats[name]) {
if (stat instanceof _stat["default"]) {
this.stats[name] = stat;
} else {
this.stats[name] = new _stat["default"](name, type);
}
}
_initializeStats(stats = []) {
stats.forEach(stat => this._getOrCreate(stat));
}
_getOrCreate(stat) {
if (!stat || !stat.name) {
return null;
return this.stats[name];
}
}, {
key: "size",
get: function get() {
return Object.keys(this.stats).length;
}
}]);
return Stats;
}();
const { name, type } = stat;
if (!this.stats[name]) {
if (stat instanceof Stat) {
this.stats[name] = stat;
} else {
this.stats[name] = new Stat(name, type);
}
}
return this.stats[name];
}
}
exports["default"] = Stats;
//# sourceMappingURL=stats.js.map

@@ -1,28 +0,15 @@

// Copyright (c) 2017 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
"use strict";
export default function getHiResTimestamp() {
let timestamp;
// Get best timer available.
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = getHiResTimestamp;
function getHiResTimestamp() {
var timestamp;
if (typeof window !== 'undefined' && window.performance) {
timestamp = window.performance.now();
} else if (typeof process !== 'undefined' && process.hrtime) {
const timeParts = process.hrtime();
var timeParts = process.hrtime();
timestamp = timeParts[0] * 1000 + timeParts[1] / 1e6;

@@ -29,0 +16,0 @@ } else {

@@ -1,7 +0,4 @@

// STATS (PERFORMANCE PROFILING)
export { default as Stats } from './lib/stats';
export { default as Stat } from './lib/stat';
// UTILITIES
export { default as _getHiResTimestamp } from './utils/hi-res-timestamp';
//# sourceMappingURL=index.js.map
import getHiResTimestamp from '../utils/hi-res-timestamp';
export default class Stat {

@@ -13,24 +12,19 @@ constructor(name, type) {

this.sampleSize = samples;
return this;
}
// Call to increment count (+1)
incrementCount() {
this.addCount(1);
return this;
}
// Call to decrement count (-1)
decrementCount() {
this.subtractCount(1);
return this;
}
// Increase count
addCount(value) {
this._count += value;
this._samples++;
this._checkSampling();

@@ -41,6 +35,6 @@

// Decrease count
subtractCount(value) {
this._count -= value;
this._samples++;
this._checkSampling();

@@ -51,3 +45,2 @@

// Add an arbitrary timing and bump the count
addTime(time) {

@@ -57,2 +50,3 @@ this._time += time;

this._samples++;
this._checkSampling();

@@ -63,11 +57,8 @@

// Start a timer
timeStart() {
this._startTime = getHiResTimestamp();
this._timerPending = true;
return this;
}
// End a timer. Adds to time and bumps the timing count.
timeEnd() {

@@ -80,2 +71,3 @@ if (!this._timerPending) {

this._timerPending = false;
this._checkSampling();

@@ -90,3 +82,2 @@

// Calculate average time / count for the previous window
getSampleAverageTime() {

@@ -96,3 +87,2 @@ return this.sampleSize > 0 ? this.lastSampleTime / this.sampleSize : 0;

// Calculate counts per second for the previous window
getSampleHz() {

@@ -106,3 +96,2 @@ return this.lastSampleTime > 0 ? this.sampleSize / (this.lastSampleTime / 1000) : 0;

// Calculate average time / count
getAverageTime() {

@@ -112,3 +101,2 @@ return this.samples > 0 ? this.time / this.samples : 0;

// Calculate counts per second
getHz() {

@@ -130,3 +118,2 @@ return this.time > 0 ? this.samples / (this.time / 1000) : 0;

this._timerPending = false;
return this;

@@ -147,3 +134,4 @@ }

}
}
//# sourceMappingURL=stat.js.map
import Stat from './stat';
export default class Stats {
constructor({ id, stats }) {
constructor({
id,
stats
}) {
this.id = id;

@@ -13,5 +15,7 @@ this.stats = {};

// Acquire a stat. Create if it doesn't exist.
get(name, type = 'count') {
return this._getOrCreate({ name, type });
return this._getOrCreate({
name,
type
});
}

@@ -23,3 +27,2 @@

// Reset all stats
reset() {

@@ -49,3 +52,2 @@ for (const key in this.stats) {

});
return table;

@@ -63,3 +65,7 @@ }

const { name, type } = stat;
const {
name,
type
} = stat;
if (!this.stats[name]) {

@@ -72,5 +78,7 @@ if (stat instanceof Stat) {

}
return this.stats[name];
}
}
//# sourceMappingURL=stats.js.map

@@ -1,24 +0,4 @@

// Copyright (c) 2017 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
export default function getHiResTimestamp() {
let timestamp;
// Get best timer available.
if (typeof window !== 'undefined' && window.performance) {

@@ -25,0 +5,0 @@ timestamp = window.performance.now();

@@ -1,7 +0,4 @@

// STATS (PERFORMANCE PROFILING)
export { default as Stats } from './lib/stats';
export { default as Stat } from './lib/stat';
// UTILITIES
export { default as _getHiResTimestamp } from './utils/hi-res-timestamp';
//# sourceMappingURL=index.js.map

@@ -0,5 +1,9 @@

import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import getHiResTimestamp from '../utils/hi-res-timestamp';
export default class Stat {
constructor(name, type) {
var Stat = function () {
function Stat(name, type) {
_classCallCheck(this, Stat);
this.name = name;

@@ -11,128 +15,138 @@ this.type = type;

setSampleSize(samples) {
this.sampleSize = samples;
_createClass(Stat, [{
key: "setSampleSize",
value: function setSampleSize(samples) {
this.sampleSize = samples;
return this;
}
}, {
key: "incrementCount",
value: function incrementCount() {
this.addCount(1);
return this;
}
}, {
key: "decrementCount",
value: function decrementCount() {
this.subtractCount(1);
return this;
}
}, {
key: "addCount",
value: function addCount(value) {
this._count += value;
this._samples++;
return this;
}
this._checkSampling();
// Call to increment count (+1)
incrementCount() {
this.addCount(1);
return this;
}
}, {
key: "subtractCount",
value: function subtractCount(value) {
this._count -= value;
this._samples++;
return this;
}
this._checkSampling();
// Call to decrement count (-1)
decrementCount() {
this.subtractCount(1);
return this;
}
}, {
key: "addTime",
value: function addTime(time) {
this._time += time;
this.lastTiming = time;
this._samples++;
return this;
}
this._checkSampling();
// Increase count
addCount(value) {
this._count += value;
this._samples++;
this._checkSampling();
return this;
}
}, {
key: "timeStart",
value: function timeStart() {
this._startTime = getHiResTimestamp();
this._timerPending = true;
return this;
}
}, {
key: "timeEnd",
value: function timeEnd() {
if (!this._timerPending) {
return this;
}
return this;
}
this.addTime(getHiResTimestamp() - this._startTime);
this._timerPending = false;
// Decrease count
subtractCount(value) {
this._count -= value;
this._samples++;
this._checkSampling();
this._checkSampling();
return this;
}
// Add an arbitrary timing and bump the count
addTime(time) {
this._time += time;
this.lastTiming = time;
this._samples++;
this._checkSampling();
return this;
}
// Start a timer
timeStart() {
this._startTime = getHiResTimestamp();
this._timerPending = true;
return this;
}
// End a timer. Adds to time and bumps the timing count.
timeEnd() {
if (!this._timerPending) {
return this;
}
this.addTime(getHiResTimestamp() - this._startTime);
this._timerPending = false;
this._checkSampling();
return this;
}
getSampleAverageCount() {
return this.sampleSize > 0 ? this.lastSampleCount / this.sampleSize : 0;
}
// Calculate average time / count for the previous window
getSampleAverageTime() {
return this.sampleSize > 0 ? this.lastSampleTime / this.sampleSize : 0;
}
// Calculate counts per second for the previous window
getSampleHz() {
return this.lastSampleTime > 0 ? this.sampleSize / (this.lastSampleTime / 1000) : 0;
}
getAverageCount() {
return this.samples > 0 ? this.count / this.samples : 0;
}
// Calculate average time / count
getAverageTime() {
return this.samples > 0 ? this.time / this.samples : 0;
}
// Calculate counts per second
getHz() {
return this.time > 0 ? this.samples / (this.time / 1000) : 0;
}
reset() {
this.time = 0;
this.count = 0;
this.samples = 0;
this.lastTiming = 0;
this.lastSampleTime = 0;
this.lastSampleCount = 0;
this._count = 0;
this._time = 0;
this._samples = 0;
this._startTime = 0;
this._timerPending = false;
return this;
}
_checkSampling() {
if (this._samples === this.sampleSize) {
this.lastSampleTime = this._time;
this.lastSampleCount = this._count;
this.count += this._count;
this.time += this._time;
this.samples += this._samples;
}, {
key: "getSampleAverageCount",
value: function getSampleAverageCount() {
return this.sampleSize > 0 ? this.lastSampleCount / this.sampleSize : 0;
}
}, {
key: "getSampleAverageTime",
value: function getSampleAverageTime() {
return this.sampleSize > 0 ? this.lastSampleTime / this.sampleSize : 0;
}
}, {
key: "getSampleHz",
value: function getSampleHz() {
return this.lastSampleTime > 0 ? this.sampleSize / (this.lastSampleTime / 1000) : 0;
}
}, {
key: "getAverageCount",
value: function getAverageCount() {
return this.samples > 0 ? this.count / this.samples : 0;
}
}, {
key: "getAverageTime",
value: function getAverageTime() {
return this.samples > 0 ? this.time / this.samples : 0;
}
}, {
key: "getHz",
value: function getHz() {
return this.time > 0 ? this.samples / (this.time / 1000) : 0;
}
}, {
key: "reset",
value: function reset() {
this.time = 0;
this.count = 0;
this.samples = 0;
this.lastTiming = 0;
this.lastSampleTime = 0;
this.lastSampleCount = 0;
this._count = 0;
this._time = 0;
this._count = 0;
this._samples = 0;
this._startTime = 0;
this._timerPending = false;
return this;
}
}
}
}, {
key: "_checkSampling",
value: function _checkSampling() {
if (this._samples === this.sampleSize) {
this.lastSampleTime = this._time;
this.lastSampleCount = this._count;
this.count += this._count;
this.time += this._time;
this.samples += this._samples;
this._time = 0;
this._count = 0;
this._samples = 0;
}
}
}]);
return Stat;
}();
export { Stat as default };
//# sourceMappingURL=stat.js.map

@@ -0,5 +1,12 @@

import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import Stat from './stat';
export default class Stats {
constructor({ id, stats }) {
var Stats = function () {
function Stats(_ref) {
var id = _ref.id,
stats = _ref.stats;
_classCallCheck(this, Stats);
this.id = id;

@@ -13,60 +20,82 @@ this.stats = {};

// Acquire a stat. Create if it doesn't exist.
get(name, type = 'count') {
return this._getOrCreate({ name, type });
}
_createClass(Stats, [{
key: "get",
value: function get(name) {
var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'count';
return this._getOrCreate({
name: name,
type: type
});
}
}, {
key: "reset",
value: function reset() {
for (var key in this.stats) {
this.stats[key].reset();
}
get size() {
return Object.keys(this.stats).length;
}
// Reset all stats
reset() {
for (const key in this.stats) {
this.stats[key].reset();
return this;
}
}, {
key: "forEach",
value: function forEach(fn) {
for (var key in this.stats) {
fn(this.stats[key]);
}
}
}, {
key: "getTable",
value: function getTable() {
var table = {};
this.forEach(function (stat) {
table[stat.name] = {
time: stat.time || 0,
count: stat.count || 0,
average: stat.getAverageTime() || 0,
hz: stat.getHz() || 0
};
});
return table;
}
}, {
key: "_initializeStats",
value: function _initializeStats() {
var _this = this;
return this;
}
forEach(fn) {
for (const key in this.stats) {
fn(this.stats[key]);
var stats = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
stats.forEach(function (stat) {
return _this._getOrCreate(stat);
});
}
}
}, {
key: "_getOrCreate",
value: function _getOrCreate(stat) {
if (!stat || !stat.name) {
return null;
}
getTable() {
const table = {};
this.forEach(stat => {
table[stat.name] = {
time: stat.time || 0,
count: stat.count || 0,
average: stat.getAverageTime() || 0,
hz: stat.getHz() || 0
};
});
var name = stat.name,
type = stat.type;
return table;
}
if (!this.stats[name]) {
if (stat instanceof Stat) {
this.stats[name] = stat;
} else {
this.stats[name] = new Stat(name, type);
}
}
_initializeStats(stats = []) {
stats.forEach(stat => this._getOrCreate(stat));
}
_getOrCreate(stat) {
if (!stat || !stat.name) {
return null;
return this.stats[name];
}
}, {
key: "size",
get: function get() {
return Object.keys(this.stats).length;
}
}]);
const { name, type } = stat;
if (!this.stats[name]) {
if (stat instanceof Stat) {
this.stats[name] = stat;
} else {
this.stats[name] = new Stat(name, type);
}
}
return this.stats[name];
}
}
return Stats;
}();
export { Stats as default };
//# sourceMappingURL=stats.js.map

@@ -1,28 +0,8 @@

// Copyright (c) 2017 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
export default function getHiResTimestamp() {
var timestamp;
export default function getHiResTimestamp() {
let timestamp;
// Get best timer available.
if (typeof window !== 'undefined' && window.performance) {
timestamp = window.performance.now();
} else if (typeof process !== 'undefined' && process.hrtime) {
const timeParts = process.hrtime();
var timeParts = process.hrtime();
timestamp = timeParts[0] * 1000 + timeParts[1] / 1e6;

@@ -29,0 +9,0 @@ } else {

@@ -5,3 +5,3 @@ {

"license": "MIT",
"version": "3.2.0-beta.2",
"version": "3.2.0-beta.3",
"keywords": [

@@ -29,3 +29,3 @@ "javascript",

},
"gitHead": "c54a8a93f049c88a56e2e6a72e400d47b869aef0"
"gitHead": "732c0c737bb8a1f0c0b73329f964db441c0451f9"
}

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

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

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