MCPcopy Create free account
hub / github.com/DavidWells/analytics / es6Usage

Function es6Usage

scripts/docs.js:519–547  ·  view source on GitHub ↗
(data, pkg)

Source from the content-addressed store, hash-verified

517
518// ${example.replace(/^\s+|\s+$/g, '')},
519function es6Usage(data, pkg) {
520 const main = data.jsdoc.find((doc) => Boolean(doc.examples))
521
522 const name = main.name
523 const exampleCode = main.examples[0]
524 const code = `
525${generateImportStatement(name, pkg.name)}
526
527const analytics = Analytics({
528 app: 'awesome-app',
529 plugins: [
530 ${exampleCode}
531 // ...other plugins
532 ]
533})
534
535${renderRelevantMethods(data)}
536`
537
538return `<details>
539 <summary>Server-side ES6</summary>
540
541 \`\`\`js
542${indentString(formatCode(code), 2)}
543 \`\`\`
544
545</details>
546`
547}
548
549function getExposedFunctions(data) {
550 return data.ast.methodsByName.filter(removeMethod)

Callers 1

getUsageExamplesFunction · 0.85

Calls 3

generateImportStatementFunction · 0.85
renderRelevantMethodsFunction · 0.85
formatCodeFunction · 0.85

Tested by

no test coverage detected