@@ -43,19 +43,6 @@ const { performance } = require('perf_hooks');
4343
4444const newMetricChannel = channel ( 'metrics:new' ) ;
4545
46- /**
47- * Mix two metadata objects together.
48- * @param {object } a The first metadata object.
49- * @param {object } b The second metadata object.
50- * @returns {object } The mixed metadata.
51- * @private
52- */
53- function mixMeta ( a , b ) {
54- if ( a === undefined ) return b ;
55- if ( b === undefined ) return a ;
56- return ObjectAssign ( { } , a , b ) ;
57- }
58-
5946/**
6047 * Represents a single reported metric.
6148 */
@@ -221,7 +208,7 @@ class Metric {
221208 // Skip report construction if there are no subscribers.
222209 if ( ! this . shouldReport ) return ;
223210 const report = new MetricReport ( this . type , this . name , value ,
224- mixMeta ( this . meta , meta ) ) ;
211+ ObjectAssign ( { } , this . meta , meta ) ) ;
225212 this . #channel. publish ( report ) ;
226213 }
227214}
@@ -352,7 +339,7 @@ class Timer extends Gauge {
352339 * @property {object } meta
353340 */
354341 get meta ( ) {
355- return mixMeta ( this . metric . meta , this . #meta) ;
342+ return ObjectAssign ( { } , this . metric . meta , this . #meta) ;
356343 }
357344
358345 /**
@@ -365,7 +352,7 @@ class Timer extends Gauge {
365352 if ( ! this . metric . shouldReport ) return ;
366353 this . end = performance . now ( ) ;
367354 this . duration = this . end - this . start ;
368- this . reset ( this . duration , mixMeta ( this . #meta, meta ) ) ;
355+ this . reset ( this . duration , ObjectAssign ( { } , this . #meta, meta ) ) ;
369356 return this . duration ;
370357 }
371358
0 commit comments