Home / Function/ isCommandAvailable() — react Function Reference

isCommandAvailable() — react Function Reference

Architecture documentation for the isCommandAvailable() function in utils.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  6c578c84_053a_2680_b611_5008f3c88874["isCommandAvailable()"]
  525ad0bb_41e8_f420_212b_50ca17253a46["utils.js"]
  6c578c84_053a_2680_b611_5008f3c88874 -->|defined in| 525ad0bb_41e8_f420_212b_50ca17253a46
  style 6c578c84_053a_2680_b611_5008f3c88874 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

scripts/tasks/generate-changelog/utils.js lines 11–35

function isCommandAvailable(command) {
  const paths = (process.env.PATH || '').split(path.delimiter);
  const extensions =
    process.platform === 'win32' && process.env.PATHEXT
      ? process.env.PATHEXT.split(';')
      : [''];

  for (let i = 0; i < paths.length; i++) {
    const dir = paths[i];
    if (!dir) {
      continue;
    }
    for (let j = 0; j < extensions.length; j++) {
      const ext = extensions[j];
      const fullPath = path.join(dir, `${command}${ext}`);
      try {
        fs.accessSync(fullPath, fs.constants.X_OK);
        return true;
      } catch {
        // Keep searching.
      }
    }
  }
  return false;
}

Domain

Subdomains

Frequently Asked Questions

What does isCommandAvailable() do?
isCommandAvailable() is a function in the react codebase, defined in scripts/tasks/generate-changelog/utils.js.
Where is isCommandAvailable() defined?
isCommandAvailable() is defined in scripts/tasks/generate-changelog/utils.js at line 11.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free