@bartificer/linkify 2.3.4 → 2.4.0

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.
Files changed (97) hide show
  1. package/dist/index.js +1 -1
  2. package/docs/LinkData.class.mjs.html +93 -5
  3. package/docs/LinkTemplate.class.mjs.html +93 -5
  4. package/docs/Linkifier.class.mjs.html +99 -11
  5. package/docs/PageData.class.mjs.html +93 -5
  6. package/docs/defaults.mjs.html +121 -12
  7. package/docs/docdash-overrides.css +5 -0
  8. package/docs/externals.jsdoc.html +91 -4
  9. package/docs/fonts/Montserrat/Montserrat-Bold.eot +0 -0
  10. package/docs/fonts/Montserrat/Montserrat-Bold.ttf +0 -0
  11. package/docs/fonts/Montserrat/Montserrat-Bold.woff +0 -0
  12. package/docs/fonts/Montserrat/Montserrat-Bold.woff2 +0 -0
  13. package/docs/fonts/Montserrat/Montserrat-Regular.eot +0 -0
  14. package/docs/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  15. package/docs/fonts/Montserrat/Montserrat-Regular.woff +0 -0
  16. package/docs/fonts/Montserrat/Montserrat-Regular.woff2 +0 -0
  17. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.eot +0 -0
  18. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.svg +978 -0
  19. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.ttf +0 -0
  20. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff +0 -0
  21. package/docs/fonts/Source-Sans-Pro/sourcesanspro-light-webfont.woff2 +0 -0
  22. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.eot +0 -0
  23. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.svg +1049 -0
  24. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.ttf +0 -0
  25. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff +0 -0
  26. package/docs/fonts/Source-Sans-Pro/sourcesanspro-regular-webfont.woff2 +0 -0
  27. package/docs/index.html +930 -7
  28. package/docs/index.js.html +139 -17
  29. package/docs/module-cheerio.html +189 -3
  30. package/docs/module-defaults.html +585 -3
  31. package/docs/module-link-data.LinkData.html +944 -0
  32. package/docs/module-link-data.html +222 -0
  33. package/docs/module-link-template.LinkTemplate.html +817 -0
  34. package/docs/module-link-template.html +222 -0
  35. package/docs/module-linkifier.Linkifier.html +2323 -0
  36. package/docs/module-linkifier.html +232 -0
  37. package/docs/module-linkify.html +806 -3
  38. package/docs/module-mustache.html +189 -3
  39. package/docs/module-node-fetch.html +189 -3
  40. package/docs/module-page-data.PageData.html +1788 -0
  41. package/docs/module-page-data.html +222 -0
  42. package/docs/module-title-case.html +189 -3
  43. package/docs/module-urijs.html +189 -3
  44. package/docs/module-url-slug.html +189 -3
  45. package/docs/module-utilities.html +1468 -3
  46. package/docs/scripts/collapse.js +39 -0
  47. package/docs/scripts/commonNav.js +28 -0
  48. package/docs/scripts/linenumber.js +25 -0
  49. package/docs/scripts/nav.js +12 -0
  50. package/docs/scripts/polyfill.js +4 -0
  51. package/docs/scripts/{third-party → prettify}/Apache-License-2.0.txt +202 -202
  52. package/docs/scripts/prettify/lang-css.js +2 -0
  53. package/docs/scripts/prettify/prettify.js +28 -0
  54. package/docs/scripts/search.js +99 -265
  55. package/docs/styles/jsdoc.css +776 -0
  56. package/docs/styles/prettify.css +80 -0
  57. package/docs/utilities.mjs.html +124 -5
  58. package/examples/clipboardURLToMarkdown.mjs +130 -29
  59. package/package.json +3 -2
  60. package/src/LinkData.class.mjs +2 -1
  61. package/src/LinkTemplate.class.mjs +2 -1
  62. package/src/Linkifier.class.mjs +8 -7
  63. package/src/PageData.class.mjs +2 -1
  64. package/src/defaults.mjs +31 -8
  65. package/src/index.js +48 -13
  66. package/src/utilities.mjs +33 -1
  67. package/docs/data/search.json +0 -1
  68. package/docs/fonts/Inconsolata-Regular.ttf +0 -0
  69. package/docs/fonts/OpenSans-Regular.ttf +0 -0
  70. package/docs/fonts/WorkSans-Bold.ttf +0 -0
  71. package/docs/module-LinkData.LinkData.html +0 -13
  72. package/docs/module-LinkData.html +0 -3
  73. package/docs/module-LinkTemplate.LinkTemplate.html +0 -3
  74. package/docs/module-LinkTemplate.html +0 -3
  75. package/docs/module-Linkifier.Linkifier.html +0 -3
  76. package/docs/module-Linkifier.html +0 -3
  77. package/docs/module-PageData.PageData.html +0 -15
  78. package/docs/module-PageData.html +0 -3
  79. package/docs/scripts/core.js +0 -726
  80. package/docs/scripts/core.min.js +0 -23
  81. package/docs/scripts/resize.js +0 -90
  82. package/docs/scripts/search.min.js +0 -6
  83. package/docs/scripts/third-party/fuse.js +0 -9
  84. package/docs/scripts/third-party/hljs-line-num-original.js +0 -369
  85. package/docs/scripts/third-party/hljs-line-num.js +0 -1
  86. package/docs/scripts/third-party/hljs-original.js +0 -5171
  87. package/docs/scripts/third-party/hljs.js +0 -1
  88. package/docs/scripts/third-party/popper.js +0 -5
  89. package/docs/scripts/third-party/tippy.js +0 -1
  90. package/docs/scripts/third-party/tocbot.js +0 -672
  91. package/docs/scripts/third-party/tocbot.min.js +0 -1
  92. package/docs/styles/clean-jsdoc-theme-base.css +0 -1159
  93. package/docs/styles/clean-jsdoc-theme-dark.css +0 -412
  94. package/docs/styles/clean-jsdoc-theme-light.css +0 -482
  95. package/docs/styles/clean-jsdoc-theme-scrollbar.css +0 -30
  96. package/docs/styles/clean-jsdoc-theme-without-scrollbar.min.css +0 -1
  97. package/docs/styles/clean-jsdoc-theme.min.css +0 -1
@@ -1,3 +1,1468 @@
1
- <!DOCTYPE html><html lang="en" style="font-size:16px"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Module: utilities</title><!--[if lt IE 9]>
2
- <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
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"> &rarr; {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.&lt;string></span></td><td class="attributes">&lt;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:&nbsp;</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"> &rarr; {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:&nbsp;</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"> &rarr; {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.&lt;string></span></td><td class="attributes">&lt;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:&nbsp;</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"> &rarr; {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:&nbsp;</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"> &rarr; {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:&nbsp;</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"> &rarr; {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:&nbsp;</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></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>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>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>
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+
84
+ <dl class="details">
85
+
86
+ <dt class="tag-description">Description:</dt>
87
+ <dd class="tag-description"><ul class="dummy"><li><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></li></ul></dd>
88
+
89
+
90
+
91
+ <dt class="tag-source">Source:</dt>
92
+ <dd class="tag-source"><ul class="dummy"><li>
93
+ <a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line7">line 7</a>
94
+ </li></ul></dd>
95
+
96
+
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
+ </dl>
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+
158
+
159
+ </div>
160
+
161
+
162
+
163
+
164
+
165
+ <h3 class="subsection-title">Requires</h3>
166
+
167
+ <ul>
168
+ <li><a href="module-defaults.html">module:defaults</a></li>
169
+
170
+ <li><a href="module-urijs.html">module:urijs</a></li>
171
+
172
+ <li><a href="module-url-slug.html">module:url-slug</a></li>
173
+
174
+ <li><a href="module-title-case.html">module:title-case</a></li>
175
+ </ul>
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+ <h3 class="subsection-title">Methods</h3>
190
+
191
+
192
+
193
+
194
+
195
+
196
+ <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"> &rarr; {string}</span></h4>
197
+
198
+
199
+
200
+
201
+
202
+
203
+ <dl class="details">
204
+
205
+ <dt class="tag-description">Description:</dt>
206
+ <dd class="tag-description"><ul class="dummy"><li><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></li></ul></dd>
207
+
208
+
209
+
210
+ <dt class="tag-source">Source:</dt>
211
+ <dd class="tag-source"><ul class="dummy"><li>
212
+ <a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line72">line 72</a>
213
+ </li></ul></dd>
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+ <dt class="tag-see">See:</dt>
244
+ <dd class="tag-see">
245
+ <ul>
246
+ <li><a href="module-defaults.html#.speciallyCapitalisedWords">module:defaults.speciallyCapitalisedWords</a> for the default list of custom capitalisations.</li>
247
+ </ul>
248
+ </dd>
249
+
250
+
251
+
252
+ </dl>
253
+
254
+
255
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+
266
+ <h5 class="h5-parameters">Parameters:</h5>
267
+
268
+
269
+ <table class="params">
270
+ <thead>
271
+ <tr>
272
+
273
+ <th>Name</th>
274
+
275
+
276
+ <th>Type</th>
277
+
278
+
279
+ <th>Attributes</th>
280
+
281
+
282
+
283
+
284
+ <th class="last">Description</th>
285
+ </tr>
286
+ </thead>
287
+
288
+ <tbody>
289
+
290
+
291
+ <tr>
292
+
293
+ <td class="name"><code>str</code></td>
294
+
295
+
296
+ <td class="type">
297
+
298
+
299
+ <span class="param-type">string</span>
300
+
301
+
302
+
303
+
304
+ </td>
305
+
306
+
307
+ <td class="attributes">
308
+
309
+
310
+
311
+
312
+
313
+ </td>
314
+
315
+
316
+
317
+
318
+ <td class="description last"><p>the string to apply the replacemnts to.</p></td>
319
+ </tr>
320
+
321
+
322
+
323
+ <tr>
324
+
325
+ <td class="name"><code>words</code></td>
326
+
327
+
328
+ <td class="type">
329
+
330
+
331
+ <span class="param-type">Array.&lt;string></span>
332
+
333
+
334
+
335
+
336
+ </td>
337
+
338
+
339
+ <td class="attributes">
340
+
341
+ &lt;optional><br>
342
+
343
+
344
+
345
+
346
+
347
+ </td>
348
+
349
+
350
+
351
+
352
+ <td class="description last"><p>an array of words in their desired capitalisations. Defaults to the default list of custom capitalisations.</p></td>
353
+ </tr>
354
+
355
+
356
+ </tbody>
357
+ </table>
358
+
359
+
360
+
361
+
362
+
363
+
364
+
365
+
366
+
367
+
368
+
369
+
370
+
371
+
372
+
373
+
374
+ <h5 class="h5-returns">Returns:</h5>
375
+
376
+
377
+
378
+
379
+ <dl class="param-type">
380
+ <dt>
381
+ Type
382
+ </dt>
383
+ <dd>
384
+
385
+ <span class="param-type">string</span>
386
+
387
+
388
+
389
+ </dd>
390
+ </dl>
391
+
392
+
393
+
394
+
395
+
396
+
397
+
398
+
399
+
400
+
401
+ <h4 class="name" id=".escapeRegex"><span class="type-signature type-signature-static">(static) </span>escapeRegex<span class="signature">(str)</span><span class="type-signature"> &rarr; {string}</span></h4>
402
+
403
+
404
+
405
+
406
+
407
+
408
+ <dl class="details">
409
+
410
+ <dt class="tag-description">Description:</dt>
411
+ <dd class="tag-description"><ul class="dummy"><li><p>Escape a string for use in regular expressions.</p>
412
+ <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>
413
+
414
+
415
+
416
+ <dt class="tag-source">Source:</dt>
417
+ <dd class="tag-source"><ul class="dummy"><li>
418
+ <a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line60">line 60</a>
419
+ </li></ul></dd>
420
+
421
+
422
+
423
+
424
+
425
+
426
+
427
+
428
+
429
+
430
+
431
+
432
+
433
+
434
+
435
+
436
+
437
+
438
+
439
+
440
+
441
+
442
+
443
+
444
+
445
+
446
+
447
+
448
+
449
+ <dt class="tag-see">See:</dt>
450
+ <dd class="tag-see">
451
+ <ul>
452
+ <li><a href="https://stackoverflow.com/a/3561711/174985">https://stackoverflow.com/a/3561711/174985</a></li>
453
+ </ul>
454
+ </dd>
455
+
456
+
457
+
458
+ </dl>
459
+
460
+
461
+
462
+
463
+
464
+
465
+
466
+
467
+
468
+
469
+
470
+
471
+
472
+ <h5 class="h5-parameters">Parameters:</h5>
473
+
474
+
475
+ <table class="params">
476
+ <thead>
477
+ <tr>
478
+
479
+ <th>Name</th>
480
+
481
+
482
+ <th>Type</th>
483
+
484
+
485
+
486
+
487
+
488
+ <th class="last">Description</th>
489
+ </tr>
490
+ </thead>
491
+
492
+ <tbody>
493
+
494
+
495
+ <tr>
496
+
497
+ <td class="name"><code>str</code></td>
498
+
499
+
500
+ <td class="type">
501
+
502
+
503
+ <span class="param-type">string</span>
504
+
505
+
506
+
507
+
508
+ </td>
509
+
510
+
511
+
512
+
513
+
514
+ <td class="description last"><p>the string to escape.</p></td>
515
+ </tr>
516
+
517
+
518
+ </tbody>
519
+ </table>
520
+
521
+
522
+
523
+
524
+
525
+
526
+
527
+
528
+
529
+
530
+
531
+
532
+
533
+
534
+
535
+
536
+ <h5 class="h5-returns">Returns:</h5>
537
+
538
+
539
+
540
+
541
+ <dl class="param-type">
542
+ <dt>
543
+ Type
544
+ </dt>
545
+ <dd>
546
+
547
+ <span class="param-type">string</span>
548
+
549
+
550
+
551
+ </dd>
552
+ </dl>
553
+
554
+
555
+
556
+
557
+
558
+
559
+
560
+
561
+
562
+
563
+ <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"> &rarr; {string}</span></h4>
564
+
565
+
566
+
567
+
568
+
569
+
570
+ <dl class="details">
571
+
572
+ <dt class="tag-description">Description:</dt>
573
+ <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>
574
+
575
+
576
+
577
+ <dt class="tag-source">Source:</dt>
578
+ <dd class="tag-source"><ul class="dummy"><li>
579
+ <a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line138">line 138</a>
580
+ </li></ul></dd>
581
+
582
+
583
+
584
+
585
+
586
+
587
+
588
+
589
+
590
+
591
+
592
+
593
+
594
+
595
+
596
+
597
+
598
+
599
+
600
+
601
+
602
+
603
+
604
+
605
+
606
+
607
+
608
+
609
+
610
+
611
+
612
+ </dl>
613
+
614
+
615
+
616
+
617
+
618
+
619
+
620
+
621
+
622
+
623
+
624
+
625
+
626
+ <h5 class="h5-parameters">Parameters:</h5>
627
+
628
+
629
+ <table class="params">
630
+ <thead>
631
+ <tr>
632
+
633
+ <th>Name</th>
634
+
635
+
636
+ <th>Type</th>
637
+
638
+
639
+ <th>Attributes</th>
640
+
641
+
642
+
643
+
644
+ <th class="last">Description</th>
645
+ </tr>
646
+ </thead>
647
+
648
+ <tbody>
649
+
650
+
651
+ <tr>
652
+
653
+ <td class="name"><code>url</code></td>
654
+
655
+
656
+ <td class="type">
657
+
658
+
659
+ <span class="param-type">string</span>
660
+
661
+
662
+
663
+
664
+ </td>
665
+
666
+
667
+ <td class="attributes">
668
+
669
+
670
+
671
+
672
+
673
+ </td>
674
+
675
+
676
+
677
+
678
+ <td class="description last"></td>
679
+ </tr>
680
+
681
+
682
+
683
+ <tr>
684
+
685
+ <td class="name"><code>words</code></td>
686
+
687
+
688
+ <td class="type">
689
+
690
+
691
+ <span class="param-type">Array.&lt;string></span>
692
+
693
+
694
+
695
+
696
+ </td>
697
+
698
+
699
+ <td class="attributes">
700
+
701
+ &lt;optional><br>
702
+
703
+
704
+
705
+
706
+
707
+ </td>
708
+
709
+
710
+
711
+
712
+ <td class="description last"><p>a list of words with custom capitalisations to correct after title-casing.</p></td>
713
+ </tr>
714
+
715
+
716
+ </tbody>
717
+ </table>
718
+
719
+
720
+
721
+
722
+
723
+
724
+
725
+
726
+
727
+
728
+
729
+
730
+
731
+
732
+
733
+
734
+ <h5 class="h5-returns">Returns:</h5>
735
+
736
+
737
+
738
+
739
+ <dl class="param-type">
740
+ <dt>
741
+ Type
742
+ </dt>
743
+ <dd>
744
+
745
+ <span class="param-type">string</span>
746
+
747
+
748
+
749
+ </dd>
750
+ </dl>
751
+
752
+
753
+
754
+
755
+
756
+
757
+
758
+
759
+
760
+
761
+ <h4 class="name" id=".regulariseWhitespace"><span class="type-signature type-signature-static">(static) </span>regulariseWhitespace<span class="signature">(text)</span><span class="type-signature"> &rarr; {string}</span></h4>
762
+
763
+
764
+
765
+
766
+
767
+
768
+ <dl class="details">
769
+
770
+ <dt class="tag-description">Description:</dt>
771
+ <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>
772
+
773
+
774
+
775
+ <dt class="tag-source">Source:</dt>
776
+ <dd class="tag-source"><ul class="dummy"><li>
777
+ <a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line26">line 26</a>
778
+ </li></ul></dd>
779
+
780
+
781
+
782
+
783
+
784
+
785
+
786
+
787
+
788
+
789
+
790
+
791
+
792
+
793
+
794
+
795
+
796
+
797
+
798
+
799
+
800
+
801
+
802
+
803
+
804
+
805
+
806
+
807
+
808
+
809
+
810
+ </dl>
811
+
812
+
813
+
814
+
815
+
816
+
817
+
818
+
819
+
820
+
821
+
822
+
823
+
824
+ <h5 class="h5-parameters">Parameters:</h5>
825
+
826
+
827
+ <table class="params">
828
+ <thead>
829
+ <tr>
830
+
831
+ <th>Name</th>
832
+
833
+
834
+ <th>Type</th>
835
+
836
+
837
+
838
+
839
+
840
+ <th class="last">Description</th>
841
+ </tr>
842
+ </thead>
843
+
844
+ <tbody>
845
+
846
+
847
+ <tr>
848
+
849
+ <td class="name"><code>text</code></td>
850
+
851
+
852
+ <td class="type">
853
+
854
+
855
+ <span class="param-type">string</span>
856
+
857
+
858
+
859
+
860
+ </td>
861
+
862
+
863
+
864
+
865
+
866
+ <td class="description last"></td>
867
+ </tr>
868
+
869
+
870
+ </tbody>
871
+ </table>
872
+
873
+
874
+
875
+
876
+
877
+
878
+
879
+
880
+
881
+
882
+
883
+
884
+
885
+
886
+
887
+
888
+ <h5 class="h5-returns">Returns:</h5>
889
+
890
+
891
+
892
+
893
+ <dl class="param-type">
894
+ <dt>
895
+ Type
896
+ </dt>
897
+ <dd>
898
+
899
+ <span class="param-type">string</span>
900
+
901
+
902
+
903
+ </dd>
904
+ </dl>
905
+
906
+
907
+
908
+
909
+
910
+
911
+
912
+
913
+
914
+
915
+ <h4 class="name" id=".stripQueryString"><span class="type-signature type-signature-static">(static) </span>stripQueryString<span class="signature">(url)</span><span class="type-signature"> &rarr; {string}</span></h4>
916
+
917
+
918
+
919
+
920
+
921
+
922
+ <dl class="details">
923
+
924
+ <dt class="tag-description">Description:</dt>
925
+ <dd class="tag-description"><ul class="dummy"><li><p>Strip the query string from a URL.</p></li></ul></dd>
926
+
927
+
928
+
929
+ <dt class="tag-source">Source:</dt>
930
+ <dd class="tag-source"><ul class="dummy"><li>
931
+ <a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line36">line 36</a>
932
+ </li></ul></dd>
933
+
934
+
935
+
936
+
937
+
938
+
939
+
940
+
941
+
942
+
943
+
944
+
945
+
946
+
947
+
948
+
949
+
950
+
951
+
952
+
953
+
954
+
955
+
956
+
957
+
958
+
959
+
960
+
961
+
962
+
963
+
964
+ </dl>
965
+
966
+
967
+
968
+
969
+
970
+
971
+
972
+
973
+
974
+
975
+
976
+
977
+
978
+ <h5 class="h5-parameters">Parameters:</h5>
979
+
980
+
981
+ <table class="params">
982
+ <thead>
983
+ <tr>
984
+
985
+ <th>Name</th>
986
+
987
+
988
+ <th>Type</th>
989
+
990
+
991
+
992
+
993
+
994
+ <th class="last">Description</th>
995
+ </tr>
996
+ </thead>
997
+
998
+ <tbody>
999
+
1000
+
1001
+ <tr>
1002
+
1003
+ <td class="name"><code>url</code></td>
1004
+
1005
+
1006
+ <td class="type">
1007
+
1008
+
1009
+ <span class="param-type">string</span>
1010
+
1011
+
1012
+
1013
+
1014
+ </td>
1015
+
1016
+
1017
+
1018
+
1019
+
1020
+ <td class="description last"></td>
1021
+ </tr>
1022
+
1023
+
1024
+ </tbody>
1025
+ </table>
1026
+
1027
+
1028
+
1029
+
1030
+
1031
+
1032
+
1033
+
1034
+
1035
+
1036
+
1037
+
1038
+
1039
+
1040
+
1041
+
1042
+ <h5 class="h5-returns">Returns:</h5>
1043
+
1044
+
1045
+
1046
+
1047
+ <dl class="param-type">
1048
+ <dt>
1049
+ Type
1050
+ </dt>
1051
+ <dd>
1052
+
1053
+ <span class="param-type">string</span>
1054
+
1055
+
1056
+
1057
+ </dd>
1058
+ </dl>
1059
+
1060
+
1061
+
1062
+
1063
+
1064
+
1065
+
1066
+
1067
+
1068
+
1069
+ <h4 class="name" id=".stripUTMParameters"><span class="type-signature type-signature-static">(static) </span>stripUTMParameters<span class="signature">(url)</span><span class="type-signature"> &rarr; {string}</span></h4>
1070
+
1071
+
1072
+
1073
+
1074
+
1075
+
1076
+ <dl class="details">
1077
+
1078
+ <dt class="tag-description">Description:</dt>
1079
+ <dd class="tag-description"><ul class="dummy"><li><p>Remove UTM parameters from the query string in a URL.</p></li></ul></dd>
1080
+
1081
+
1082
+
1083
+ <dt class="tag-source">Source:</dt>
1084
+ <dd class="tag-source"><ul class="dummy"><li>
1085
+ <a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line47">line 47</a>
1086
+ </li></ul></dd>
1087
+
1088
+
1089
+
1090
+
1091
+
1092
+
1093
+
1094
+
1095
+
1096
+
1097
+
1098
+
1099
+
1100
+
1101
+
1102
+
1103
+
1104
+
1105
+
1106
+
1107
+
1108
+
1109
+
1110
+
1111
+
1112
+
1113
+
1114
+
1115
+
1116
+ <dt class="tag-see">See:</dt>
1117
+ <dd class="tag-see">
1118
+ <ul>
1119
+ <li><a href="https://en.wikipedia.org/wiki/UTM_parameters">https://en.wikipedia.org/wiki/UTM_parameters</a></li>
1120
+ </ul>
1121
+ </dd>
1122
+
1123
+
1124
+
1125
+ </dl>
1126
+
1127
+
1128
+
1129
+
1130
+
1131
+
1132
+
1133
+
1134
+
1135
+
1136
+
1137
+
1138
+
1139
+ <h5 class="h5-parameters">Parameters:</h5>
1140
+
1141
+
1142
+ <table class="params">
1143
+ <thead>
1144
+ <tr>
1145
+
1146
+ <th>Name</th>
1147
+
1148
+
1149
+ <th>Type</th>
1150
+
1151
+
1152
+
1153
+
1154
+
1155
+ <th class="last">Description</th>
1156
+ </tr>
1157
+ </thead>
1158
+
1159
+ <tbody>
1160
+
1161
+
1162
+ <tr>
1163
+
1164
+ <td class="name"><code>url</code></td>
1165
+
1166
+
1167
+ <td class="type">
1168
+
1169
+
1170
+ <span class="param-type">string</span>
1171
+
1172
+
1173
+
1174
+
1175
+ </td>
1176
+
1177
+
1178
+
1179
+
1180
+
1181
+ <td class="description last"></td>
1182
+ </tr>
1183
+
1184
+
1185
+ </tbody>
1186
+ </table>
1187
+
1188
+
1189
+
1190
+
1191
+
1192
+
1193
+
1194
+
1195
+
1196
+
1197
+
1198
+
1199
+
1200
+
1201
+
1202
+
1203
+ <h5 class="h5-returns">Returns:</h5>
1204
+
1205
+
1206
+
1207
+
1208
+ <dl class="param-type">
1209
+ <dt>
1210
+ Type
1211
+ </dt>
1212
+ <dd>
1213
+
1214
+ <span class="param-type">string</span>
1215
+
1216
+
1217
+
1218
+ </dd>
1219
+ </dl>
1220
+
1221
+
1222
+
1223
+
1224
+
1225
+
1226
+
1227
+
1228
+
1229
+
1230
+ <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"> &rarr; {string}</span></h4>
1231
+
1232
+
1233
+
1234
+
1235
+
1236
+
1237
+ <dl class="details">
1238
+
1239
+ <dt class="tag-description">Description:</dt>
1240
+ <dd class="tag-description"><ul class="dummy"><li><p>Convert a string to title case, with some custom capitalisations.</p></li></ul></dd>
1241
+
1242
+
1243
+
1244
+ <dt class="tag-source">Source:</dt>
1245
+ <dd class="tag-source"><ul class="dummy"><li>
1246
+ <a href="utilities.mjs.html">utilities.mjs</a>, <a href="utilities.mjs.html#line111">line 111</a>
1247
+ </li></ul></dd>
1248
+
1249
+
1250
+
1251
+
1252
+
1253
+
1254
+
1255
+
1256
+
1257
+
1258
+
1259
+
1260
+
1261
+
1262
+
1263
+
1264
+
1265
+
1266
+
1267
+
1268
+
1269
+
1270
+
1271
+
1272
+
1273
+
1274
+
1275
+
1276
+
1277
+ <dt class="tag-see">See:</dt>
1278
+ <dd class="tag-see">
1279
+ <ul>
1280
+ <li><a href="module-defaults.html#.speciallyCapitalisedWords">module:defaults.speciallyCapitalisedWords</a> for the default list of custom capitalisations.</li>
1281
+
1282
+ <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>
1283
+
1284
+ <li><a href="module-defaults.html#.smallWords">module:defaults.smallWords</a> for the additional list of small words that are preserved in lower case by the title-casing function.</li>
1285
+ </ul>
1286
+ </dd>
1287
+
1288
+
1289
+
1290
+ </dl>
1291
+
1292
+
1293
+
1294
+
1295
+
1296
+
1297
+
1298
+
1299
+
1300
+
1301
+
1302
+
1303
+
1304
+ <h5 class="h5-parameters">Parameters:</h5>
1305
+
1306
+
1307
+ <table class="params">
1308
+ <thead>
1309
+ <tr>
1310
+
1311
+ <th>Name</th>
1312
+
1313
+
1314
+ <th>Type</th>
1315
+
1316
+
1317
+ <th>Attributes</th>
1318
+
1319
+
1320
+
1321
+
1322
+ <th class="last">Description</th>
1323
+ </tr>
1324
+ </thead>
1325
+
1326
+ <tbody>
1327
+
1328
+
1329
+ <tr>
1330
+
1331
+ <td class="name"><code>str</code></td>
1332
+
1333
+
1334
+ <td class="type">
1335
+
1336
+
1337
+ <span class="param-type">string</span>
1338
+
1339
+
1340
+
1341
+
1342
+ </td>
1343
+
1344
+
1345
+ <td class="attributes">
1346
+
1347
+
1348
+
1349
+
1350
+
1351
+ </td>
1352
+
1353
+
1354
+
1355
+
1356
+ <td class="description last"><p>the string to convert to title case.</p></td>
1357
+ </tr>
1358
+
1359
+
1360
+
1361
+ <tr>
1362
+
1363
+ <td class="name"><code>words</code></td>
1364
+
1365
+
1366
+ <td class="type">
1367
+
1368
+
1369
+ <span class="param-type">Array.&lt;string></span>
1370
+
1371
+
1372
+
1373
+
1374
+ </td>
1375
+
1376
+
1377
+ <td class="attributes">
1378
+
1379
+ &lt;optional><br>
1380
+
1381
+
1382
+
1383
+
1384
+
1385
+ </td>
1386
+
1387
+
1388
+
1389
+
1390
+ <td class="description last"><p>a list of words with custom capitalisations to correct after title-casing. Defaults to the default list of custom capitalisations.</p></td>
1391
+ </tr>
1392
+
1393
+
1394
+ </tbody>
1395
+ </table>
1396
+
1397
+
1398
+
1399
+
1400
+
1401
+
1402
+
1403
+
1404
+
1405
+
1406
+
1407
+
1408
+
1409
+
1410
+
1411
+
1412
+ <h5 class="h5-returns">Returns:</h5>
1413
+
1414
+
1415
+
1416
+
1417
+ <dl class="param-type">
1418
+ <dt>
1419
+ Type
1420
+ </dt>
1421
+ <dd>
1422
+
1423
+ <span class="param-type">string</span>
1424
+
1425
+
1426
+
1427
+ </dd>
1428
+ </dl>
1429
+
1430
+
1431
+
1432
+
1433
+
1434
+
1435
+
1436
+
1437
+
1438
+
1439
+
1440
+ </article>
1441
+
1442
+ </section>
1443
+
1444
+
1445
+
1446
+
1447
+
1448
+
1449
+ </div>
1450
+
1451
+ <br class="clear">
1452
+
1453
+ <footer>
1454
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Mon Apr 13 2026 16:45:07 GMT+0100 (Irish Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
1455
+ </footer>
1456
+
1457
+ <script>prettyPrint();</script>
1458
+ <script src="scripts/polyfill.js"></script>
1459
+ <script src="scripts/linenumber.js"></script>
1460
+
1461
+ <script src="scripts/search.js" defer></script>
1462
+
1463
+
1464
+
1465
+ <link type="text/css" rel="stylesheet" href="./docdash-overrides.css">
1466
+
1467
+ </body>
1468
+ </html>