Use `.some` to short circuit & native `.includes` (#2697)

`Array.prototype.some` short-circuits when a value is true which is better for performance and makes the intention more clear. Native `String.prototype.includes` is easier to read.

Now reading it as English, "if some argument includes 'verbose'"...
This commit is contained in:
toastal 2019-01-03 23:24:09 +07:00 committed by Tal Amuyal
parent ea0aed3213
commit f4014abea8
1 changed files with 1 additions and 1 deletions

View File

@ -9,7 +9,7 @@ const logs = []
let _isVerbose = false
const isVerbose = () =>
process.argv.filter(arg => arg.indexOf("--verbose") >= 0).length > 0 || _isVerbose
process.argv.some(arg => arg.includes("--verbose")) || _isVerbose
export const setVerbose = (verbose: boolean) => {
_isVerbose = verbose