MCPcopy Index your code
hub / github.com/codecombat/codecombat / getSampleCode

Method getSampleCode

app/models/Level.js:520–535  ·  view source on GitHub ↗
(team = 'humans')

Source from the content-addressed store, hash-verified

518 }
519
520 getSampleCode (team = 'humans') {
521 const plan = this.getProgrammablePlan(team)
522 const sampleCode = _.cloneDeep(plan?.languages || {})
523 sampleCode.javascript = plan?.source
524 const context = this.getCodeContext(plan)
525
526 _.forEach(sampleCode, (code, language) => {
527 try {
528 sampleCode[language] = _.template(code)(context)
529 } catch (e) {
530 console.error(`Problem with template and solution comments for '${this.get('slug') || this.get('name')}'`, e)
531 }
532 })
533
534 return sampleCode
535 }
536
537 getSolutionForLanguage (language) {
538 if (!language) { return '' }

Callers 3

levelToCodeMethod · 0.80
completeFunction · 0.80

Calls 5

getProgrammablePlanMethod · 0.95
getCodeContextMethod · 0.95
templateMethod · 0.80
errorMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected