MCPcopy Create free account
hub / github.com/isomorphic-git/isomorphic-git / constructor

Method constructor

src/models/GitConfig.js:149–174  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

147// have subsections, [include] directives, etc.
148export class GitConfig {
149 constructor(text) {
150 let section = null
151 let subsection = null
152 this.parsedConfig = text
153 ? text.split('\n').map(line => {
154 let name = null
155 let value = null
156
157 const trimmedLine = line.trim()
158 const extractedSection = extractSectionLine(trimmedLine)
159 const isSection = extractedSection != null
160 if (isSection) {
161 ;[section, subsection] = extractedSection
162 } else {
163 const extractedVariable = extractVariableLine(trimmedLine)
164 const isVariable = extractedVariable != null
165 if (isVariable) {
166 ;[name, value] = extractedVariable
167 }
168 }
169
170 const path = getPath(section, subsection, name)
171 return { line, isSection, section, subsection, name, value, path }
172 })
173 : []
174 }
175
176 static from(text) {
177 return new GitConfig(text)

Callers

nothing calls this directly

Calls 3

extractSectionLineFunction · 0.85
extractVariableLineFunction · 0.85
getPathFunction · 0.85

Tested by

no test coverage detected