(lines: string, options?: {
readonly expandVariables?: boolean | undefined
readonly preserveEmptyStrings?: boolean | undefined
})
| 1080 | * @since 4.0.0 |
| 1081 | */ |
| 1082 | export function fromDotEnvContents(lines: string, options?: { |
| 1083 | readonly expandVariables?: boolean | undefined |
| 1084 | readonly preserveEmptyStrings?: boolean | undefined |
| 1085 | }): ConfigProvider { |
| 1086 | let env = parseDotEnvContents(lines) |
| 1087 | if (options?.expandVariables) { |
| 1088 | env = dotEnvExpand(env) |
| 1089 | } |
| 1090 | return fromEnvRecord(env, { preserveEmptyStrings: options?.preserveEmptyStrings }) |
| 1091 | } |
| 1092 | |
| 1093 | const DOT_ENV_LINE = |
| 1094 | /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg |
no test coverage detected