@bartificer/linkify 2.3.5 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +135 -35
- package/dist/index.js +1 -1
- package/docs/LinkData.class.mjs.html +119 -56
- package/docs/LinkTemplate.class.mjs.html +120 -36
- package/docs/Linkifier.class.mjs.html +141 -66
- package/docs/PageData.class.mjs.html +145 -72
- package/docs/defaults.mjs.html +136 -12
- package/docs/docdash-overrides.css +11 -0
- package/docs/externals.jsdoc.html +95 -4
- package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
- package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
- package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
- package/docs/global.html +1276 -0
- package/docs/index.html +1018 -26
- package/docs/index.js.html +143 -17
- package/docs/mermaid-init.js +21 -0
- package/docs/module-cheerio.html +193 -3
- package/docs/module-defaults.html +680 -3
- package/docs/module-link-data.LinkData.html +813 -0
- package/docs/module-link-data.html +226 -0
- package/docs/module-link-template.LinkTemplate.html +792 -0
- package/docs/module-link-template.html +226 -0
- package/docs/module-linkifier.Linkifier.html +2050 -0
- package/docs/module-linkifier.html +236 -0
- package/docs/module-linkify.html +810 -3
- package/docs/module-mustache.html +193 -3
- package/docs/module-node-fetch.html +193 -3
- package/docs/module-page-data.PageData.html +1810 -0
- package/docs/module-page-data.html +226 -0
- package/docs/module-title-case.html +193 -3
- package/docs/module-urijs.html +193 -3
- package/docs/module-url-slug.html +193 -3
- package/docs/module-utilities.html +1518 -3
- package/docs/scripts/collapse.js +39 -0
- package/docs/scripts/commonNav.js +28 -0
- package/docs/scripts/linenumber.js +25 -0
- package/docs/scripts/nav.js +12 -0
- package/docs/scripts/polyfill.js +4 -0
- package/docs/scripts/{third-party → prettify}/Apache-License-2.0.txt +202 -202
- package/docs/scripts/prettify/lang-css.js +2 -0
- package/docs/scripts/prettify/prettify.js +28 -0
- package/docs/scripts/search.js +99 -265
- package/docs/styles/jsdoc.css +776 -0
- package/docs/styles/prettify.css +80 -0
- package/docs/typedefs.jsdoc.html +145 -0
- package/docs/utilities.mjs.html +154 -22
- package/examples/clipboardURLToMarkdown.mjs +80 -1
- package/package.json +5 -3
- package/src/LinkData.class.mjs +24 -52
- package/src/LinkTemplate.class.mjs +25 -32
- package/src/Linkifier.class.mjs +46 -62
- package/src/PageData.class.mjs +50 -68
- package/src/defaults.mjs +42 -8
- package/src/index.js +48 -13
- package/src/typedefs.jsdoc +52 -0
- package/src/utilities.mjs +59 -18
- package/docs/data/search.json +0 -1
- package/docs/fonts/Inconsolata-Regular.ttf +0 -0
- package/docs/fonts/OpenSans-Regular.ttf +0 -0
- package/docs/fonts/WorkSans-Bold.ttf +0 -0
- package/docs/module-LinkData.LinkData.html +0 -13
- package/docs/module-LinkData.html +0 -3
- package/docs/module-LinkTemplate.LinkTemplate.html +0 -3
- package/docs/module-LinkTemplate.html +0 -3
- package/docs/module-Linkifier.Linkifier.html +0 -3
- package/docs/module-Linkifier.html +0 -3
- package/docs/module-PageData.PageData.html +0 -15
- package/docs/module-PageData.html +0 -3
- package/docs/scripts/core.js +0 -726
- package/docs/scripts/core.min.js +0 -23
- package/docs/scripts/resize.js +0 -90
- package/docs/scripts/search.min.js +0 -6
- package/docs/scripts/third-party/fuse.js +0 -9
- package/docs/scripts/third-party/hljs-line-num-original.js +0 -369
- package/docs/scripts/third-party/hljs-line-num.js +0 -1
- package/docs/scripts/third-party/hljs-original.js +0 -5171
- package/docs/scripts/third-party/hljs.js +0 -1
- package/docs/scripts/third-party/popper.js +0 -5
- package/docs/scripts/third-party/tippy.js +0 -1
- package/docs/scripts/third-party/tocbot.js +0 -672
- package/docs/scripts/third-party/tocbot.min.js +0 -1
- package/docs/styles/clean-jsdoc-theme-base.css +0 -1159
- package/docs/styles/clean-jsdoc-theme-dark.css +0 -412
- package/docs/styles/clean-jsdoc-theme-light.css +0 -482
- package/docs/styles/clean-jsdoc-theme-scrollbar.css +0 -30
- package/docs/styles/clean-jsdoc-theme-without-scrollbar.min.css +0 -1
- package/docs/styles/clean-jsdoc-theme.min.css +0 -1
|
@@ -1,3 +1,1518 @@
|
|
|
1
|
-
<!DOCTYPE html
|
|
2
|
-
|
|
3
|
-
<![endif]--><script src="scripts/third-party/hljs.js" defer="defer"></script><script src="scripts/third-party/hljs-line-num.js" defer="defer"></script><script src="scripts/third-party/popper.js" defer="defer"></script><script src="scripts/third-party/tippy.js" defer="defer"></script><script src="scripts/third-party/tocbot.min.js"></script><script>var baseURL="/",locationPathname="";baseURL=(locationPathname=document.location.pathname).substr(0,locationPathname.lastIndexOf("/")+1)</script><link rel="stylesheet" href="styles/clean-jsdoc-theme.min.css"><svg aria-hidden="true" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="display:none"><defs><symbol id="copy-icon" viewbox="0 0 488.3 488.3"><g><path d="M314.25,85.4h-227c-21.3,0-38.6,17.3-38.6,38.6v325.7c0,21.3,17.3,38.6,38.6,38.6h227c21.3,0,38.6-17.3,38.6-38.6V124 C352.75,102.7,335.45,85.4,314.25,85.4z M325.75,449.6c0,6.4-5.2,11.6-11.6,11.6h-227c-6.4,0-11.6-5.2-11.6-11.6V124 c0-6.4,5.2-11.6,11.6-11.6h227c6.4,0,11.6,5.2,11.6,11.6V449.6z"/><path d="M401.05,0h-227c-21.3,0-38.6,17.3-38.6,38.6c0,7.5,6,13.5,13.5,13.5s13.5-6,13.5-13.5c0-6.4,5.2-11.6,11.6-11.6h227 c6.4,0,11.6,5.2,11.6,11.6v325.7c0,6.4-5.2,11.6-11.6,11.6c-7.5,0-13.5,6-13.5,13.5s6,13.5,13.5,13.5c21.3,0,38.6-17.3,38.6-38.6 V38.6C439.65,17.3,422.35,0,401.05,0z"/></g></symbol><symbol id="search-icon" viewBox="0 0 512 512"><g><g><path d="M225.474,0C101.151,0,0,101.151,0,225.474c0,124.33,101.151,225.474,225.474,225.474 c124.33,0,225.474-101.144,225.474-225.474C450.948,101.151,349.804,0,225.474,0z M225.474,409.323 c-101.373,0-183.848-82.475-183.848-183.848S124.101,41.626,225.474,41.626s183.848,82.475,183.848,183.848 S326.847,409.323,225.474,409.323z"/></g></g><g><g><path d="M505.902,476.472L386.574,357.144c-8.131-8.131-21.299-8.131-29.43,0c-8.131,8.124-8.131,21.306,0,29.43l119.328,119.328 c4.065,4.065,9.387,6.098,14.715,6.098c5.321,0,10.649-2.033,14.715-6.098C514.033,497.778,514.033,484.596,505.902,476.472z"/></g></g></symbol><symbol id="font-size-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11.246 15H4.754l-2 5H.6L7 4h2l6.4 16h-2.154l-2-5zm-.8-2L8 6.885 5.554 13h4.892zM21 12.535V12h2v8h-2v-.535a4 4 0 1 1 0-6.93zM19 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z"/></symbol><symbol id="add-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M11 11V5h2v6h6v2h-6v6h-2v-6H5v-2z"/></symbol><symbol id="minus-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M5 11h14v2H5z"/></symbol><symbol id="dark-theme-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M10 7a7 7 0 0 0 12 4.9v.1c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2h.1A6.979 6.979 0 0 0 10 7zm-6 5a8 8 0 0 0 15.062 3.762A9 9 0 0 1 8.238 4.938 7.999 7.999 0 0 0 4 12z"/></symbol><symbol id="light-theme-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-2a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM11 1h2v3h-2V1zm0 19h2v3h-2v-3zM3.515 4.929l1.414-1.414L7.05 5.636 5.636 7.05 3.515 4.93zM16.95 18.364l1.414-1.414 2.121 2.121-1.414 1.414-2.121-2.121zm2.121-14.85l1.414 1.415-2.121 2.121-1.414-1.414 2.121-2.121zM5.636 16.95l1.414 1.414-2.121 2.121-1.414-1.414 2.121-2.121zM23 11v2h-3v-2h3zM4 11v2H1v-2h3z"/></symbol><symbol id="reset-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M18.537 19.567A9.961 9.961 0 0 1 12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10c0 2.136-.67 4.116-1.81 5.74L17 12h3a8 8 0 1 0-2.46 5.772l.997 1.795z"/></symbol><symbol id="down-icon" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.7803 6.21967C13.0732 6.51256 13.0732 6.98744 12.7803 7.28033L8.53033 11.5303C8.23744 11.8232 7.76256 11.8232 7.46967 11.5303L3.21967 7.28033C2.92678 6.98744 2.92678 6.51256 3.21967 6.21967C3.51256 5.92678 3.98744 5.92678 4.28033 6.21967L8 9.93934L11.7197 6.21967C12.0126 5.92678 12.4874 5.92678 12.7803 6.21967Z"></path></symbol><symbol id="codepen-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M16.5 13.202L13 15.535v3.596L19.197 15 16.5 13.202zM14.697 12L12 10.202 9.303 12 12 13.798 14.697 12zM20 10.869L18.303 12 20 13.131V10.87zM19.197 9L13 4.869v3.596l3.5 2.333L19.197 9zM7.5 10.798L11 8.465V4.869L4.803 9 7.5 10.798zM4.803 15L11 19.131v-3.596l-3.5-2.333L4.803 15zM4 13.131L5.697 12 4 10.869v2.262zM2 9a1 1 0 0 1 .445-.832l9-6a1 1 0 0 1 1.11 0l9 6A1 1 0 0 1 22 9v6a1 1 0 0 1-.445.832l-9 6a1 1 0 0 1-1.11 0l-9-6A1 1 0 0 1 2 15V9z"/></symbol><symbol id="close-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M12 10.586l4.95-4.95 1.414 1.414-4.95 4.95 4.95 4.95-1.414 1.414-4.95-4.95-4.95 4.95-1.414-1.414 4.95-4.95-4.95-4.95L7.05 5.636z"/></symbol><symbol id="menu-icon" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0z"/><path d="M3 4h18v2H3V4zm0 7h18v2H3v-2zm0 7h18v2H3v-2z"/></symbol></defs></svg></head><body data-theme="fallback-light"><div class="sidebar-container"><div class="sidebar" id="sidebar"><a href="/" class="sidebar-title sidebar-title-anchor">Bartificer Linkifier</a><div class="sidebar-items-container"><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-modules"><div>Modules</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-LinkData.html">LinkData</a></div><div class="sidebar-section-children"><a href="module-LinkTemplate.html">LinkTemplate</a></div><div class="sidebar-section-children"><a href="module-Linkifier.html">Linkifier</a></div><div class="sidebar-section-children"><a href="module-PageData.html">PageData</a></div><div class="sidebar-section-children"><a href="module-defaults.html">defaults</a></div><div class="sidebar-section-children"><a href="module-linkify.html">linkify</a></div><div class="sidebar-section-children"><a href="module-utilities.html">utilities</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-classes"><div>Classes</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-LinkData.LinkData.html">LinkData</a></div><div class="sidebar-section-children"><a href="module-LinkTemplate.LinkTemplate.html">LinkTemplate</a></div><div class="sidebar-section-children"><a href="module-Linkifier.Linkifier.html">Linkifier</a></div><div class="sidebar-section-children"><a href="module-PageData.PageData.html">PageData</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-externals"><div>Externals</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-cheerio.html">cheerio</a></div><div class="sidebar-section-children"><a href="module-mustache.html">mustache</a></div><div class="sidebar-section-children"><a href="module-node-fetch.html">node-fetch</a></div><div class="sidebar-section-children"><a href="module-title-case.html">title-case</a></div><div class="sidebar-section-children"><a href="module-urijs.html">urijs</a></div><div class="sidebar-section-children"><a href="module-url-slug.html">url-slug</a></div></div></div></div></div><div class="navbar-container" id="VuAckcnZhf"><nav class="navbar"><div class="navbar-left-items"></div><div class="navbar-right-items"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#dark-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div><nav></nav></nav></div><div class="toc-container"><div class="toc-content"><span class="bold">On this page</span><div id="eed4d2a0bfd64539bb9df78095dec881"></div></div></div><div class="body-wrapper"><div class="main-content"><div class="main-wrapper"><section><header></header><article><div class="container-overview"><div class="description"><p>This module provides utility functions which are both used by the core code, and, available for use by users when defining link data transformers and link templates.</p></div><dl class="details"><div class="details-item-container"><dt class="tag-source bold">Source</dt><dd class="tag-source"><ul><li><a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line6">line 6</a></li></ul></dd></div></dl></div><h2 id="requires" class="subsection-title has-anchor">Requires</h2><ul><li><a href="module-defaults.html">module:defaults</a></li><li><a href="module-urijs.html">module:urijs</a></li><li><a href="module-url-slug.html">module:url-slug</a></li><li><a href="module-title-case.html">module:title-case</a></li></ul><h2 id="methods" class="subsection-title has-anchor">Methods</h2><h3 class="name has-anchor" id=".batchFixCustomWordCases"><span class="type-signature">(static) </span>batchFixCustomWordCases<span class="signature">(str, words<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {string}</span></h3><div class="description"><p>Batch-customise word casings in a string. E.g. force <code>fbi</code> to <code>FBI</code>, <code>ios</code> to <code>iOS</code>, etc..</p></div><div class="method-member-container flex flex-col w-100 overflow-auto mt-20"><strong>Parameters:</strong><table class="params"><thead><tr><th>Name</th><th>Type</th><th>Attributes</th><th class="last">Description</th></tr></thead><tbody><tr><td class="name"><code>str</code></td><td class="type"><span class="param-type">string</span></td><td class="attributes"></td><td class="description last"><p>the string to apply the replacemnts to.</p></td></tr><tr><td class="name"><code>words</code></td><td class="type"><span class="param-type">Array.<string></span></td><td class="attributes"><optional><br></td><td class="description last"><p>an array of words in their desired capitalisations. Defaults to the default list of custom capitalisations.</p></td></tr></tbody></table></div><dl class="details"><div class="details-item-container"><dt class="tag-source bold">Source</dt><dd class="tag-source"><ul><li><a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line70">line 70</a></li></ul></dd></div></dl><div class="method-member-container mt-20"><strong>Returns:</strong><dl class="param-type"><dt>Type: </dt><dd><span class="param-type">string</span></dd></dl></div><h3 class="name has-anchor" id=".escapeRegex"><span class="type-signature">(static) </span>escapeRegex<span class="signature">(str)</span><span class="type-signature"> → {string}</span></h3><div class="description"><p>Escape a string for use in regular expressions.</p><p><em><strong>Note:</strong> this is not a standard Javascript feature as of April 2026, though it is coming in future versions of Javascript.</em></p></div><div class="method-member-container flex flex-col w-100 overflow-auto mt-20"><strong>Parameters:</strong><table class="params"><thead><tr><th>Name</th><th>Type</th><th class="last">Description</th></tr></thead><tbody><tr><td class="name"><code>str</code></td><td class="type"><span class="param-type">string</span></td><td class="description last"><p>the string to escape.</p></td></tr></tbody></table></div><dl class="details"><div class="details-item-container"><dt class="tag-source bold">Source</dt><dd class="tag-source"><ul><li><a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line59">line 59</a></li></ul></dd></div><div class="details-item-container"><dt class="tag-see bold">See</dt><dd class="tag-see"><ul><li><a href="https://stackoverflow.com/a/3561711/174985">https://stackoverflow.com/a/3561711/174985</a></li></ul></dd></div></dl><div class="method-member-container mt-20"><strong>Returns:</strong><dl class="param-type"><dt>Type: </dt><dd><span class="param-type">string</span></dd></dl></div><h3 class="name has-anchor" id=".extractSlug"><span class="type-signature">(static) </span>extractSlug<span class="signature">(url, words<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {string}</span></h3><div class="description"><p>Extract the slug from a URL and convert it to a title-case string.</p></div><div class="method-member-container flex flex-col w-100 overflow-auto mt-20"><strong>Parameters:</strong><table class="params"><thead><tr><th>Name</th><th>Type</th><th>Attributes</th><th class="last">Description</th></tr></thead><tbody><tr><td class="name"><code>url</code></td><td class="type"><span class="param-type">string</span></td><td class="attributes"></td><td class="description last"></td></tr><tr><td class="name"><code>words</code></td><td class="type"><span class="param-type">Array.<string></span></td><td class="attributes"><optional><br></td><td class="description last"><p>a list of words with custom capitalisations to correct after title-casing.</p></td></tr></tbody></table></div><dl class="details"><div class="details-item-container"><dt class="tag-source bold">Source</dt><dd class="tag-source"><ul><li><a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line106">line 106</a></li></ul></dd></div></dl><div class="method-member-container mt-20"><strong>Returns:</strong><dl class="param-type"><dt>Type: </dt><dd><span class="param-type">string</span></dd></dl></div><h3 class="name has-anchor" id=".regulariseWhitespace"><span class="type-signature">(static) </span>regulariseWhitespace<span class="signature">(text)</span><span class="type-signature"> → {string}</span></h3><div class="description"><p>Regularise white space by replacing all sequences of whitespace characters with a single space and trimming leading and trailing whitespace.</p></div><div class="method-member-container flex flex-col w-100 overflow-auto mt-20"><strong>Parameters:</strong><table class="params"><thead><tr><th>Name</th><th>Type</th><th class="last">Description</th></tr></thead><tbody><tr><td class="name"><code>text</code></td><td class="type"><span class="param-type">string</span></td><td class="description last"></td></tr></tbody></table></div><dl class="details"><div class="details-item-container"><dt class="tag-source bold">Source</dt><dd class="tag-source"><ul><li><a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line25">line 25</a></li></ul></dd></div></dl><div class="method-member-container mt-20"><strong>Returns:</strong><dl class="param-type"><dt>Type: </dt><dd><span class="param-type">string</span></dd></dl></div><h3 class="name has-anchor" id=".stripQueryString"><span class="type-signature">(static) </span>stripQueryString<span class="signature">(url)</span><span class="type-signature"> → {string}</span></h3><div class="description"><p>Strip the query string from a URL.</p></div><div class="method-member-container flex flex-col w-100 overflow-auto mt-20"><strong>Parameters:</strong><table class="params"><thead><tr><th>Name</th><th>Type</th><th class="last">Description</th></tr></thead><tbody><tr><td class="name"><code>url</code></td><td class="type"><span class="param-type">string</span></td><td class="description last"></td></tr></tbody></table></div><dl class="details"><div class="details-item-container"><dt class="tag-source bold">Source</dt><dd class="tag-source"><ul><li><a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line35">line 35</a></li></ul></dd></div></dl><div class="method-member-container mt-20"><strong>Returns:</strong><dl class="param-type"><dt>Type: </dt><dd><span class="param-type">string</span></dd></dl></div><h3 class="name has-anchor" id=".stripUTMParameters"><span class="type-signature">(static) </span>stripUTMParameters<span class="signature">(url)</span><span class="type-signature"> → {string}</span></h3><div class="description"><p>Remove UTM parameters from the query string in a URL.</p></div><div class="method-member-container flex flex-col w-100 overflow-auto mt-20"><strong>Parameters:</strong><table class="params"><thead><tr><th>Name</th><th>Type</th><th class="last">Description</th></tr></thead><tbody><tr><td class="name"><code>url</code></td><td class="type"><span class="param-type">string</span></td><td class="description last"></td></tr></tbody></table></div><dl class="details"><div class="details-item-container"><dt class="tag-source bold">Source</dt><dd class="tag-source"><ul><li><a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line46">line 46</a></li></ul></dd></div><div class="details-item-container"><dt class="tag-see bold">See</dt><dd class="tag-see"><ul><li><a href="https://en.wikipedia.org/wiki/UTM_parameters">https://en.wikipedia.org/wiki/UTM_parameters</a></li></ul></dd></div></dl><div class="method-member-container mt-20"><strong>Returns:</strong><dl class="param-type"><dt>Type: </dt><dd><span class="param-type">string</span></dd></dl></div></article></section></div></div></div><div class="search-container" id="PkfLWpAbet" style="display:none"><div class="wrapper" id="iCxFxjkHbP"><button class="icon-button search-close-button" id="VjLlGakifb" aria-label="close search"><svg><use xlink:href="#close-icon"></use></svg></button><div class="search-box-c"><svg><use xlink:href="#search-icon"></use></svg> <input type="text" id="vpcKVYIppa" class="search-input" placeholder="Search..." autofocus></div><div class="search-result-c" id="fWwVHRuDuN"><span class="search-result-c-text">Type anything to view search result</span></div></div></div><div class="mobile-menu-icon-container"><button class="icon-button" id="mobile-menu" data-isopen="false" aria-label="menu"><svg><use xlink:href="#menu-icon"></use></svg></button></div><div id="mobile-sidebar" class="mobile-sidebar-container"><div class="mobile-sidebar-wrapper"><a href="/" class="sidebar-title sidebar-title-anchor">Bartificer Linkifier</a><div class="mobile-nav-links"></div><div class="mobile-sidebar-items-c"><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-modules"><div>Modules</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-LinkData.html">LinkData</a></div><div class="sidebar-section-children"><a href="module-LinkTemplate.html">LinkTemplate</a></div><div class="sidebar-section-children"><a href="module-Linkifier.html">Linkifier</a></div><div class="sidebar-section-children"><a href="module-PageData.html">PageData</a></div><div class="sidebar-section-children"><a href="module-defaults.html">defaults</a></div><div class="sidebar-section-children"><a href="module-linkify.html">linkify</a></div><div class="sidebar-section-children"><a href="module-utilities.html">utilities</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-classes"><div>Classes</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-LinkData.LinkData.html">LinkData</a></div><div class="sidebar-section-children"><a href="module-LinkTemplate.LinkTemplate.html">LinkTemplate</a></div><div class="sidebar-section-children"><a href="module-Linkifier.Linkifier.html">Linkifier</a></div><div class="sidebar-section-children"><a href="module-PageData.PageData.html">PageData</a></div></div><div class="sidebar-section-title with-arrow" data-isopen="false" id="sidebar-externals"><div>Externals</div><svg><use xlink:href="#down-icon"></use></svg></div><div class="sidebar-section-children-container"><div class="sidebar-section-children"><a href="module-cheerio.html">cheerio</a></div><div class="sidebar-section-children"><a href="module-mustache.html">mustache</a></div><div class="sidebar-section-children"><a href="module-node-fetch.html">node-fetch</a></div><div class="sidebar-section-children"><a href="module-title-case.html">title-case</a></div><div class="sidebar-section-children"><a href="module-urijs.html">urijs</a></div><div class="sidebar-section-children"><a href="module-url-slug.html">url-slug</a></div></div></div><div class="mobile-navbar-actions"><div class="navbar-right-item"><button class="icon-button search-button" aria-label="open-search"><svg><use xlink:href="#search-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button theme-toggle" aria-label="toggle-theme"><svg><use class="theme-svg-use" xlink:href="#dark-theme-icon"></use></svg></button></div><div class="navbar-right-item"><button class="icon-button font-size" aria-label="change-font-size"><svg><use xlink:href="#font-size-icon"></use></svg></button></div></div></div></div><script type="text/javascript" src="scripts/core.min.js"></script><script src="scripts/search.min.js" defer="defer"></script><script src="scripts/third-party/fuse.js" defer="defer"></script><script type="text/javascript">var tocbotInstance=tocbot.init({tocSelector:"#eed4d2a0bfd64539bb9df78095dec881",contentSelector:".main-content",headingSelector:"h1, h2, h3",hasInnerContainers:!0,scrollContainer:".main-content",headingsOffset:130,onClick:bringLinkToView})</script></body></html>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<title>utilities - @bartificer/linkify Documentation</title>
|
|
7
|
+
|
|
8
|
+
<meta name="description" content="Documentation for the @bartificer/linkify package" />
|
|
9
|
+
|
|
10
|
+
<meta name="keywords" content="documentation, linkify, link, template, javascript, generator, npm, module, package" />
|
|
11
|
+
<meta name="keyword" content="documentation, linkify, link, template, javascript, generator, npm, module, package" />
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
<meta property="og:title" content="@bartificer/linkify"/>
|
|
16
|
+
<meta property="og:type" content="website"/>
|
|
17
|
+
<meta property="og:image" content=""/>
|
|
18
|
+
<meta property="og:site_name" content="@bartificer/linkify Documentation"/>
|
|
19
|
+
<meta property="og:url" content="https://bartificer.github.io/linkify/"/>
|
|
20
|
+
|
|
21
|
+
<script src="scripts/prettify/prettify.js"></script>
|
|
22
|
+
<script src="scripts/prettify/lang-css.js"></script>
|
|
23
|
+
<!--[if lt IE 9]>
|
|
24
|
+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
25
|
+
<![endif]-->
|
|
26
|
+
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
|
|
27
|
+
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
|
|
28
|
+
<script src="scripts/nav.js" defer></script>
|
|
29
|
+
|
|
30
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
31
|
+
</head>
|
|
32
|
+
<body>
|
|
33
|
+
|
|
34
|
+
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
|
35
|
+
<label for="nav-trigger" class="navicon-button x">
|
|
36
|
+
<div class="navicon"></div>
|
|
37
|
+
</label>
|
|
38
|
+
|
|
39
|
+
<label for="nav-trigger" class="overlay"></label>
|
|
40
|
+
|
|
41
|
+
<nav class="wrap">
|
|
42
|
+
|
|
43
|
+
<input type="text" id="nav-search" placeholder="Search" />
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<h2><a href="index.html">Home</a></h2><h2><a href="https://github.com/bartificer/linkify" target="_blank" >On GitHub</a></h2><h2><a href="https://bartificer.net/" target="_blank" >Bartificer Creations</a></h2><h3>Modules</h3><ul><li><a href="module-defaults.html">defaults</a><ul class='members'><li data-type='member'><a href="module-defaults.html#.linkTemplates">linkTemplates</a></li><li data-type='member'><a href="module-defaults.html#.smallWords">smallWords</a></li><li data-type='member'><a href="module-defaults.html#.speciallyCapitalisedWords">speciallyCapitalisedWords</a></li></ul><ul class='methods'><li data-type='method'><a href="module-defaults.html#.dataTransformer">dataTransformer</a></li></ul></li><li><a href="module-link-data.html">link-data</a></li><li><a href="module-link-template.html">link-template</a></li><li><a href="module-linkifier.html">linkifier</a></li><li><a href="module-linkify.html">linkify</a><ul class='members'><li data-type='member'><a href="module-linkify.html#.LinkData">LinkData</a></li><li data-type='member'><a href="module-linkify.html#.LinkTemplate">LinkTemplate</a></li><li data-type='member'><a href="module-linkify.html#.Linkifier">Linkifier</a></li><li data-type='member'><a href="module-linkify.html#.PageData">PageData</a></li><li data-type='member'><a href="module-linkify.html#.VERSION">VERSION</a></li><li data-type='member'><a href="module-linkify.html#.default">default</a></li><li data-type='member'><a href="module-linkify.html#.linkify">linkify</a></li></ul></li><li><a href="module-page-data.html">page-data</a></li><li><a href="module-utilities.html">utilities</a><ul class='methods'><li data-type='method'><a href="module-utilities.html#.batchFixCustomWordCases">batchFixCustomWordCases</a></li><li data-type='method'><a href="module-utilities.html#.escapeRegex">escapeRegex</a></li><li data-type='method'><a href="module-utilities.html#.extractSlug">extractSlug</a></li><li data-type='method'><a href="module-utilities.html#.regulariseWhitespace">regulariseWhitespace</a></li><li data-type='method'><a href="module-utilities.html#.stripQueryString">stripQueryString</a></li><li data-type='method'><a href="module-utilities.html#.stripUTMParameters">stripUTMParameters</a></li><li data-type='method'><a href="module-utilities.html#.toTitleCase">toTitleCase</a></li></ul></li></ul><h3>Classes</h3><ul><li><a href="module-link-data.LinkData.html">LinkData</a><ul class='methods'><li data-type='method'><a href="module-link-data.LinkData.html#asPlainObject">asPlainObject</a></li></ul></li><li><a href="module-link-template.LinkTemplate.html">LinkTemplate</a><ul class='methods'><li data-type='method'><a href="module-link-template.LinkTemplate.html#addFilter">addFilter</a></li><li data-type='method'><a href="module-link-template.LinkTemplate.html#filtersFor">filtersFor</a></li></ul></li><li><a href="module-linkifier.Linkifier.html">Linkifier</a><ul class='methods'><li data-type='method'><a href="module-linkifier.Linkifier.html#fetchPageData">fetchPageData</a></li><li data-type='method'><a href="module-linkifier.Linkifier.html#generateLink">generateLink</a></li><li data-type='method'><a href="module-linkifier.Linkifier.html#getTemplate">getTemplate</a></li><li data-type='method'><a href="module-linkifier.Linkifier.html#getTemplateNameForDomain">getTemplateNameForDomain</a></li><li data-type='method'><a href="module-linkifier.Linkifier.html#getTransformerForDomain">getTransformerForDomain</a></li><li data-type='method'><a href="module-linkifier.Linkifier.html#registerDefaultTemplateMapping">registerDefaultTemplateMapping</a></li><li data-type='method'><a href="module-linkifier.Linkifier.html#registerTemplate">registerTemplate</a></li><li data-type='method'><a href="module-linkifier.Linkifier.html#registerTransformer">registerTransformer</a></li></ul></li><li><a href="module-page-data.PageData.html">PageData</a><ul class='methods'><li data-type='method'><a href="module-page-data.PageData.html#addSecondaryHeading">addSecondaryHeading</a></li><li data-type='method'><a href="module-page-data.PageData.html#addTopLevelHeading">addTopLevelHeading</a></li><li data-type='method'><a href="module-page-data.PageData.html#asPlainObject">asPlainObject</a></li><li data-type='method'><a href="module-page-data.PageData.html#h1">h1</a></li><li data-type='method'><a href="module-page-data.PageData.html#h2">h2</a></li></ul></li></ul><h3>Global</h3><ul><li><a href="global.html#dataTransformer">dataTransformer</a></li><li><a href="global.html#plainLinkInformationObject">plainLinkInformationObject</a></li><li><a href="global.html#plainPageInformationObject">plainPageInformationObject</a></li><li><a href="global.html#templateFieldFilterFunction">templateFieldFilterFunction</a></li><li><a href="global.html#templateFieldFilterTuple">templateFieldFilterTuple</a></li></ul><h3>Externals</h3><ul><li><a href="module-cheerio.html">cheerio</a></li><li><a href="module-mustache.html">mustache</a></li><li><a href="module-node-fetch.html">node-fetch</a></li><li><a href="module-title-case.html">title-case</a></li><li><a href="module-urijs.html">urijs</a></li><li><a href="module-url-slug.html">url-slug</a></li></ul>
|
|
47
|
+
|
|
48
|
+
</nav>
|
|
49
|
+
|
|
50
|
+
<div id="main">
|
|
51
|
+
|
|
52
|
+
<h1 class="page-title">utilities</h1>
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
<section>
|
|
61
|
+
|
|
62
|
+
<header>
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
</header>
|
|
69
|
+
|
|
70
|
+
<article>
|
|
71
|
+
|
|
72
|
+
<div class="container-overview">
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
<div class="description usertext"><p>Utility functions, intended both for use within the core link generation code, and, by users defining their own custom templates, transformer functions, and filter functions.</p>
|
|
76
|
+
<p>This module is exposed to end-users as <a href="module-linkifier.Linkifier.html#utilities">module:linkifier.Linkifier#utilities</a> and <a href="module-linkifier.Linkifier.html#util">module:linkifier.Linkifier#util</a>.</p></div>
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
<dl class="details">
|
|
86
|
+
|
|
87
|
+
<dt class="tag-description">Description:</dt>
|
|
88
|
+
<dd class="tag-description"><ul class="dummy"><li><p>Utility functions, intended both for use within the core link generation code, and, by users defining their own custom templates, transformer functions, and filter functions.</p>
|
|
89
|
+
<p>This module is exposed to end-users as <a href="module-linkifier.Linkifier.html#utilities">module:linkifier.Linkifier#utilities</a> and <a href="module-linkifier.Linkifier.html#util">module:linkifier.Linkifier#util</a>.</p></li></ul></dd>
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
<dt class="tag-source">Source:</dt>
|
|
94
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
95
|
+
<a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line7">line 7</a>
|
|
96
|
+
</li></ul></dd>
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
<dt class="tag-see">See:</dt>
|
|
127
|
+
<dd class="tag-see">
|
|
128
|
+
<ul>
|
|
129
|
+
<li><a href="module-linkifier.Linkifier.html#utilities">module:linkifier.Linkifier#utilities</a> for the short-cut to this module exposed on the Linkifier class.</li>
|
|
130
|
+
|
|
131
|
+
<li><a href="module-linkifier.Linkifier.html#util">module:linkifier.Linkifier#util</a> for the short-cut to this module exposed on the Linkifier class.</li>
|
|
132
|
+
</ul>
|
|
133
|
+
</dd>
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
</dl>
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
</div>
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
<h3 class="subsection-title">Requires</h3>
|
|
177
|
+
|
|
178
|
+
<ul>
|
|
179
|
+
<li><a href="module-defaults.html">module:defaults</a></li>
|
|
180
|
+
|
|
181
|
+
<li><a href="module-urijs.html">module:urijs</a></li>
|
|
182
|
+
|
|
183
|
+
<li><a href="module-url-slug.html">module:url-slug</a></li>
|
|
184
|
+
|
|
185
|
+
<li><a href="module-title-case.html">module:title-case</a></li>
|
|
186
|
+
</ul>
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
<h3 class="subsection-title">Methods</h3>
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
<h4 class="name" id=".batchFixCustomWordCases"><span class="type-signature type-signature-static">(static) </span>batchFixCustomWordCases<span class="signature">(str, words<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {string}</span></h4>
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
<dl class="details">
|
|
215
|
+
|
|
216
|
+
<dt class="tag-description">Description:</dt>
|
|
217
|
+
<dd class="tag-description"><ul class="dummy"><li><p>Batch-fix words with special capitalisations in a string. E.g. force <code>fbi</code> to <code>FBI</code>, <code>ios</code> to <code>iOS</code>, etc..</p></li></ul></dd>
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
<dt class="tag-source">Source:</dt>
|
|
222
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
223
|
+
<a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line76">line 76</a>
|
|
224
|
+
</li></ul></dd>
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
<dt class="tag-see">See:</dt>
|
|
255
|
+
<dd class="tag-see">
|
|
256
|
+
<ul>
|
|
257
|
+
<li><a href="module-defaults.html#.speciallyCapitalisedWords">module:defaults.speciallyCapitalisedWords</a> for the default list of custom capitalisations.</li>
|
|
258
|
+
</ul>
|
|
259
|
+
</dd>
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
</dl>
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
<h5 class="h5-parameters">Parameters:</h5>
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
<table class="params">
|
|
281
|
+
<thead>
|
|
282
|
+
<tr>
|
|
283
|
+
|
|
284
|
+
<th>Name</th>
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
<th>Type</th>
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
<th>Attributes</th>
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
<th class="last">Description</th>
|
|
296
|
+
</tr>
|
|
297
|
+
</thead>
|
|
298
|
+
|
|
299
|
+
<tbody>
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
<tr>
|
|
303
|
+
|
|
304
|
+
<td class="name"><code>str</code></td>
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
<td class="type">
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
<span class="param-type">string</span>
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
</td>
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
<td class="attributes">
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
</td>
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
<td class="description last"><p>the string to apply the capitalisation corrections to.</p></td>
|
|
330
|
+
</tr>
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
<tr>
|
|
335
|
+
|
|
336
|
+
<td class="name"><code>words</code></td>
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
<td class="type">
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
<span class="param-type">Array.<string></span>
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
</td>
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
<td class="attributes">
|
|
351
|
+
|
|
352
|
+
<optional><br>
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
</td>
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
<td class="description last"><p>the list of words with special capitalisations. Defaults to the default list <a href="module-defaults.html#.speciallyCapitalisedWords">module:defaults.speciallyCapitalisedWords</a>.</p></td>
|
|
364
|
+
</tr>
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
</tbody>
|
|
368
|
+
</table>
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
<h5 class="h5-returns">Returns:</h5>
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
<div class="param-desc">
|
|
389
|
+
<p>the original string with all occurrences of the words in the list capitalised as per the word list. All other capitatlisations will be left un-changed.</p>
|
|
390
|
+
</div>
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
<dl class="param-type">
|
|
395
|
+
<dt>
|
|
396
|
+
Type
|
|
397
|
+
</dt>
|
|
398
|
+
<dd>
|
|
399
|
+
|
|
400
|
+
<span class="param-type">string</span>
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
</dd>
|
|
405
|
+
</dl>
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
<h4 class="name" id=".escapeRegex"><span class="type-signature type-signature-static">(static) </span>escapeRegex<span class="signature">(str)</span><span class="type-signature"> → {string}</span></h4>
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
<dl class="details">
|
|
424
|
+
|
|
425
|
+
<dt class="tag-description">Description:</dt>
|
|
426
|
+
<dd class="tag-description"><ul class="dummy"><li><p>Escape a string for use in regular expressions.</p>
|
|
427
|
+
<p><em><strong>Note:</strong> this is not a standard Javascript feature as of April 2026, though it is coming in future versions of Javascript.</em></p></li></ul></dd>
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
<dt class="tag-source">Source:</dt>
|
|
432
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
433
|
+
<a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line64">line 64</a>
|
|
434
|
+
</li></ul></dd>
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
<dt class="tag-see">See:</dt>
|
|
465
|
+
<dd class="tag-see">
|
|
466
|
+
<ul>
|
|
467
|
+
<li><a href="https://stackoverflow.com/a/3561711/174985">https://stackoverflow.com/a/3561711/174985</a></li>
|
|
468
|
+
</ul>
|
|
469
|
+
</dd>
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
|
|
473
|
+
</dl>
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
<h5 class="h5-parameters">Parameters:</h5>
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
<table class="params">
|
|
491
|
+
<thead>
|
|
492
|
+
<tr>
|
|
493
|
+
|
|
494
|
+
<th>Name</th>
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
<th>Type</th>
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
<th class="last">Description</th>
|
|
504
|
+
</tr>
|
|
505
|
+
</thead>
|
|
506
|
+
|
|
507
|
+
<tbody>
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
<tr>
|
|
511
|
+
|
|
512
|
+
<td class="name"><code>str</code></td>
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
<td class="type">
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
<span class="param-type">string</span>
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
</td>
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
<td class="description last"><p>the string to escape.</p></td>
|
|
530
|
+
</tr>
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
</tbody>
|
|
534
|
+
</table>
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
<h5 class="h5-returns">Returns:</h5>
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
<div class="param-desc">
|
|
555
|
+
<p>the escaped string, ready for use in a regular expression.</p>
|
|
556
|
+
</div>
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
<dl class="param-type">
|
|
561
|
+
<dt>
|
|
562
|
+
Type
|
|
563
|
+
</dt>
|
|
564
|
+
<dd>
|
|
565
|
+
|
|
566
|
+
<span class="param-type">string</span>
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
</dd>
|
|
571
|
+
</dl>
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
<h4 class="name" id=".extractSlug"><span class="type-signature type-signature-static">(static) </span>extractSlug<span class="signature">(url, words<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {string}</span></h4>
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
<dl class="details">
|
|
590
|
+
|
|
591
|
+
<dt class="tag-description">Description:</dt>
|
|
592
|
+
<dd class="tag-description"><ul class="dummy"><li><p>Extract the slug from a URL and convert it to a title-case string.</p></li></ul></dd>
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
<dt class="tag-source">Source:</dt>
|
|
597
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
598
|
+
<a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line147">line 147</a>
|
|
599
|
+
</li></ul></dd>
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
<dt class="tag-see">See:</dt>
|
|
630
|
+
<dd class="tag-see">
|
|
631
|
+
<ul>
|
|
632
|
+
<li><a href="module-defaults.html#.speciallyCapitalisedWords">module:defaults.speciallyCapitalisedWords</a> for the default list of custom capitalisations.</li>
|
|
633
|
+
|
|
634
|
+
<li>toTitleCase for the function used for the title-casing.</li>
|
|
635
|
+
</ul>
|
|
636
|
+
</dd>
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
</dl>
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
<h5 class="h5-parameters">Parameters:</h5>
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
<table class="params">
|
|
658
|
+
<thead>
|
|
659
|
+
<tr>
|
|
660
|
+
|
|
661
|
+
<th>Name</th>
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
<th>Type</th>
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
<th>Attributes</th>
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
<th class="last">Description</th>
|
|
673
|
+
</tr>
|
|
674
|
+
</thead>
|
|
675
|
+
|
|
676
|
+
<tbody>
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
<tr>
|
|
680
|
+
|
|
681
|
+
<td class="name"><code>url</code></td>
|
|
682
|
+
|
|
683
|
+
|
|
684
|
+
<td class="type">
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
<span class="param-type">string</span>
|
|
688
|
+
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
</td>
|
|
693
|
+
|
|
694
|
+
|
|
695
|
+
<td class="attributes">
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
</td>
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
<td class="description last"><p>the URL to extract the slug from. The slug is taken to be the last segment of the path, with any file extension removed, and with the query string and fragment ignored.</p></td>
|
|
707
|
+
</tr>
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
|
|
711
|
+
<tr>
|
|
712
|
+
|
|
713
|
+
<td class="name"><code>words</code></td>
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
<td class="type">
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
<span class="param-type">Array.<string></span>
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
</td>
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
<td class="attributes">
|
|
728
|
+
|
|
729
|
+
<optional><br>
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
</td>
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
<td class="description last"><p>a list of words with custom capitalisations to correct after title-casing. Defaults to <a href="module-defaults.html#.speciallyCapitalisedWords">module:defaults.speciallyCapitalisedWords</a>.</p></td>
|
|
741
|
+
</tr>
|
|
742
|
+
|
|
743
|
+
|
|
744
|
+
</tbody>
|
|
745
|
+
</table>
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
|
|
762
|
+
<h5 class="h5-returns">Returns:</h5>
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
<div class="param-desc">
|
|
766
|
+
<p>the slug extracted from the URL, converted to title case, with the custom capitalisations applied.</p>
|
|
767
|
+
</div>
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
<dl class="param-type">
|
|
772
|
+
<dt>
|
|
773
|
+
Type
|
|
774
|
+
</dt>
|
|
775
|
+
<dd>
|
|
776
|
+
|
|
777
|
+
<span class="param-type">string</span>
|
|
778
|
+
|
|
779
|
+
|
|
780
|
+
|
|
781
|
+
</dd>
|
|
782
|
+
</dl>
|
|
783
|
+
|
|
784
|
+
|
|
785
|
+
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
|
|
793
|
+
<h4 class="name" id=".regulariseWhitespace"><span class="type-signature type-signature-static">(static) </span>regulariseWhitespace<span class="signature">(text)</span><span class="type-signature"> → {string}</span></h4>
|
|
794
|
+
|
|
795
|
+
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
|
|
800
|
+
<dl class="details">
|
|
801
|
+
|
|
802
|
+
<dt class="tag-description">Description:</dt>
|
|
803
|
+
<dd class="tag-description"><ul class="dummy"><li><p>Regularise white space by replacing all sequences of whitespace characters with a single space and trimming leading and trailing whitespace.</p></li></ul></dd>
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
|
|
807
|
+
<dt class="tag-source">Source:</dt>
|
|
808
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
809
|
+
<a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line30">line 30</a>
|
|
810
|
+
</li></ul></dd>
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
|
|
818
|
+
|
|
819
|
+
|
|
820
|
+
|
|
821
|
+
|
|
822
|
+
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
|
|
828
|
+
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
</dl>
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
|
|
849
|
+
|
|
850
|
+
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
<h5 class="h5-parameters">Parameters:</h5>
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
<table class="params">
|
|
860
|
+
<thead>
|
|
861
|
+
<tr>
|
|
862
|
+
|
|
863
|
+
<th>Name</th>
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
<th>Type</th>
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
<th class="last">Description</th>
|
|
873
|
+
</tr>
|
|
874
|
+
</thead>
|
|
875
|
+
|
|
876
|
+
<tbody>
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
<tr>
|
|
880
|
+
|
|
881
|
+
<td class="name"><code>text</code></td>
|
|
882
|
+
|
|
883
|
+
|
|
884
|
+
<td class="type">
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
<span class="param-type">string</span>
|
|
888
|
+
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
</td>
|
|
893
|
+
|
|
894
|
+
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
|
|
898
|
+
<td class="description last"></td>
|
|
899
|
+
</tr>
|
|
900
|
+
|
|
901
|
+
|
|
902
|
+
</tbody>
|
|
903
|
+
</table>
|
|
904
|
+
|
|
905
|
+
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
|
|
910
|
+
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
|
|
918
|
+
|
|
919
|
+
|
|
920
|
+
<h5 class="h5-returns">Returns:</h5>
|
|
921
|
+
|
|
922
|
+
|
|
923
|
+
|
|
924
|
+
|
|
925
|
+
<dl class="param-type">
|
|
926
|
+
<dt>
|
|
927
|
+
Type
|
|
928
|
+
</dt>
|
|
929
|
+
<dd>
|
|
930
|
+
|
|
931
|
+
<span class="param-type">string</span>
|
|
932
|
+
|
|
933
|
+
|
|
934
|
+
|
|
935
|
+
</dd>
|
|
936
|
+
</dl>
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
|
|
943
|
+
|
|
944
|
+
|
|
945
|
+
|
|
946
|
+
|
|
947
|
+
<h4 class="name" id=".stripQueryString"><span class="type-signature type-signature-static">(static) </span>stripQueryString<span class="signature">(url)</span><span class="type-signature"> → {string}</span></h4>
|
|
948
|
+
|
|
949
|
+
|
|
950
|
+
|
|
951
|
+
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
<dl class="details">
|
|
955
|
+
|
|
956
|
+
<dt class="tag-description">Description:</dt>
|
|
957
|
+
<dd class="tag-description"><ul class="dummy"><li><p>Strip the query string from a URL, if present.</p></li></ul></dd>
|
|
958
|
+
|
|
959
|
+
|
|
960
|
+
|
|
961
|
+
<dt class="tag-source">Source:</dt>
|
|
962
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
963
|
+
<a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line40">line 40</a>
|
|
964
|
+
</li></ul></dd>
|
|
965
|
+
|
|
966
|
+
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
|
|
972
|
+
|
|
973
|
+
|
|
974
|
+
|
|
975
|
+
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
|
|
979
|
+
|
|
980
|
+
|
|
981
|
+
|
|
982
|
+
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
|
|
987
|
+
|
|
988
|
+
|
|
989
|
+
|
|
990
|
+
|
|
991
|
+
|
|
992
|
+
|
|
993
|
+
|
|
994
|
+
|
|
995
|
+
|
|
996
|
+
</dl>
|
|
997
|
+
|
|
998
|
+
|
|
999
|
+
|
|
1000
|
+
|
|
1001
|
+
|
|
1002
|
+
|
|
1003
|
+
|
|
1004
|
+
|
|
1005
|
+
|
|
1006
|
+
|
|
1007
|
+
|
|
1008
|
+
|
|
1009
|
+
|
|
1010
|
+
<h5 class="h5-parameters">Parameters:</h5>
|
|
1011
|
+
|
|
1012
|
+
|
|
1013
|
+
<table class="params">
|
|
1014
|
+
<thead>
|
|
1015
|
+
<tr>
|
|
1016
|
+
|
|
1017
|
+
<th>Name</th>
|
|
1018
|
+
|
|
1019
|
+
|
|
1020
|
+
<th>Type</th>
|
|
1021
|
+
|
|
1022
|
+
|
|
1023
|
+
|
|
1024
|
+
|
|
1025
|
+
|
|
1026
|
+
<th class="last">Description</th>
|
|
1027
|
+
</tr>
|
|
1028
|
+
</thead>
|
|
1029
|
+
|
|
1030
|
+
<tbody>
|
|
1031
|
+
|
|
1032
|
+
|
|
1033
|
+
<tr>
|
|
1034
|
+
|
|
1035
|
+
<td class="name"><code>url</code></td>
|
|
1036
|
+
|
|
1037
|
+
|
|
1038
|
+
<td class="type">
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
<span class="param-type">string</span>
|
|
1042
|
+
|
|
1043
|
+
|
|
1044
|
+
|
|
1045
|
+
|
|
1046
|
+
</td>
|
|
1047
|
+
|
|
1048
|
+
|
|
1049
|
+
|
|
1050
|
+
|
|
1051
|
+
|
|
1052
|
+
<td class="description last"><p>a URL with our without a query string.</p></td>
|
|
1053
|
+
</tr>
|
|
1054
|
+
|
|
1055
|
+
|
|
1056
|
+
</tbody>
|
|
1057
|
+
</table>
|
|
1058
|
+
|
|
1059
|
+
|
|
1060
|
+
|
|
1061
|
+
|
|
1062
|
+
|
|
1063
|
+
|
|
1064
|
+
|
|
1065
|
+
|
|
1066
|
+
|
|
1067
|
+
|
|
1068
|
+
|
|
1069
|
+
|
|
1070
|
+
|
|
1071
|
+
|
|
1072
|
+
|
|
1073
|
+
|
|
1074
|
+
<h5 class="h5-returns">Returns:</h5>
|
|
1075
|
+
|
|
1076
|
+
|
|
1077
|
+
<div class="param-desc">
|
|
1078
|
+
<p>the original URL with the query string removed, if it was present.</p>
|
|
1079
|
+
</div>
|
|
1080
|
+
|
|
1081
|
+
|
|
1082
|
+
|
|
1083
|
+
<dl class="param-type">
|
|
1084
|
+
<dt>
|
|
1085
|
+
Type
|
|
1086
|
+
</dt>
|
|
1087
|
+
<dd>
|
|
1088
|
+
|
|
1089
|
+
<span class="param-type">string</span>
|
|
1090
|
+
|
|
1091
|
+
|
|
1092
|
+
|
|
1093
|
+
</dd>
|
|
1094
|
+
</dl>
|
|
1095
|
+
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
|
|
1099
|
+
|
|
1100
|
+
|
|
1101
|
+
|
|
1102
|
+
|
|
1103
|
+
|
|
1104
|
+
|
|
1105
|
+
<h4 class="name" id=".stripUTMParameters"><span class="type-signature type-signature-static">(static) </span>stripUTMParameters<span class="signature">(url)</span><span class="type-signature"> → {string}</span></h4>
|
|
1106
|
+
|
|
1107
|
+
|
|
1108
|
+
|
|
1109
|
+
|
|
1110
|
+
|
|
1111
|
+
|
|
1112
|
+
<dl class="details">
|
|
1113
|
+
|
|
1114
|
+
<dt class="tag-description">Description:</dt>
|
|
1115
|
+
<dd class="tag-description"><ul class="dummy"><li><p>Remove UTM parameters from the query string in a URL, if present.</p></li></ul></dd>
|
|
1116
|
+
|
|
1117
|
+
|
|
1118
|
+
|
|
1119
|
+
<dt class="tag-source">Source:</dt>
|
|
1120
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
1121
|
+
<a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line51">line 51</a>
|
|
1122
|
+
</li></ul></dd>
|
|
1123
|
+
|
|
1124
|
+
|
|
1125
|
+
|
|
1126
|
+
|
|
1127
|
+
|
|
1128
|
+
|
|
1129
|
+
|
|
1130
|
+
|
|
1131
|
+
|
|
1132
|
+
|
|
1133
|
+
|
|
1134
|
+
|
|
1135
|
+
|
|
1136
|
+
|
|
1137
|
+
|
|
1138
|
+
|
|
1139
|
+
|
|
1140
|
+
|
|
1141
|
+
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
|
|
1145
|
+
|
|
1146
|
+
|
|
1147
|
+
|
|
1148
|
+
|
|
1149
|
+
|
|
1150
|
+
|
|
1151
|
+
|
|
1152
|
+
<dt class="tag-see">See:</dt>
|
|
1153
|
+
<dd class="tag-see">
|
|
1154
|
+
<ul>
|
|
1155
|
+
<li><a href="https://en.wikipedia.org/wiki/UTM_parameters">https://en.wikipedia.org/wiki/UTM_parameters</a></li>
|
|
1156
|
+
</ul>
|
|
1157
|
+
</dd>
|
|
1158
|
+
|
|
1159
|
+
|
|
1160
|
+
|
|
1161
|
+
</dl>
|
|
1162
|
+
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
|
|
1166
|
+
|
|
1167
|
+
|
|
1168
|
+
|
|
1169
|
+
|
|
1170
|
+
|
|
1171
|
+
|
|
1172
|
+
|
|
1173
|
+
|
|
1174
|
+
|
|
1175
|
+
<h5 class="h5-parameters">Parameters:</h5>
|
|
1176
|
+
|
|
1177
|
+
|
|
1178
|
+
<table class="params">
|
|
1179
|
+
<thead>
|
|
1180
|
+
<tr>
|
|
1181
|
+
|
|
1182
|
+
<th>Name</th>
|
|
1183
|
+
|
|
1184
|
+
|
|
1185
|
+
<th>Type</th>
|
|
1186
|
+
|
|
1187
|
+
|
|
1188
|
+
|
|
1189
|
+
|
|
1190
|
+
|
|
1191
|
+
<th class="last">Description</th>
|
|
1192
|
+
</tr>
|
|
1193
|
+
</thead>
|
|
1194
|
+
|
|
1195
|
+
<tbody>
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
<tr>
|
|
1199
|
+
|
|
1200
|
+
<td class="name"><code>url</code></td>
|
|
1201
|
+
|
|
1202
|
+
|
|
1203
|
+
<td class="type">
|
|
1204
|
+
|
|
1205
|
+
|
|
1206
|
+
<span class="param-type">string</span>
|
|
1207
|
+
|
|
1208
|
+
|
|
1209
|
+
|
|
1210
|
+
|
|
1211
|
+
</td>
|
|
1212
|
+
|
|
1213
|
+
|
|
1214
|
+
|
|
1215
|
+
|
|
1216
|
+
|
|
1217
|
+
<td class="description last"><p>a URL with or without UTM parameters in the query string.</p></td>
|
|
1218
|
+
</tr>
|
|
1219
|
+
|
|
1220
|
+
|
|
1221
|
+
</tbody>
|
|
1222
|
+
</table>
|
|
1223
|
+
|
|
1224
|
+
|
|
1225
|
+
|
|
1226
|
+
|
|
1227
|
+
|
|
1228
|
+
|
|
1229
|
+
|
|
1230
|
+
|
|
1231
|
+
|
|
1232
|
+
|
|
1233
|
+
|
|
1234
|
+
|
|
1235
|
+
|
|
1236
|
+
|
|
1237
|
+
|
|
1238
|
+
|
|
1239
|
+
<h5 class="h5-returns">Returns:</h5>
|
|
1240
|
+
|
|
1241
|
+
|
|
1242
|
+
<div class="param-desc">
|
|
1243
|
+
<p>the original URL with the UTM parameters removed, if they were present, but with any other query parameters preserved.</p>
|
|
1244
|
+
</div>
|
|
1245
|
+
|
|
1246
|
+
|
|
1247
|
+
|
|
1248
|
+
<dl class="param-type">
|
|
1249
|
+
<dt>
|
|
1250
|
+
Type
|
|
1251
|
+
</dt>
|
|
1252
|
+
<dd>
|
|
1253
|
+
|
|
1254
|
+
<span class="param-type">string</span>
|
|
1255
|
+
|
|
1256
|
+
|
|
1257
|
+
|
|
1258
|
+
</dd>
|
|
1259
|
+
</dl>
|
|
1260
|
+
|
|
1261
|
+
|
|
1262
|
+
|
|
1263
|
+
|
|
1264
|
+
|
|
1265
|
+
|
|
1266
|
+
|
|
1267
|
+
|
|
1268
|
+
|
|
1269
|
+
|
|
1270
|
+
<h4 class="name" id=".toTitleCase"><span class="type-signature type-signature-static">(static) </span>toTitleCase<span class="signature">(str, words<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {string}</span></h4>
|
|
1271
|
+
|
|
1272
|
+
|
|
1273
|
+
|
|
1274
|
+
|
|
1275
|
+
|
|
1276
|
+
|
|
1277
|
+
<dl class="details">
|
|
1278
|
+
|
|
1279
|
+
<dt class="tag-description">Description:</dt>
|
|
1280
|
+
<dd class="tag-description"><ul class="dummy"><li><p>Convert a string to title case, with some custom capitalisations.</p>
|
|
1281
|
+
<p>This functions uses the <a href="module-title-case.html">module:title-case</a> to perform the initial title-caseing, and then applies the custom capitalisations to fix any words with unusual capitalisation requirements.
|
|
1282
|
+
All words this mododule defies as being so-called <em>small words</em> (e.g., "the", "a" & "an") are preserved in lower case, as well as the additional words defined in <a href="module-defaults.html#.smallWords">module:defaults.smallWords</a>.</p></li></ul></dd>
|
|
1283
|
+
|
|
1284
|
+
|
|
1285
|
+
|
|
1286
|
+
<dt class="tag-source">Source:</dt>
|
|
1287
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
1288
|
+
<a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line118">line 118</a>
|
|
1289
|
+
</li></ul></dd>
|
|
1290
|
+
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
|
|
1294
|
+
|
|
1295
|
+
|
|
1296
|
+
|
|
1297
|
+
|
|
1298
|
+
|
|
1299
|
+
|
|
1300
|
+
|
|
1301
|
+
|
|
1302
|
+
|
|
1303
|
+
|
|
1304
|
+
|
|
1305
|
+
|
|
1306
|
+
|
|
1307
|
+
|
|
1308
|
+
|
|
1309
|
+
|
|
1310
|
+
|
|
1311
|
+
|
|
1312
|
+
|
|
1313
|
+
|
|
1314
|
+
|
|
1315
|
+
|
|
1316
|
+
|
|
1317
|
+
|
|
1318
|
+
|
|
1319
|
+
<dt class="tag-see">See:</dt>
|
|
1320
|
+
<dd class="tag-see">
|
|
1321
|
+
<ul>
|
|
1322
|
+
<li><a href="module-defaults.html#.speciallyCapitalisedWords">module:defaults.speciallyCapitalisedWords</a> for the default list of custom capitalisations.</li>
|
|
1323
|
+
|
|
1324
|
+
<li><a href="module-title-case.html">module:title-case</a> for the Title Case module who's `titleCase()` function is used to convert to title case, and which has its own default list of small words that are preserved in lower case.</li>
|
|
1325
|
+
|
|
1326
|
+
<li><a href="module-defaults.html#.smallWords">module:defaults.smallWords</a> for the additional list of small words that are preserved in lower case.</li>
|
|
1327
|
+
</ul>
|
|
1328
|
+
</dd>
|
|
1329
|
+
|
|
1330
|
+
|
|
1331
|
+
|
|
1332
|
+
</dl>
|
|
1333
|
+
|
|
1334
|
+
|
|
1335
|
+
|
|
1336
|
+
|
|
1337
|
+
|
|
1338
|
+
|
|
1339
|
+
|
|
1340
|
+
|
|
1341
|
+
|
|
1342
|
+
|
|
1343
|
+
|
|
1344
|
+
|
|
1345
|
+
|
|
1346
|
+
<h5 class="h5-parameters">Parameters:</h5>
|
|
1347
|
+
|
|
1348
|
+
|
|
1349
|
+
<table class="params">
|
|
1350
|
+
<thead>
|
|
1351
|
+
<tr>
|
|
1352
|
+
|
|
1353
|
+
<th>Name</th>
|
|
1354
|
+
|
|
1355
|
+
|
|
1356
|
+
<th>Type</th>
|
|
1357
|
+
|
|
1358
|
+
|
|
1359
|
+
<th>Attributes</th>
|
|
1360
|
+
|
|
1361
|
+
|
|
1362
|
+
|
|
1363
|
+
|
|
1364
|
+
<th class="last">Description</th>
|
|
1365
|
+
</tr>
|
|
1366
|
+
</thead>
|
|
1367
|
+
|
|
1368
|
+
<tbody>
|
|
1369
|
+
|
|
1370
|
+
|
|
1371
|
+
<tr>
|
|
1372
|
+
|
|
1373
|
+
<td class="name"><code>str</code></td>
|
|
1374
|
+
|
|
1375
|
+
|
|
1376
|
+
<td class="type">
|
|
1377
|
+
|
|
1378
|
+
|
|
1379
|
+
<span class="param-type">string</span>
|
|
1380
|
+
|
|
1381
|
+
|
|
1382
|
+
|
|
1383
|
+
|
|
1384
|
+
</td>
|
|
1385
|
+
|
|
1386
|
+
|
|
1387
|
+
<td class="attributes">
|
|
1388
|
+
|
|
1389
|
+
|
|
1390
|
+
|
|
1391
|
+
|
|
1392
|
+
|
|
1393
|
+
</td>
|
|
1394
|
+
|
|
1395
|
+
|
|
1396
|
+
|
|
1397
|
+
|
|
1398
|
+
<td class="description last"><p>the string to convert to title case.</p></td>
|
|
1399
|
+
</tr>
|
|
1400
|
+
|
|
1401
|
+
|
|
1402
|
+
|
|
1403
|
+
<tr>
|
|
1404
|
+
|
|
1405
|
+
<td class="name"><code>words</code></td>
|
|
1406
|
+
|
|
1407
|
+
|
|
1408
|
+
<td class="type">
|
|
1409
|
+
|
|
1410
|
+
|
|
1411
|
+
<span class="param-type">Array.<string></span>
|
|
1412
|
+
|
|
1413
|
+
|
|
1414
|
+
|
|
1415
|
+
|
|
1416
|
+
</td>
|
|
1417
|
+
|
|
1418
|
+
|
|
1419
|
+
<td class="attributes">
|
|
1420
|
+
|
|
1421
|
+
<optional><br>
|
|
1422
|
+
|
|
1423
|
+
|
|
1424
|
+
|
|
1425
|
+
|
|
1426
|
+
|
|
1427
|
+
</td>
|
|
1428
|
+
|
|
1429
|
+
|
|
1430
|
+
|
|
1431
|
+
|
|
1432
|
+
<td class="description last"><p>a list of words with custom capitalisations to correct after title-casing. Defaults to <a href="module-defaults.html#.speciallyCapitalisedWords">module:defaults.speciallyCapitalisedWords</a>.</p></td>
|
|
1433
|
+
</tr>
|
|
1434
|
+
|
|
1435
|
+
|
|
1436
|
+
</tbody>
|
|
1437
|
+
</table>
|
|
1438
|
+
|
|
1439
|
+
|
|
1440
|
+
|
|
1441
|
+
|
|
1442
|
+
|
|
1443
|
+
|
|
1444
|
+
|
|
1445
|
+
|
|
1446
|
+
|
|
1447
|
+
|
|
1448
|
+
|
|
1449
|
+
|
|
1450
|
+
|
|
1451
|
+
|
|
1452
|
+
|
|
1453
|
+
|
|
1454
|
+
<h5 class="h5-returns">Returns:</h5>
|
|
1455
|
+
|
|
1456
|
+
|
|
1457
|
+
<div class="param-desc">
|
|
1458
|
+
<p>the original string converted to title case, with the custom capitalisations applied.</p>
|
|
1459
|
+
</div>
|
|
1460
|
+
|
|
1461
|
+
|
|
1462
|
+
|
|
1463
|
+
<dl class="param-type">
|
|
1464
|
+
<dt>
|
|
1465
|
+
Type
|
|
1466
|
+
</dt>
|
|
1467
|
+
<dd>
|
|
1468
|
+
|
|
1469
|
+
<span class="param-type">string</span>
|
|
1470
|
+
|
|
1471
|
+
|
|
1472
|
+
|
|
1473
|
+
</dd>
|
|
1474
|
+
</dl>
|
|
1475
|
+
|
|
1476
|
+
|
|
1477
|
+
|
|
1478
|
+
|
|
1479
|
+
|
|
1480
|
+
|
|
1481
|
+
|
|
1482
|
+
|
|
1483
|
+
|
|
1484
|
+
|
|
1485
|
+
|
|
1486
|
+
</article>
|
|
1487
|
+
|
|
1488
|
+
</section>
|
|
1489
|
+
|
|
1490
|
+
|
|
1491
|
+
|
|
1492
|
+
|
|
1493
|
+
|
|
1494
|
+
|
|
1495
|
+
</div>
|
|
1496
|
+
|
|
1497
|
+
<br class="clear">
|
|
1498
|
+
|
|
1499
|
+
<footer>
|
|
1500
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Wed Apr 15 2026 17:49:51 GMT+0100 (Irish Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
1501
|
+
</footer>
|
|
1502
|
+
|
|
1503
|
+
<script>prettyPrint();</script>
|
|
1504
|
+
<script src="scripts/polyfill.js"></script>
|
|
1505
|
+
<script src="scripts/linenumber.js"></script>
|
|
1506
|
+
|
|
1507
|
+
<script src="scripts/search.js" defer></script>
|
|
1508
|
+
|
|
1509
|
+
|
|
1510
|
+
|
|
1511
|
+
<link type="text/css" rel="stylesheet" href="./docdash-overrides.css">
|
|
1512
|
+
|
|
1513
|
+
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
|
|
1514
|
+
|
|
1515
|
+
<script src="./mermaid-init.js"></script>
|
|
1516
|
+
|
|
1517
|
+
</body>
|
|
1518
|
+
</html>
|