MCPcopy
hub / github.com/buildbot/buildbot / copyOrSplit

Function copyOrSplit

www/data-module/src/data/DataUtils.ts:12–22  ·  view source on GitHub ↗
(arrayOrString: any)

Source from the content-addressed store, hash-verified

10}
11
12export function copyOrSplit(arrayOrString: any) : string[] {
13 if (Array.isArray(arrayOrString)) {
14 // return a copy
15 return arrayOrString.slice();
16 } else if (typeof arrayOrString === 'string') {
17 // split the string to get an array
18 return arrayOrString.split('/');
19 } else {
20 throw new TypeError(`Parameter 'arrayOrString' must be a array or a string, not ${typeof arrayOrString}`);
21 }
22}
23
24export function socketPath(arg: string | string[]) {
25 const a = copyOrSplit(arg);

Callers 4

DataUtils.test.tsFile · 0.90
socketPathFunction · 0.85
restPathFunction · 0.85
endpointPathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected