MCPcopy
hub / github.com/jef/streetmerchant / envOrArray

Function envOrArray

src/config.ts:37–48  ·  view source on GitHub ↗

* Returns environment variable, given array, or default array. * * @param environment Interested environment variable. * @param array Default array. If not set, is `[]`.

(
  environment: string | undefined,
  array?: string[]
)

Source from the content-addressed store, hash-verified

35 * @param array Default array. If not set, is `[]`.
36 */
37function envOrArray(
38 environment: string | undefined,
39 array?: string[]
40): string[] {
41 return (
42 environment
43 ? environment.includes('\n')
44 ? environment.split('\n')
45 : environment.split(',')
46 : array ?? []
47 ).map(s => s.trim());
48}
49
50/**
51 * Returns environment variable, given boolean, or default boolean.

Callers 1

config.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected