UNPKG

507 BJavaScriptView Raw
1"use strict";
2function prettyUrls(url, options = {}) {
3 options = Object.assign({
4 trailing_index: true,
5 trailing_html: true
6 }, options);
7 const indexPattern = /index\.html$/;
8 if (options.trailing_index === false)
9 url = url.replace(indexPattern, '');
10 if (options.trailing_html === false && !indexPattern.test(url)) {
11 url = url.replace(/\.html$/, '');
12 }
13 return url;
14}
15module.exports = prettyUrls;
16//# sourceMappingURL=pretty_urls.js.map
\No newline at end of file