- progress on chalk deno

This commit is contained in:
nickolay 2021-04-22 13:43:49 +03:00
parent f8a3642a81
commit dcc200ab1b
8 changed files with 634 additions and 2 deletions

6
source/has-flag/index.js Normal file
View file

@ -0,0 +1,6 @@
export default function hasFlag(flag, argv = Deno.args) {
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
const position = argv.indexOf(prefix + flag);
const terminatorPosition = argv.indexOf('--');
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
}