aboutsummaryrefslogtreecommitdiff
path: root/lib/utils.ts
diff options
context:
space:
mode:
authorRubén Rincón Blanco <ruben@rinconblanco.es>2022-09-17 09:54:43 +0200
committerGitHub <noreply@github.com>2022-09-17 09:54:43 +0200
commitace16d8aa5996677e82de89172bac53bb6e556f2 (patch)
treed50306bdadaa24b6fdf1594d2e6bb4eb0c26225b /lib/utils.ts
parent817152f2f43de41c3eb0aad9d5108dc33fbb3bd2 (diff)
parentcf2da5f9b3b0745880c1896415e42f81c2bfca30 (diff)
downloadcompiler-explorer-gh-4251.tar.gz
compiler-explorer-gh-4251.zip
Merge branch 'main' into addbasecompilertypesgh-4251
Diffstat (limited to 'lib/utils.ts')
-rw-r--r--lib/utils.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/utils.ts b/lib/utils.ts
index c8aba0235..7fe456d10 100644
--- a/lib/utils.ts
+++ b/lib/utils.ts
@@ -368,6 +368,15 @@ export function base32Encode(buffer: Buffer): string {
return output;
}
+// Splits a : separated list into its own array, or to default if input is undefined
+export function splitIntoArray(input?: string, defaultArray: string[] = []): string[] {
+ if (input !== undefined) {
+ return input.split(':');
+ } else {
+ return defaultArray;
+ }
+}
+
export function splitArguments(options = ''): string[] {
// escape hashes first, otherwise they're interpreted as comments
const escapedOptions = options.replaceAll(/#/g, '\\#');