Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "get-ci-env", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Get and normalize continuous integration service environment variables.", | ||
@@ -5,0 +5,0 @@ "main": "src/main.js", |
@@ -19,11 +19,2 @@ # get-ci-env | ||
getCiEnv().then(console.log); | ||
/* | ||
{ | ||
service: 'circleCi', | ||
branch: 'master', | ||
commit: 'abc', | ||
repo: { owner: 'Selwyn', name: 'hedgehogs' }, | ||
pr: { number: '3' }, | ||
} | ||
*/ | ||
``` | ||
@@ -37,2 +28,3 @@ Resulting in the output: | ||
repo: { owner: 'Selwyn', name: 'hedgehogs' }, | ||
pr: { number: '3' }, | ||
} | ||
@@ -39,0 +31,0 @@ ``` |
@@ -31,9 +31,10 @@ 'use strict'; | ||
function getCiService(env) { | ||
return Object.entries({ | ||
const service = Object.entries({ | ||
travis: env.TRAVIS, | ||
circleCi: env.CIRCLECI, | ||
}).reduce((matches, [service, match]) => { | ||
if (match) return Promise.resolve(service); | ||
return Promise.reject('No matching CI service environment.'); | ||
}); | ||
}).find(([service, match]) => match); | ||
return service | ||
? Promise.resolve(service[0]) | ||
: Promise.reject('No matching CI service environment.'); | ||
} | ||
@@ -68,4 +69,4 @@ | ||
return [env.CIRCLE_PULL_REQUEST, env.TRAVIS_PULL_REQUEST].some( | ||
ciVariable => ciVariable && ciVariable !== 'false', | ||
ciVariable => ciVariable && ciVariable !== 'false' | ||
); | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36431
57