| 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") |