diff options
author | Rubén Rincón Blanco <ruben@rinconblanco.es> | 2022-09-17 09:54:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-17 09:54:43 +0200 |
commit | ace16d8aa5996677e82de89172bac53bb6e556f2 (patch) | |
tree | d50306bdadaa24b6fdf1594d2e6bb4eb0c26225b /lib/utils.ts | |
parent | 817152f2f43de41c3eb0aad9d5108dc33fbb3bd2 (diff) | |
parent | cf2da5f9b3b0745880c1896415e42f81c2bfca30 (diff) | |
download | compiler-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.ts | 9 |
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, '\\#'); |