MCPcopy Create free account
hub / github.com/neomjs/neo / getNameFromExamplePath

Function getNameFromExamplePath

buildScripts/docs/seo/generate.mjs:550–558  ·  view source on GitHub ↗

* Derives a human-readable name from an example path as a fallback. * e.g., 'examples/grid/bigData/index.html' -> 'Big Data' * @param {String} examplePath * @returns {String}

(examplePath)

Source from the content-addressed store, hash-verified

548 * @returns {String}
549 */
550function getNameFromExamplePath(examplePath) {
551 const parts = examplePath.split('/').slice(1, -1);
552 const name = parts[parts.length - 1];
553
554 return name.replace(/([A-Z])/g, ' $1')
555 .split(' ')
556 .map(word => word.charAt(0).toUpperCase() + word.slice(1))
557 .join(' ');
558}
559
560/**
561 * Collects all example routes by scanning the filesystem and reading their titles.

Callers 1

collectExampleRoutesFunction · 0.85

Calls 1

splitMethod · 0.80

Tested by

no test coverage detected