parent
b2b8c62389
commit
c4cf6e8741
|
|
@ -140,6 +140,14 @@ export function findMissingProperties(
|
|||
return properties.filter((property) => !keys.includes(property));
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds an identifier parameter from the the provided parameter. If the
|
||||
* parameter is a number it is converted to a string and prefixed with `ID-`.
|
||||
* If the parameter matches the regex for a UUID, the identifier is prefixed
|
||||
* with `UUID-`. Otherwise the identifier is returned as it is.
|
||||
*
|
||||
* @param identifier The identifier to process.
|
||||
*/
|
||||
export function buildIdentifierParam(identifier: string | number): string {
|
||||
if (typeof identifier === "number") {
|
||||
return `ID-${identifier}`;
|
||||
|
|
@ -147,7 +155,7 @@ export function buildIdentifierParam(identifier: string | number): string {
|
|||
const strIdentifier: string = identifier as string;
|
||||
if (
|
||||
strIdentifier.match(
|
||||
/[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}/g
|
||||
/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}/g
|
||||
)
|
||||
) {
|
||||
return `UUID-${identifier}`;
|
||||
|
|
|
|||
Loading…
Reference in New Issue