is-clideprecated

Detect if the current script was ran as a CLI

Usage no npm install needed!

<script type="module">
  import isCli from 'https://cdn.skypack.dev/is-cli';
</script>

README

is-cli

Returns true if the current module was ran directly by node and not imported by another module. This is useful for CLI-style modules that also export values.

Usage

npm i is-cli
const isCLI = require("is-cli")(module);
// => true

Will throw when module is absent.

© silverwind, distributed under BSD licence