mongodb-rag-core
Version:
Common elements used by MongoDB Chatbot Framework components.
19 lines • 637 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.removeMarkdownFileExtension = void 0;
/**
Utility function to remove a markdown file extension (.md or .markdown)
from a string.
Can be used in MarkdownUrlDataSource to transform markdown URLs to page URLs.
*/
function removeMarkdownFileExtension(url) {
if (url.endsWith(".md")) {
return url.slice(0, -3);
}
else if (url.endsWith(".markdown")) {
return url.slice(0, -9);
}
return url;
}
exports.removeMarkdownFileExtension = removeMarkdownFileExtension;
//# sourceMappingURL=removeMarkdownFileExtension.js.map