MCPcopy Create free account
hub / github.com/APIParkLab/APIPark / getModule

Function getModule

frontend/packages/common/src/hooks/pluginLoader.ts:363–380  ·  view source on GitHub ↗
(routerPrefix: string, specific = false)

Source from the content-addressed store, hash-verified

361 }, [pendingTasks, executeList])
362
363 const getModule = (routerPrefix: string, specific = false) => {
364 if (routerPrefix.startsWith('/')) {
365 routerPrefix = routerPrefix.substring(1)
366 }
367 if (specific) {
368 return modules.get(routerPrefix)
369 }
370 let matchedModule = null
371 let matchedLength = 0
372
373 modules.forEach((value, key) => {
374 if (routerPrefix.startsWith(key) && key.length > matchedLength) {
375 matchedModule = value
376 matchedLength = key.length
377 }
378 })
379 return matchedModule
380 }
381
382 const loadModule = async (routerPrefix: string, pluginName: any, exposedModule: string, pluginPath: any) => {
383 if (!modules.get(routerPrefix)) {

Callers 1

loadModuleFunction · 0.85

Calls 1

getMethod · 0.45

Tested by

no test coverage detected