File: index.js

package info (click to toggle)
node-has-flag 2.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 100 kB
  • ctags: 1
  • sloc: makefile: 2; sh: 2
file content (10 lines) | stat: -rw-r--r-- 294 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
'use strict';
module.exports = function (flag, argv) {
	argv = argv || process.argv;

	var terminatorPos = argv.indexOf('--');
	var prefix = /^-{1,2}/.test(flag) ? '' : '--';
	var pos = argv.indexOf(prefix + flag);

	return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
};