MCPcopy Create free account
hub / github.com/breck7/scroll / getMethodFromDotPath

Method getMethodFromDotPath

external/.scrollLibs.js:14160–14169  ·  view source on GitHub ↗
(context, str)

Source from the content-addressed store, hash-verified

14158 return str.replace(/[^\x00-\x7F]/g, "")
14159 }
14160 static getMethodFromDotPath(context, str) {
14161 const methodParts = str.split(".")
14162 while (methodParts.length > 1) {
14163 const methodName = methodParts.shift()
14164 if (!context[methodName]) throw new Error(`${methodName} is not a method on ${context}`)
14165 context = context[methodName]()
14166 }
14167 const final = methodParts.shift()
14168 return [context, final]
14169 }
14170 static requireAbsOrRelative(filePath, contextFilePath) {
14171 if (!filePath.startsWith(".")) return require(filePath)
14172 const path = require("path")

Callers

nothing calls this directly

Calls 2

splitMethod · 0.80
shiftMethod · 0.80

Tested by

no test coverage detected