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

Function removeStandaloneExpressions

app/core/blocklyUtils.js:1407–1415  ·  view source on GitHub ↗
(code)

Source from the content-addressed store, hash-verified

1405}
1406
1407function removeStandaloneExpressions (code) {
1408 code = code.replace(/^ *'[^']*';? *$/gm, '') // Strip out string literals on their own line, we don't need to preserve those
1409 code = code.replace(/^ *[0-9]+;? *$/gm, '') // ... int literals
1410 code = code.replace(/^ *(True|true|False|false|null|None|nil|undefined);? *$/gm, '') // truthy/falsy litearls
1411 code = code.replace(/^ *(look|dist)\('.+?'\);? *$/gm, '') // ... standalone look and dist blocks
1412 code = code.replace(/^ *((look|dist)\('.+?'\)|health) *(===|==|!==|!=|~=|<|<=|>|>=) *['"]?[a-zA-Z0-9]*['"]?;? *$/gm, '') // ... standalone comparator expressions
1413 code = code.replace(/^ *health;? *$/gm, '') // ... standalone health blocks
1414 return code
1415}
1416
1417function findLastBlockWithNextConnection (block) {
1418 let lastBlockWithNextConnection

Callers 1

blocklyUtils.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected