e: "text/coffeescript", elm: "text/elm", cljc: "text/x-clojure", cljs: "text/x-clojurescript", }; /** * Returns the content type for the specified URL. If no specific * content type can be determined, "text/plain" is returned. * * @return String * The content type. */ function getContentType(url) { url = trimUrlQuery(url); const dot = url.lastIndexOf("."); if (dot >= 0) { const name = url.substring(dot + 1); if (name in contentMap) { return contentMap[name]; } } return "text/plain"; } function memoize(func) { const map = new Map(); return arg => { if (map.has(arg)) { return map.get(arg); } const result = func(arg); map.set(arg, result); return result; }; } module.exports = { originalToGeneratedId, generatedToOriginalId, isOriginalId, isGeneratedId, getContentType, contentMapForTesting: contentMap, }; PK