11 lines
356 B
TypeScript
11 lines
356 B
TypeScript
export function formatAllowFromLowercase(params: {
|
|
allowFrom: Array<string | number>;
|
|
stripPrefixRe?: RegExp;
|
|
}): string[] {
|
|
return params.allowFrom
|
|
.map((entry) => String(entry).trim())
|
|
.filter(Boolean)
|
|
.map((entry) => (params.stripPrefixRe ? entry.replace(params.stripPrefixRe, "") : entry))
|
|
.map((entry) => entry.toLowerCase());
|
|
}
|