MCPcopy Create free account
hub / github.com/codecombat/codecombat / replaceParams

Function replaceParams

app/core/aceUtils.js:91–101  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

89
90const parseUserSnippets = function (source, lang, session) {
91 const replaceParams = function (str) {
92 let i = 1
93 // eslint-disable-next-line no-useless-escape, no-template-curly-in-string
94 str = str.replace(/(?:[^(,)]+ )?([a-zA-Z-0-9\$\-\u00A2-\uFFFF]+)([^,)]*)/g, '${:$1}') // /(?:[^(,)]+ )?/ part for ignoring the type declaration in cpp/java
95 const reg = /\$\{:/
96 while (reg.test(str)) {
97 str = str.replace(reg, `\${${i}:`)
98 i += 1
99 }
100 return str
101 }
102
103 const makeEntry = function (name, content, importance) {
104 content = content != null ? content : name

Callers 1

parseUserSnippetsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected