Signal-Desktop/ts/util/normalizeUuid.ts

15 lines
369 B
TypeScript
Raw Normal View History

2021-06-22 14:46:42 +00:00
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
2021-10-26 22:59:08 +00:00
import { isValidUuid } from '../types/UUID';
2021-06-22 23:08:55 +00:00
import { assert } from './assert';
2021-06-22 14:46:42 +00:00
export function normalizeUuid(uuid: string, context: string): string {
2021-06-22 23:08:55 +00:00
assert(
2021-10-26 22:59:08 +00:00
isValidUuid(uuid),
2021-06-22 23:08:55 +00:00
`Normalizing invalid uuid: ${uuid} in context "${context}"`
);
2021-06-22 14:46:42 +00:00
return uuid.toLowerCase();
}