summaryrefslogtreecommitdiff
path: root/u/process/validate_identifier.ts
diff options
context:
space:
mode:
authorElizabeth Hunt <me@liz.coffee>2025-07-27 18:50:33 -0700
committerElizabeth Hunt <me@liz.coffee>2025-07-27 19:31:06 -0700
commit7aa11b7a8abacf81dec20fff21216df35d333756 (patch)
tree40f6a76c37412cf1c5a67f99a4ee30e3aae863c9 /u/process/validate_identifier.ts
parente4df72cd446270cf867ec308995a05e21b3aa601 (diff)
downloadci-7aa11b7a8abacf81dec20fff21216df35d333756.tar.gz
ci-7aa11b7a8abacf81dec20fff21216df35d333756.zip
Pulls in pengueno from npm
Diffstat (limited to 'u/process/validate_identifier.ts')
-rw-r--r--u/process/validate_identifier.ts18
1 files changed, 0 insertions, 18 deletions
diff --git a/u/process/validate_identifier.ts b/u/process/validate_identifier.ts
deleted file mode 100644
index 1ff3791..0000000
--- a/u/process/validate_identifier.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { Either, type IEither } from '@emprespresso/pengueno';
-
-export const validateIdentifier = (token: string) => {
- return /^[a-zA-Z0-9_\-:. \/]+$/.test(token) && !token.includes('..');
-};
-
-// ensure {@param obj} is a Record<string, string> with stuff that won't
-// have the potential for shell injection, just to be super safe.
-type InvalidEntry<K, T> = [K, T];
-export const validateExecutionEntries = <T, K extends symbol | number | string = symbol | number | string>(
- obj: Record<K, T>,
-): IEither<Array<InvalidEntry<K, T>>, Record<string, string>> => {
- const invalidEntries = <Array<InvalidEntry<K, T>>>(
- Object.entries(obj).filter((e) => !e.every((x) => typeof x === 'string' && validateIdentifier(x)))
- );
- if (invalidEntries.length > 0) return Either.left(invalidEntries);
- return Either.right(<Record<string, string>>obj);
-};