New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bo 1575 : Add hook triggered when there is a change in packages #62
Conversation
remiriv
commented
Aug 9, 2017
•
edited
edited
@@ -3,53 +3,56 @@ const Validator = require('../../utils/Validator'); | |||
const ObjectReader = require('../../utils/ObjectReader'); | |||
|
|||
function getHookType(program) { | |||
if (program.web) { | |||
if (program.hookType === 'web') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extract logic and remove if/elseif
return 'bigquery'; | ||
} | ||
} | ||
|
||
function getEventType(program) { | ||
if (program.ping) { | ||
if (program.event === 'ping') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extract logic and remove if/elseif
!program.web && program.googleAnalytics && !program.bigquery && program.gaTrackingId && program.gaTrackingId !== true || | ||
!program.web && !program.googleAnalytics && program.bigquery && program.googleClientSecret && Validator.fileExists(program.googleClientSecret)); | ||
|
||
var handlers = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const, and extract it to be global and private
bigQuery: (program) => program.googleClientSecret && program.googleClientSecret !== true && Validator.fileExists(program.googleClientSecret) | ||
} | ||
|
||
return (['web', 'googleAnalytics', 'bigQuery'].indexOf(program.hookType) > -1) && handlers[program.hookType](program) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use handlers to do the validation instead of an hardcoded array