Socket
Socket
Sign inDemoInstall

has-flag

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

has-flag

Check if argv has a specific flag


Version published
Weekly downloads
261M
decreased by-0.01%
Maintainers
2
Weekly downloads
 
Created

What is has-flag?

The has-flag npm package is a simple utility that checks if a specific flag is provided in the command line arguments (process.argv). It is commonly used to determine if a flag is set when running a Node.js script from the terminal.

What are has-flag's main functionalities?

Check for the presence of a command line flag

This feature allows you to check if a flag, such as '--unicorn', is passed to the script. The code sample demonstrates how to use has-flag to check for the 'unicorn' flag and log a message if it is present.

const hasFlag = require('has-flag');

if (hasFlag('unicorn')) {
    console.log('We have a unicorn!');
}

Other packages similar to has-flag

Keywords

FAQs

Package last updated on 11 Apr 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc