Enforce tags to be lowercase
Signed-off-by: trivernis <trivernis@protonmail.com>pull/14/head
parent
1df5c9e8ed
commit
27a5432176
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Normalizes the tag by removing whitespaces and enforcing lowercase
|
||||
* @param {string} tag
|
||||
* @returns {string}
|
||||
* @private
|
||||
*/
|
||||
export function normalizeTag(tag: string): string {
|
||||
let normalizedTag = tag.trim().toLowerCase();
|
||||
let parts = normalizedTag.split(":");
|
||||
|
||||
if (parts.length > 1) {
|
||||
const namespace = parts.shift()!.trim();
|
||||
const name = parts.join(":").trim();
|
||||
return namespace + ":" + name;
|
||||
} else {
|
||||
return normalizedTag;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue