MCPcopy
hub / github.com/LetTTGACO/elog / formattedPrefix

Function formattedPrefix

packages/plugin-image/src/platform/utils.ts:46–63  ·  view source on GitHub ↗
(prefix?: string)

Source from the content-addressed store, hash-verified

44 */
45
46export const formattedPrefix = (prefix?: string): string => {
47 // 如果没传,则默认为空
48 if (!prefix) return ''
49
50 let _prefix = prefix
51
52 // 如果开头无需/
53 if (_prefix.startsWith('/')) {
54 _prefix = _prefix.slice(1)
55 }
56
57 // 如果结尾需要/
58 if (!_prefix.endsWith('/')) {
59 _prefix = `${_prefix}/`
60 }
61
62 return _prefix
63}
64
65export const resolvePluginPath = (pluginPath: string) => {
66 const pluginLocalPath = path.resolve(process.cwd(), pluginPath)

Callers 5

initMethod · 0.90
initMethod · 0.90
initMethod · 0.90
initMethod · 0.90
initCosMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected