* feat: add bundle ids to keys completes FTD-1886 * typo * fix ui bug * Update sdks * Merge branch 'ta/keys-add-bundle-ids' of https://github.com/thirdweb-dev/dashboard into ta/keys-add-bundle-ids * Fix build * Update sdks * hide services * fix count * update nightly * update to [email protected] * fixes * dont hide rpc * copy - remove thirdwebs * missing form values * dont be smart about none * feat: validate api keys (#1406) completes FTD-1826 * Add descriptions --------- Co-authored-by: Nacho Iacovino <[email protected]> Co-authored-by: Jonas Daniels <[email protected]>
18 lines
420 B
TypeScript
18 lines
420 B
TypeScript
export const validStrList = (
|
|
strList: string,
|
|
validator: RegExp | ((str: string) => boolean),
|
|
) => {
|
|
if (strList === "*" || strList.length === 0) {
|
|
return true;
|
|
}
|
|
// comma or new-line separated
|
|
const values = strList.split(/,|\n/);
|
|
|
|
const invalid = values.find((str) =>
|
|
typeof validator === "function"
|
|
? !validator(str.trim())
|
|
: !validator.test(str.trim()),
|
|
);
|
|
return !invalid;
|
|
};
|