Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Commit

Permalink
Use .some to short circuit & native .includes (#2697)
Browse files Browse the repository at this point in the history
`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'"...
  • Loading branch information
toastal authored and TalAmuyal committed Jan 3, 2019
1 parent ea0aed3 commit f4014ab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main/src/Log.ts
Expand Up @@ -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
Expand Down

0 comments on commit f4014ab

Please sign in to comment.