aboutsummaryrefslogtreecommitdiff
path: root/lib/utils.ts
diff options
context:
space:
mode:
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, '\\#');