MCPcopy Index your code
hub / github.com/processing/p5.js / formatJSDocComment

Function formatJSDocComment

utils/typescript.mjs:492–510  ·  view source on GitHub ↗
(text, indentLevel = 0)

Source from the content-addressed store, hash-verified

490}
491
492function formatJSDocComment(text, indentLevel = 0) {
493 if (!text) return '';
494 const indent = ' '.repeat(indentLevel);
495
496 const lines = text
497 .split('\n')
498 .map(line => line.trim())
499 .reduce((acc, line) => {
500 if (acc.length === 0 && line === '') return acc;
501 if (acc.length > 0 && line === '' && acc[acc.length - 1] === '') return acc;
502 acc.push(line);
503 return acc;
504 }, [])
505 .filter((line, i, arr) => i < arr.length - 1 || line !== '');
506
507 return lines
508 .map(line => `${indent} * ${line}`)
509 .join('\n');
510}
511
512function generateObjectInterface(param, allParams, options = {}) {
513 // Check if this is an object parameter (either required or optional)

Callers 4

generateTypedefInterfaceFunction · 0.85
generateClassDeclarationFunction · 0.85
generateTypeDefinitionsFunction · 0.85

Calls 4

splitMethod · 0.80
trimMethod · 0.80
filterMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected