Version: 0.1.00.2.00.2.10.2.20.2.30.2.41.0.01.0.11.1.01.1.11.1.22.0.0-beta.02.0.0-beta.12.0.0-beta.22.0.02.0.12.1.02.1.12.1.22.1.32.1.43.0.0-beta.03.0.0-beta.13.0.0-beta.23.0.0-rc.03.0.03.0.13.0.23.0.33.0.43.1.03.1.1-soft-navs3.1.1-soft-navs-13.1.1-soft-navs-23.1.1-soft-navs-33.1.1-soft-navs-43.1.1-soft-navs-53.1.13.3.0-soft-navs-63.3.03.3.1-soft-navs-73.3.1-types3.3.1-types-23.3.13.3.2-soft-navs-83.3.23.4.0-soft-navs-93.4.03.5.0-soft-navs-103.5.0-soft-navs-113.5.0-soft-navs-123.5.0-soft-navs-133.5.0-soft-navs-143.5.03.5.1-soft-navs-153.5.13.5.2-soft-navs-163.5.2
/*
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* https://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {Metric} from '../types.js';
import {generateUniqueID} from './generateUniqueID.js';
export const initMetric = (name: Metric['name'], value?: number): Metric => {
return {
name,
value: typeof value === 'undefined' ? -1 : value,
delta: 0,
entries: [],
id: generateUniqueID()
};