MCPcopy
hub / github.com/lowlighter/metrics / parse

Method parse

source/plugins/languages/analyzer/analyzer.mjs:71–84  ·  view source on GitHub ↗

Parse repository

(repository)

Source from the content-addressed store, hash-verified

69
70 /**Parse repository */
71 parse(repository) {
72 let branch = null, ref = null
73 if (typeof repository === "string") {
74 if (!this.parser.test(repository))
75 throw new TypeError(`"${repository}" pattern is not supported`)
76 const {login, name, ...groups} = repository.match(this.parser)?.groups ?? {}
77 repository = {owner: {login}, name}
78 branch = groups.branch ?? null
79 ref = groups.ref ?? null
80 }
81 const repo = `${repository.owner.login}/${repository.name}`
82 const path = paths.join(os.tmpdir(), `${this.uid}-${repo.replace(/[^\w]/g, "_")}`)
83 return {repo, path, branch, ref}
84 }
85
86 /**Clone a repository */
87 async clone(repository) {

Callers 15

cloneMethod · 0.95
metricsFunction · 0.80
setup.mjsFile · 0.80
getFunction · 0.80
metadataFunction · 0.80
metadata.mjsFile · 0.80
markdownFunction · 0.80
pdfFunction · 0.80
twemojisFunction · 0.80
searchFunction · 0.80
index.mjsFile · 0.80
index.mjsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected