MCPcopy Index your code
hub / github.com/didi/mpx / parseCommentConfig

Function parseCommentConfig

packages/unocss-plugin/lib/parser.js:43–60  ·  view source on GitHub ↗
(content)

Source from the content-addressed store, hash-verified

41}
42
43function parseCommentConfig (content) {
44 const result = {}
45 if (!content) { return result }
46 const regex = /mpx_config_(.+?)\s*:(.+)/
47 content.split(/\n|\r/).forEach((item) => {
48 const match = regex.exec(item)
49 if (match) {
50 const key = match[1]
51 const raw = match[2]
52 try {
53 const value = JSON.parse(raw.replace(/'/g, '"'))
54 result[key] = value
55 } catch (e) {
56 }
57 }
58 })
59 return result
60}
61
62function parseStrings (content) {
63 const output = []

Callers 1

processTemplateMethod · 0.70

Calls 4

forEachMethod · 0.80
parseMethod · 0.80
replaceMethod · 0.80
execMethod · 0.45

Tested by

no test coverage detected