MCPcopy Index your code
hub / github.com/nodejs/node / createHistogram

Function createHistogram

lib/internal/histogram.js:367–384  ·  view source on GitHub ↗

* @param {{ * lowest? : number, * highest? : number, * figures? : number * }} [options] * @returns {RecordableHistogram}

(options = kEmptyObject)

Source from the content-addressed store, hash-verified

365 * @returns {RecordableHistogram}
366 */
367function createHistogram(options = kEmptyObject) {
368 validateObject(options, 'options');
369 const {
370 lowest = 1,
371 highest = NumberMAX_SAFE_INTEGER,
372 figures = 3,
373 } = options;
374 if (typeof lowest !== 'bigint')
375 validateInteger(lowest, 'options.lowest', 1, NumberMAX_SAFE_INTEGER);
376 if (typeof highest !== 'bigint') {
377 validateInteger(highest, 'options.highest',
378 2 * lowest, NumberMAX_SAFE_INTEGER);
379 } else if (highest < 2n * lowest) {
380 throw new ERR_INVALID_ARG_VALUE.RangeError('options.highest', highest);
381 }
382 validateInteger(figures, 'options.figures', 1, 5);
383 return createRecordableHistogram(new _Histogram(lowest, highest, figures));
384}
385
386module.exports = {
387 Histogram,

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…