Skip to content

Commit

Permalink
Fix Node.js 12 compatibility
Browse files Browse the repository at this point in the history
Fixes #146
  • Loading branch information
sindresorhus committed Dec 15, 2022
1 parent 925035b commit 74a0d5a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import os from 'node:os';
import tty from 'node:tty';

// From: https://github.com/sindresorhus/has-flag/blob/main/index.js
function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {
/// function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) {
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
const position = argv.indexOf(prefix + flag);
const terminatorPosition = argv.indexOf('--');
Expand Down

0 comments on commit 74a0d5a

Please sign in to comment.