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

Function stripIndentation

app/core/utils.js:616–628  ·  view source on GitHub ↗
(code)

Source from the content-addressed store, hash-verified

614}
615
616var stripIndentation = function (code) {
617 let line
618 const codeLines = code.split('\n')
619 const indentation = _.min(_.filter(codeLines.map(line => __guard__(__guard__(line.match(/^\s*/), x2 => x2[0]), x1 => x1.length))))
620 const strippedCode = ((() => {
621 const result = []
622 for (line of Array.from(codeLines)) {
623 result.push(line.substr(indentation))
624 }
625 return result
626 })()).join('\n')
627 return strippedCode
628}
629
630const removeAI = function (str) {
631 // we have some objects as return value.

Callers 1

extractPlayerCodeTagFunction · 0.85

Calls 2

filterMethod · 0.80
__guard__Function · 0.70

Tested by

no test coverage detected