Decaf cleanup: remove __guard__

This commit is contained in:
Eric Mc Sween
2020-05-11 10:47:27 -04:00
parent 814ac40e07
commit 80ea49c69c

View File

@@ -6,7 +6,6 @@
// Fix any style issues and re-enable lint.
/*
* decaffeinate suggestions:
* DS103: Rewrite code to no longer use __guard__
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
@@ -81,9 +80,7 @@ module.exports = HttpController = {
const projectStateHash = req.query != null ? req.query.state : undefined
// exclude is string of existing docs "id:version,id:version,..."
const excludeItems =
__guard__(req.query != null ? req.query.exclude : undefined, (x) =>
x.split(',')
) || []
req.query.exclude != null ? req.query.exclude.split(',') : []
logger.log({ project_id, exclude: excludeItems }, 'getting docs via http')
const timer = new Metrics.Timer('http.getAllDocs')
const excludeVersions = {}
@@ -462,9 +459,3 @@ module.exports = HttpController = {
})
}
}
function __guard__(value, transform) {
return typeof value !== 'undefined' && value !== null
? transform(value)
: undefined
}