Use assert in normalizeUuid

This commit is contained in:
Fedor Indutny 2021-06-22 16:08:55 -07:00 committed by GitHub
parent 9db19283ac
commit c9b1ce6655
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View file

@ -1,14 +1,14 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { assert } from './assert';
import { isValidGuid } from './isValidGuid';
export function normalizeUuid(uuid: string, context: string): string {
if (!isValidGuid(uuid)) {
window.log.warn(
`Normalizing invalid uuid: ${uuid} in context "${context}"`
);
}
assert(
isValidGuid(uuid),
`Normalizing invalid uuid: ${uuid} in context "${context}"`
);
return uuid.toLowerCase();
}