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-06-22 23:08:55 +00:00
import { assert } from './assert';
2021-06-22 14:46:42 +00:00
import { isValidGuid } from './isValidGuid';
export function normalizeUuid(uuid: string, context: string): string {
2021-06-22 23:08:55 +00:00
assert(
isValidGuid(uuid),
`Normalizing invalid uuid: ${uuid} in context "${context}"`
);
2021-06-22 14:46:42 +00:00
return uuid.toLowerCase();
}