Home / Function/ getPluginName() — fastify Function Reference

getPluginName() — fastify Function Reference

Architecture documentation for the getPluginName() function in plugin-utils.js from the fastify codebase.

Entity Profile

Dependency Diagram

graph TD
  b6c9e48d_2318_fe80_9d3e_2abc24db856b["getPluginName()"]
  7351467e_fa74_55c1_e257_0dfcb434a1e3["plugin-utils.js"]
  b6c9e48d_2318_fe80_9d3e_2abc24db856b -->|defined in| 7351467e_fa74_55c1_e257_0dfcb434a1e3
  87162588_2ed8_24bc_b480_9bd5ba1ca457["registerPlugin()"]
  87162588_2ed8_24bc_b480_9bd5ba1ca457 -->|calls| b6c9e48d_2318_fe80_9d3e_2abc24db856b
  4eb765ee_e0d9_aa8a_a85c_ed4f153a25d2["getDisplayName()"]
  b6c9e48d_2318_fe80_9d3e_2abc24db856b -->|calls| 4eb765ee_e0d9_aa8a_a85c_ed4f153a25d2
  style b6c9e48d_2318_fe80_9d3e_2abc24db856b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

lib/plugin-utils.js lines 22–49

function getPluginName (func) {
  const display = getDisplayName(func)
  if (display) {
    return display
  }

  // let's see if this is a file, and in that case use that
  // this is common for plugins
  const cache = require.cache
  // cache is undefined inside SEA
  if (cache) {
    const keys = Object.keys(cache)

    for (let i = 0; i < keys.length; i++) {
      const key = keys[i]
      if (cache[key].exports === func) {
        return key
      }
    }
  }

  // if not maybe it's a named function, so use that
  if (func.name) {
    return func.name
  }

  return null
}

Domain

Subdomains

Defined In

Called By

Frequently Asked Questions

What does getPluginName() do?
getPluginName() is a function in the fastify codebase, defined in lib/plugin-utils.js.
Where is getPluginName() defined?
getPluginName() is defined in lib/plugin-utils.js at line 22.
What does getPluginName() call?
getPluginName() calls 1 function(s): getDisplayName.
What calls getPluginName()?
getPluginName() is called by 1 function(s): registerPlugin.

Analyze Your Own Codebase

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

Try Supermodel Free