diff --git a/src/index.ts b/src/index.ts index 7fdece3..bb859ef 100644 --- a/src/index.ts +++ b/src/index.ts @@ -60,6 +60,8 @@ export type TypedDockerComposeResult = { data: T } +const nonEmptyString = (v: string) => v !== '' + /** * Converts supplied yml files to cli arguments * https://docs.docker.com/compose/reference/overview/#use--f-to-specify-name-and-path-of-one-or-more-compose-files @@ -329,7 +331,7 @@ export const configServices = async function ( ): Promise> { try { const result = await execCompose('config', ['--services'], options) - const services = result.out.split('\n') + const services = result.out.split('\n').filter(nonEmptyString) return { ...result, data: { services } @@ -344,8 +346,7 @@ export const configVolumes = async function ( ): Promise> { try { const result = await execCompose('config', ['--volumes'], options) - const nonEmpty = (v: string) => v !== '' - const volumes = result.out.split('\n').filter(nonEmpty) + const volumes = result.out.split('\n').filter(nonEmptyString) return { ...result, data: { volumes } diff --git a/test/index.test.ts b/test/index.test.ts index 48fcf25..8c45276 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -528,7 +528,7 @@ test('config show data for docker-compose files (services)', async (): Promise