MCPcopy Create free account
hub / github.com/BruceDevices/firmware / toggleComment

Function toggleComment

embedded_resources/web_interface/index.js:1407–1427  ·  view source on GitHub ↗
(line)

Source from the content-addressed store, hash-verified

1405
1406 const handleComment = (commentStr) => {
1407 const toggleComment = (line) => {
1408 const indentation = line.match(leadingSpacesRegex)[0] || "";
1409 const content = line.slice(indentation.length);
1410
1411 if (content.startsWith(commentStr + " ")) {
1412 return {
1413 line: indentation + content.slice(commentStr.length + 1),
1414 offset: -(commentStr.length + 1),
1415 };
1416 } else if (content.startsWith(commentStr)) {
1417 return {
1418 line: indentation + content.slice(commentStr.length),
1419 offset: -commentStr.length,
1420 };
1421 } else {
1422 return {
1423 line: indentation + commentStr + " " + content,
1424 offset: commentStr.length + 1,
1425 };
1426 }
1427 };
1428
1429 const isCommented = (line) => {
1430 const content = line.slice(

Callers 1

handleCommentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected