@danielhaim/titlecaser 1.2.37 → 1.2.38

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.
@@ -1 +1 @@
1
- (()=>{var e={429:(e,t,r)=>{var n,o;e=r.nmd(e),n=[t,r(485),r(858)],void 0===(o=function(r,n,o){"use strict";var i;function a(e,t,r){return(t=d(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||l(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||l(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,d(n.key),n)}}function d(e){var t=function(e,t){if("object"!==f(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==f(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===f(t)?t:String(t)}Object.defineProperty(r,"__esModule",{value:!0}),t.TitleCaser=void 0,o=(i=o)&&i.__esModule?i:{default:i};var y=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options=t,this.wordReplacementsList=n.wordReplacementsList}var t,r,i;return t=e,r=[{key:"toTitleCase",value:function(e){try{if(0===e.trim().length)throw new TypeError("Invalid input: input must not be empty.");if("string"!=typeof e)throw new TypeError("Invalid input: input must be a string.");if(void 0!==this.options&&"object"!==f(this.options))throw new TypeError("Invalid options: options must be an object.");var t=this.options,r=t.style,i=void 0===r?"ap":r,a=t.neverCapitalize,s=void 0===a?[]:a,c=t.replaceTermList,p=void 0===c?n.wordReplacementsList:c,d=["nl2br"].concat(u(s)),y=o.default.getTitleCaseOptions(this.options,n.commonAbbreviationList,n.wordReplacementsList),m=(y.articlesList,y.shortConjunctionsList,y.shortPrepositionsList,y.neverCapitalizedList,y.replaceTerms,p.map((function(e){return Object.keys(e)[0].toLowerCase()}))),h=Object.fromEntries(p.map((function(e){return[Object.keys(e)[0].toLowerCase(),Object.values(e)[0]]}))),v=e.trim(),b=(v=(v=v.replace(/ {2,}/g,(function(e){return e.slice(0,1)}))).replace(/<br\s*\/?>/gi,"nl2br ")).split(" ");v=b.map((function(e,t){switch(!0){case o.default.isWordAmpersand(e):case o.default.hasHtmlBreak(e):case o.default.isWordIgnored(e,d):return e;case m.includes(e.toLowerCase()):return h[e.toLowerCase()];case o.default.isWordInArray(e,n.correctTitleCasingList):return o.default.correctTerm(e,n.correctTitleCasingList);case o.default.hasSuffix(e,i):return o.default.correctSuffix(e,n.correctTitleCasingList);case o.default.hasHyphen(e):return o.default.correctTermHyphenated(e,i);case o.default.hasUppercaseIntentional(e):return e;case o.default.isShortWord(e,i)&&0!==t:return t>0&&o.default.endsWithSymbol(b[t-1],[":","?","!","."])?e.charAt(0).toUpperCase()+e.slice(1):e.toLowerCase();case o.default.endsWithSymbol(e):var r=e.split(/([.,\/#!$%\^&\*;:{}=\-_`~()])/g).map((function(e,t){return o.default.isWordInArray(e,n.correctTitleCasingList)?o.default.correctTerm(e,n.correctTitleCasingList):(t>0&&o.default.endsWithSymbol(e),e.charAt(0).toUpperCase()+e.slice(1))}));return r.join("");case o.default.startsWithSymbol(e):return o.default.isWordInArray(e,n.correctTitleCasingList)?o.default.correctTerm(e):e;case o.default.hasRomanNumeral(e):return e.toUpperCase();case o.default.hasNumbers(e):return e;default:return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}})).join(" ");var C,w=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=l(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}(n.correctPhraseCasingList);try{for(w.s();!(C=w.n()).done;){var g=C.value;v.toLowerCase().includes(g.toLowerCase())&&(v=v.replace(new RegExp(g,"gi"),g))}}catch(e){w.e(e)}finally{w.f()}return v=v.replace(/nl2br /gi,"<br />")}catch(e){throw new Error(e)}}},{key:"setReplaceTerms",value:function(e){if("object"!==f(e))throw new TypeError("Invalid argument: replace terms must be an object.");Object.entries(e).forEach((function(e){var t=s(e,2),r=t[0],o=t[1],i=n.wordReplacementsList.findIndex((function(e){return e[r]}));-1!==i?n.wordReplacementsList[i][r]=o:n.wordReplacementsList.push(a({},r,o))})),this.options.wordReplacementsList=n.wordReplacementsList}},{key:"addReplaceTerm",value:function(e,t){if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Invalid argument: term and replacement must be strings.");var r=this.wordReplacementsList.findIndex((function(t){return t[e]}));-1!==r?this.wordReplacementsList[r][e]=t:this.wordReplacementsList.push(a({},e,t)),this.options.wordReplacementsList=this.wordReplacementsList}},{key:"removeReplaceTerm",value:function(e){if("string"!=typeof e)throw new TypeError("Invalid argument: term must be a string.");var t=this.wordReplacementsList.findIndex((function(t){return Object.keys(t)[0]===e}));if(-1===t)throw new Error("Term '".concat(e,"' not found in word replacements list."));this.wordReplacementsList.splice(t,1),this.options.wordReplacementsList=this.wordReplacementsList}},{key:"setStyle",value:function(e){if("string"!=typeof e)throw new TypeError("Invalid argument: style must be a string.");this.options.style=e}}],r&&p(t.prototype,r),i&&p(t,i),Object.defineProperty(t,"prototype",{writable:!1}),e}();t.TitleCaser=y,"object"===f(e)&&e.exports&&(e.exports={TitleCaser:y})}.apply(t,n))||(e.exports=o)},485:(e,t)=>{var r;void 0===(r=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),t.wordReplacementsList=t.titleCaseStylesList=t.titleCaseDefaultOptionsList=t.ignoredWordList=t.correctTitleCasingList=t.correctPhraseCasingList=t.commonAbbreviationList=t.allowedTitleCaseStylesList=void 0;t.commonAbbreviationList=["a","an","the","as","at","by","for","in","of","on","to","up","yet","so","but","nor","or","and"];t.correctTitleCasingList=["AJAX","CSS","DOM","ES6","HTML","JavaScript","jQuery","MobX","SCSS","TypeScript","Vue.js",".NET","ASP","ASPX","MySQL","PHP","PostgresQL","Python","SQL","GraphQL","HTML5","API","APIs","ASCII","CI","CircleCI","CLI","DLL","DNS","EC2","FTP","HTTP","HTTPs","ICMP","IDE","IP","ISP","JSON","JSP","LPWAN","M2M","MQTT","OOP","REST","SSH","SSL","TCP","UDP","URL","WLAN","WYSIWYG","XML","YAML","YML","IMAP","RSS","IaaS","PaaS","SaaS","CaaS","FaaS","XaaS","RaaS","IoE","IoT","LoRa","NB-IoT","RFID","RF","RFI","RFQ","ECMAScript","IO","I/O","DevOps","SecOps","DDoS","VoIP","AI","AR","ML","VR","w/","w/o","e-Book","e-Books","eBook","eBooks","eCommerce","eMarket","eMarketplace","eMarketplaces","eMarkets","eReader","eShop","eShops","eStore","eStores","E-commerce","AP","COGS","EBIT","EPS","FIFO","GAAP","LIFO","P&L","ROI","SOX","TCO","VAT","CAGR","DCF","ETF","IPO","IRR","M&A","NAV","PE","PEG","PPE","ROE","S&P","TVM","VC","B2B","B2C","CMO","CPA","CPC","CPL","CPM","CRM","CTA","CTR","SEO","SEM","SMM","USP","A/B","CTA","CTOR","CTR","KPI","PWA","SEM","SERP","SERPs","SMM","SMO","FAQ","FAQA","FAQS","UI","UI/UX","UX","T&C","TOS","PP","CRM","PoE","PoW","PoC","A11Y","PR","BANT","KPI","MQL","NPS","POS","SPIN","SQL","SWOT","AFA","ADR","CCPA","CFAA","CISG","DMCA","EULA","GDPR","HIPAA","NDA","SOW","TOS","CEO","CEOs","CFO","CFOs","CIO","CIOs","CMO","CMOs","COO","COOs","CPO","CPOs","CRO","CROs","CSO","CSOs","CTO","CTOs","EVP","EVPs","HR","HRs","SVP","SVPs","VP","VPs","NGO","NPO","NGOs","NPOs","UN","UNESCO","UNICEF","UNHCR","UNODC","UNDP","UNFPA","UNEP","Adobe","Airbnb","Alibaba","Allstate","American Express","Apple","AT&T","BMW","Boeing","Cisco","Citigroup","Coca","Deloitte","Disney","Dropbox","ExxonMobil","Ford","GE","General","Goldman Sachs","Google","Hilton","HP","IBM","Intel","JPMorgan","Johnson & Johnson","LinkedIn","McDonald's","Mercedes-Benz","Microsoft","Nestle","Nike","Nissan","Oracle","PepsiCo","Pfizer","Salesforce","Samsung","Shell","Sony","Tesla","Toyota","Uber","Verizon","Visa","Walmart","Wells Fargo","Yahoo","Zara","IKEA","Facebook","YouTube","Instagram","Twitter","TensorFlow","Amazon","Netflix","eBay","iPhone","iPad","iPod","PlayStation","PayPal","GitHub","GitLab","CodeIgniter","WordPress","WooCommerce","MongoDB","JIRA","HubSpot","AirDrop","AirPlay","AirPods","AirTags","FinalCut","GarageBand","iBooks","iCloud","iLife","iMac","iMessage","iMovie","iPhoto","iWatch","iWork","LogicPro","macOS","ProTools","QuickTime","AdWords","AdSense","TikTok","Slack","Trello","Zoom","Twitch","Snapchat","WhatsApp","Telegram","Discord","Reddit","Quora","StackOverflow","StackExchange","Coca-Cola","AWS","GCP","VMware","CVS","ESL","EE","NBA","NCAA","NFL","WWE","WWF","FIFA","a.m.","p.m.","ca.","cc.","fig.","pl.","pt.","rev.","sr.","v.","vol.","et al.","pp.","p.","ph.d.","m.d.","d.d.s.","d.m.d.","d.o.","d.c.","d.v.m.","d.n.p.","d.p.m.","d.s.w.","d.s.n.","d.n.sc.","d.n.a.","d.n.t.","d.n.p.t.","d.n.o.","d.n.m.","d.n.e.","d.n.s.","d.n.p.s.","adj.","adv.","cf.","cm.","co.","corp.","dept.","dist.","ed.","edn.","esp.","etc.","ex.","i.e.","e.g.","op. cit.","vs.","Ltd.","Co.","Inc.","St.","Ave.","Bldg.","No."];t.wordReplacementsList=[{"a.k.a":"AKA"},{"a.s.a.p":"ASAP"},{angularjs:"Angular.js"},{"back-end":"Backend"},{"d.i.y":"DIY"},{"e-book":"eBook"},{"e-books":"eBooks"},{"e-commerce":"eCommerce"},{ecom:"eCommerce"},{ecommerce:"eCommerce"},{"f.a.q":"FAQ"},{"f.a.q.a":"FAQs"},{"f.a.q.s":"FAQs"},{"f.y.i":"FYI"},{"front-end":"Frontend"},{"full-stack":"Fullstack"},{nextjs:"Next.js"},{nodejs:"Node.js"},{nuxtjs:"Nuxt.js"},{reactjs:"React.js"},{"t.b.d":"TBD"},{vuejs:"Vue.js"},{phd:"ph.d."}];var r=Object.freeze({AP:"ap",APA:"apa",BRITISH:"british",CHICAGO:"chicago",NYT:"nyt",WIKIPEDIA:"wikipedia"});t.titleCaseStylesList=r;var n=Object.values(r);t.allowedTitleCaseStylesList=n;var o=Object.freeze({ap:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]},apa:{shortConjunctionsList:["and","as","but","by","for","in","nor","of","on","or","so","to","yet"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","for","in","of","on","to","up","via"],neverCapitalizedList:[]},british:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]},chicago:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","for","in","of","on","to","up","with","via"],neverCapitalizedList:["etc."]},nyt:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]},wikipedia:{shortConjunctionsList:["and","as","but","for","if","nor","or","so","yet"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]}});t.titleCaseDefaultOptionsList=o;t.ignoredWordList=[];t.correctPhraseCasingList=["The Cybersmile Foundation","CO. by Colgate","The Simpsons"]}.apply(t,[t]))||(e.exports=r)},858:(e,t,r)=>{var n,o;n=[t,r(485)],void 0===(o=function(e,r){"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||l(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||l(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){p(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function u(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=l(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function f(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,d(n.key),n)}}function p(e,t,r){return(t=d(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}Object.defineProperty(e,"__esModule",{value:!0}),t.default=void 0;var y=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,a,l;return t=e,l=[{key:"validateOption",value:function(e,t){if(!Array.isArray(t))throw new TypeError("Invalid option: ".concat(e," must be an array"));if(!t.every((function(e){return"string"==typeof e})))throw new TypeError("Invalid option: ".concat(e," must be an array of strings"))}},{key:"validateOptions",value:function(e){for(var t=0,n=Object.keys(e);t<n.length;t++){var o=n[t];if("style"!==o)if("wordReplacementsList"!==o){if(!r.titleCaseDefaultOptionsList.hasOwnProperty(o))throw new TypeError("Invalid option: ".concat(o));this.TitleCaseValidator.validateOption(o,e[o])}else{if(!Array.isArray(e.wordReplacementsList))throw new TypeError("Invalid option: ".concat(o," must be an array"));var i,a=u(e.wordReplacementsList);try{for(a.s();!(i=a.n()).done;)if("string"!=typeof i.value)throw new TypeError("Invalid option: ".concat(o," must contain only strings"))}catch(e){a.e(e)}finally{a.f()}}else{if("string"!=typeof e.style)throw new TypeError("Invalid option: ".concat(o," must be a string"));if(!r.allowedTitleCaseStylesList.includes(e.style))throw new TypeError("Invalid option: ".concat(o," must be a string"))}}}},{key:"getTitleCaseOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=JSON.stringify({options:t,lowercaseWords:n});if(e.titleCaseOptionsCache.has(a))return e.titleCaseOptionsCache.get(a);var u=s(s({},r.titleCaseDefaultOptionsList[t.style||"ap"]),t),l=u.articlesList.concat(n).filter((function(e,t,r){return r.indexOf(e)===t})),c=u.shortConjunctionsList.concat(n).filter((function(e,t,r){return r.indexOf(e)===t})),f=u.shortPrepositionsList.concat(n).filter((function(e,t,r){return r.indexOf(e)===t})),p=[].concat(i((u.replaceTerms||[]).map((function(e){var t=o(e,2),r=t[0],n=t[1];return[r.toLowerCase(),n]}))),i(r.wordReplacementsList)),d={articlesList:l,shortConjunctionsList:c,shortPrepositionsList:f,neverCapitalizedList:i(u.neverCapitalizedList),replaceTerms:p};return e.titleCaseOptionsCache.set(a,d),d}},{key:"isShortConjunction",value:function(t,r){var n=i(e.getTitleCaseOptions({style:r}).shortConjunctionsList),o=t.toLowerCase();return n.includes(o)}},{key:"isArticle",value:function(t,r){return e.getTitleCaseOptions({style:r}).articlesList.includes(t.toLowerCase())}},{key:"isShortPreposition",value:function(t,r){return e.getTitleCaseOptions({style:r}).shortPrepositionsList.includes(t.toLowerCase())}},{key:"isNeverCapitalized",value:function(t,r){var n="".concat(r,"_").concat(t.toLowerCase());if(e.isNeverCapitalizedCache.has(n))return e.isNeverCapitalizedCache.get(n);var o=e.getTitleCaseOptions({style:r}).neverCapitalizedList.includes(t.toLowerCase());return e.isNeverCapitalizedCache.set(n,o),o}},{key:"isShortWord",value:function(t,o){if("string"!=typeof t)throw new TypeError("Invalid input: word must be a string. Received ".concat(n(t),"."));if(!r.allowedTitleCaseStylesList.includes(o))throw new Error("Invalid option: style must be one of ".concat(r.allowedTitleCaseStylesList.join(", "),"."));return e.isShortConjunction(t,o)||e.isArticle(t,o)||e.isShortPreposition(t,o)||e.isNeverCapitalized(t,o)}},{key:"hasNumbers",value:function(e){return/\d/.test(e)}},{key:"hasUppercaseMultiple",value:function(e){for(var t=0,r=0;r<e.length&&t<2;r++)/[A-Z]/.test(e[r])&&t++;return t>=2}},{key:"hasUppercaseIntentional",value:function(e){return/[A-Z]/.test(e.slice(1))&&/[a-z]/.test(e.slice(0,-1))}},{key:"hasSuffix",value:function(e){return e.length>"'s".length&&e.endsWith("'s")}},{key:"hasApostrophe",value:function(e){return-1!==e.indexOf("'")}},{key:"hasHyphen",value:function(e){return-1!==e.indexOf("-")||-1!==e.indexOf("–")||-1!==e.indexOf("—")}},{key:"hasRomanNumeral",value:function(e){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");return/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i.test(e)}},{key:"hasHyphenRomanNumeral",value:function(t){if("string"!=typeof t||""===t)throw new TypeError("Invalid input: word must be a non-empty string.");for(var r=t.split("-"),n=0;n<r.length;n++)if(!e.hasRomanNumeral(r[n]))return!1;return!0}},{key:"hasHtmlBreak",value:function(e){return"nl2br"===e}},{key:"hasUnicodeSymbols",value:function(e){return/[^\x00-\x7F\u00A0-\u00FF\u0100-\u017F\u0180-\u024F\u0250-\u02AF\u02B0-\u02FF\u0300-\u036F\u0370-\u03FF\u0400-\u04FF\u0500-\u052F\u0530-\u058F\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u0780-\u07BF\u07C0-\u07FF\u0800-\u083F\u0840-\u085F\u0860-\u087F\u0880-\u08AF\u08B0-\u08FF\u0900-\u097F\u0980-\u09FF\u0A00-\u0A7F\u0A80-\u0AFF\u0B00-\u0B7F\u0B80-\u0BFF\u0C00-\u0C7F\u0C80-\u0CFF\u0D00-\u0D7F\u0D80-\u0DFF\u0E00-\u0E7F\u0E80-\u0EFF\u0F00-\u0FFF]/.test(e)}},{key:"hasCurrencySymbols",value:function(e){return/[^\x00-\x7F\u00A0-\u00FF\u20AC\u20A0-\u20B9\u20BD\u20A1-\u20A2\u00A3-\u00A5\u058F\u060B\u09F2-\u09F3\u0AF1\u0BF9\u0E3F\u17DB\u20A6\u20A8\u20B1\u2113\u20AA-\u20AB\u20AA\u20AC-\u20AD\u20B9]/.test(e)}},{key:"isWordAmpersand",value:function(e){return/&amp;|&/.test(e)}},{key:"startsWithSymbol",value:function(e){if("string"!=typeof e)throw new Error("Parameter 'word' must be a string. Received '".concat(n(e),"' instead."));if(0===e.length)return!1;var t=e.charAt(0);return"#"===t||"@"===t||"."===t}},{key:"escapeSpecialCharacters",value:function(e){return e.replace(/[&<>"']/g,(function(e){switch(e){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case"'":return"&#x27;";default:return e}}))}},{key:"unescapeSpecialCharacters",value:function(e){return e.replace(/&amp;|&lt;|&gt;|&quot;|&#x27;/g,(function(e){switch(e){case"&amp;":return"&";case"&lt;":return"<";case"&gt;":return">";case"&quot;":return'"';case"&#x27;":return"'";default:return e}}))}},{key:"endsWithSymbol",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[".",",",";",":","?","!"];if("string"!=typeof e||!Array.isArray(t))throw new Error("Invalid arguments");return t.some((function(t){return e.endsWith(t)}))||t.includes(e.slice(-2))}},{key:"isWordIgnored",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.ignoredWordList;if(!Array.isArray(n))throw new TypeError("Invalid input: ignoredWords must be an array.");if("string"!=typeof e||""===e.trim())throw new TypeError("Invalid input: word must be a non-empty string.");return t=e.toLowerCase().trim(),n.includes(t)}},{key:"isWordInArray",value:function(e,t){return!!Array.isArray(t)&&t.some((function(t){return t.toLowerCase()===e.toLowerCase()}))}},{key:"replaceTerm",value:function(e,t){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");if(!t||"object"!==n(t))throw new TypeError("Invalid input: replaceTermObj must be a non-null object.");var r;if(r=e.toLowerCase(),t.hasOwnProperty(r))return t[r];if(t.hasOwnProperty(e))return t[e];var o=e.toUpperCase();return t.hasOwnProperty(o)?t[o]:e}},{key:"correctSuffix",value:function(e,t){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");if(!t||!Array.isArray(t)||t.some((function(e){return"string"!=typeof e})))throw new TypeError("Invalid input: correctTerms must be an array of strings.");if(/'s$/i.test(e)){var r=e.slice(0,-2),n=t.findIndex((function(e){return e.toLowerCase()===r.toLowerCase()}));if(n>=0){var o=t[n];return"".concat(o,"'s")}var i=r.charAt(0).toUpperCase()+r.slice(1);return"".concat(i,"'s")}return e}},{key:"correctTerm",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:/[-']/;if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");if(!t||!Array.isArray(t))throw new TypeError("Invalid input: correctTerms must be an array.");if(!("string"==typeof r||Array.isArray(r)||r instanceof RegExp))throw new TypeError("Invalid input: delimiters must be a string, an array of strings, or a regular expression.");"string"==typeof r?r=new RegExp("[".concat(r,"]")):Array.isArray(r)&&(r=new RegExp("[".concat(r.join(""),"]")));for(var n=e.split(r),o=n.length,i=function(){var e=n[a].toLowerCase(),r=t.findIndex((function(t){return t.toLowerCase()===e}));r>=0&&(n[a]=t[r])},a=0;a<o;a++)i();return n.join(r.source.charAt(0))}},{key:"correctTermHyphenated",value:function(t,n){var o=t.split("-"),i=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},a=function(e){return e.charAt(0)+e.slice(1).toLowerCase()},s={ap:function(e,t){return 0===t?i(e):a(e)},chicago:i,apa:function(t,r,o){return e.isShortWord(t,n)&&r>0&&r<o-1?t.toLowerCase():i(t)},nyt:function(e,t){return 0===t?i(e):a(e)},wikipedia:function(e,t){return 0===t?i(e):a(e)}},u=s[n]||a,l=o.map((function(e,t){if(/^(M{0,3})(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i.test(e))return e.toUpperCase();var n=e,i=e.toLowerCase(),a=r.correctTitleCasingList.findIndex((function(e){return e.toLowerCase()===i}));if(a>=0)n=r.correctTitleCasingList[a];else if(i.endsWith("'s")){var s=i.substring(0,i.length-2),l=r.correctTitleCasingList.findIndex((function(e){return e.toLowerCase()===s}));l>=0&&(n="".concat(r.correctTitleCasingList[l],"'s"))}return u(n,t,o.length)}));return l.join("-")}}],(a=null)&&f(t.prototype,a),l&&f(t,l),Object.defineProperty(t,"prototype",{writable:!1}),e}();t.default=y,p(y,"TitleCaseValidator",void 0),p(y,"titleCaseOptionsCache",new Map),p(y,"isNeverCapitalizedCache",new Map)}.apply(t,n))||(e.exports=o)},352:(e,t,r)=>{var n,o;n=[t,r(429)],void 0===(o=function(e,t){"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"TitleCaser",{enumerable:!0,get:function(){return t.TitleCaser}}),"function"!=typeof String.prototype.toTitleCase&&(String.prototype.toTitleCase=function(e){return new t.TitleCaser(e).toTitleCase(this)}),"object"===("undefined"==typeof window?"undefined":r(window))&&(window.TitleCaser=t.TitleCaser)}.apply(t,n))||(e.exports=o)}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={id:n,loaded:!1,exports:{}};return e[n](i,i.exports,r),i.loaded=!0,i.exports}r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);r(352)})();
1
+ (()=>{var e={429:(e,t,r)=>{var n,o;e=r.nmd(e),n=[t,r(485),r(858)],void 0===(o=function(r,n,o){"use strict";function i(e,t,r){return(t=f(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||u(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||u(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,t){if(e){if("string"==typeof e)return l(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,t):void 0}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,f(n.key),n)}}function f(e){var t=function(e,t){if("object"!==c(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==c(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===c(t)?t:String(t)}Object.defineProperty(r,"__esModule",{value:!0}),t.TitleCaser=void 0;var y=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options=t,this.wordReplacementsList=n.wordReplacementsList}var t,r,l;return t=e,(r=[{key:"toTitleCase",value:function(e){try{if(0===e.trim().length)throw new TypeError("Invalid input: input must not be empty.");if("string"!=typeof e)throw new TypeError("Invalid input: input must be a string.");if(void 0!==this.options&&"object"!==c(this.options))throw new TypeError("Invalid options: options must be an object.");var t=this.options,r=t.style,i=void 0===r?"ap":r,a=t.neverCapitalize,l=void 0===a?[]:a,p=t.replaceTermList,f=void 0===p?n.wordReplacementsList:p,y=["nl2br"].concat(s(l)),d=o.TitleCaserUtils.getTitleCaseOptions(this.options,n.commonAbbreviationList,n.wordReplacementsList),m=(d.articlesList,d.shortConjunctionsList,d.shortPrepositionsList,d.neverCapitalizedList,d.replaceTerms,f.map((function(e){return Object.keys(e)[0].toLowerCase()}))),C=Object.fromEntries(f.map((function(e){return[Object.keys(e)[0].toLowerCase(),Object.values(e)[0]]}))),h=e.trim(),v=(h=(h=h.replace(/ {2,}/g,(function(e){return e.slice(0,1)}))).replace(/<br\s*\/?>/gi,"nl2br ")).split(" ");h=v.map((function(e,t){switch(!0){case o.TitleCaserUtils.isWordAmpersand(e):case o.TitleCaserUtils.hasHtmlBreak(e):case o.TitleCaserUtils.isWordIgnored(e,y):return e;case m.includes(e.toLowerCase()):return C[e.toLowerCase()];case o.TitleCaserUtils.isWordInArray(e,n.correctTitleCasingList):return o.TitleCaserUtils.correctTerm(e,n.correctTitleCasingList);case o.TitleCaserUtils.hasSuffix(e,i):return o.TitleCaserUtils.correctSuffix(e,n.correctTitleCasingList);case o.TitleCaserUtils.hasHyphen(e):return o.TitleCaserUtils.correctTermHyphenated(e,i);case o.TitleCaserUtils.hasUppercaseIntentional(e):return e;case o.TitleCaserUtils.isShortWord(e,i)&&0!==t:return t>0&&o.TitleCaserUtils.endsWithSymbol(v[t-1],[":","?","!","."])?e.charAt(0).toUpperCase()+e.slice(1):e.toLowerCase();case o.TitleCaserUtils.endsWithSymbol(e):var r=e.split(/([.,\/#!$%\^&\*;:{}=\-_`~()])/g).map((function(e,t){return o.TitleCaserUtils.isWordInArray(e,n.correctTitleCasingList)?o.TitleCaserUtils.correctTerm(e,n.correctTitleCasingList):(t>0&&o.TitleCaserUtils.endsWithSymbol(e),e.charAt(0).toUpperCase()+e.slice(1))}));return r.join("");case o.TitleCaserUtils.startsWithSymbol(e):return o.TitleCaserUtils.isWordInArray(e,n.correctTitleCasingList)?o.TitleCaserUtils.correctTerm(e):e;case o.TitleCaserUtils.hasRomanNumeral(e):return e.toUpperCase();case o.TitleCaserUtils.hasNumbers(e):return e;default:return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}})).join(" ");var b,w=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=u(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}(n.correctPhraseCasingList);try{for(w.s();!(b=w.n()).done;){var g=b.value;h.toLowerCase().includes(g.toLowerCase())&&(h=h.replace(new RegExp(g,"gi"),g))}}catch(e){w.e(e)}finally{w.f()}return h=h.replace(/nl2br /gi,"<br />")}catch(e){throw new Error(e)}}},{key:"setReplaceTerms",value:function(e){if("object"!==c(e))throw new TypeError("Invalid argument: replace terms must be an object.");Object.entries(e).forEach((function(e){var t=a(e,2),r=t[0],o=t[1],s=n.wordReplacementsList.findIndex((function(e){return e[r]}));-1!==s?n.wordReplacementsList[s][r]=o:n.wordReplacementsList.push(i({},r,o))})),this.options.wordReplacementsList=n.wordReplacementsList}},{key:"addReplaceTerm",value:function(e,t){if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Invalid argument: term and replacement must be strings.");var r=this.wordReplacementsList.findIndex((function(t){return t[e]}));-1!==r?this.wordReplacementsList[r][e]=t:this.wordReplacementsList.push(i({},e,t)),this.options.wordReplacementsList=this.wordReplacementsList}},{key:"removeReplaceTerm",value:function(e){if("string"!=typeof e)throw new TypeError("Invalid argument: term must be a string.");var t=this.wordReplacementsList.findIndex((function(t){return Object.keys(t)[0]===e}));if(-1===t)throw new Error("Term '".concat(e,"' not found in word replacements list."));this.wordReplacementsList.splice(t,1),this.options.wordReplacementsList=this.wordReplacementsList}},{key:"setStyle",value:function(e){if("string"!=typeof e)throw new TypeError("Invalid argument: style must be a string.");this.options.style=e}}])&&p(t.prototype,r),l&&p(t,l),Object.defineProperty(t,"prototype",{writable:!1}),e}();t.TitleCaser=y,"object"===c(e)&&e.exports&&(e.exports={TitleCaser:y})}.apply(t,n))||(e.exports=o)},485:(e,t)=>{var r;void 0===(r=function(e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),t.wordReplacementsList=t.titleCaseStylesList=t.titleCaseDefaultOptionsList=t.ignoredWordList=t.correctTitleCasingList=t.correctPhraseCasingList=t.commonAbbreviationList=t.allowedTitleCaseStylesList=void 0;t.commonAbbreviationList=["a","an","the","as","at","by","for","in","of","on","to","up","yet","so","but","nor","or","and"];t.correctTitleCasingList=["AJAX","CSS","DOM","ES6","HTML","JavaScript","jQuery","MobX","SCSS","TypeScript","Vue.js",".NET","ASP","ASPX","MySQL","PHP","PostgresQL","Python","SQL","GraphQL","HTML5","API","APIs","ASCII","CI","CircleCI","CLI","DLL","DNS","EC2","FTP","HTTP","HTTPs","ICMP","IDE","IP","ISP","JSON","JSP","LPWAN","M2M","MQTT","OOP","REST","SSH","SSL","TCP","UDP","URL","WLAN","WYSIWYG","XML","YAML","YML","IMAP","RSS","IaaS","PaaS","SaaS","CaaS","FaaS","XaaS","RaaS","IoE","IoT","LoRa","NB-IoT","RFID","RF","RFI","RFQ","ECMAScript","IO","I/O","DevOps","SecOps","DDoS","VoIP","AI","AR","ML","VR","w/","w/o","e-Book","e-Books","eBook","eBooks","eCommerce","eMarket","eMarketplace","eMarketplaces","eMarkets","eReader","eShop","eShops","eStore","eStores","E-commerce","AP","COGS","EBIT","EPS","FIFO","GAAP","LIFO","P&L","ROI","SOX","TCO","VAT","CAGR","DCF","ETF","IPO","IRR","M&A","NAV","PE","PEG","PPE","ROE","S&P","TVM","VC","B2B","B2C","CMO","CPA","CPC","CPL","CPM","CRM","CTA","CTR","SEO","SEM","SMM","USP","A/B","CTA","CTOR","CTR","KPI","PWA","SEM","SERP","SERPs","SMM","SMO","FAQ","FAQA","FAQS","UI","UI/UX","UX","T&C","TOS","PP","CRM","PoE","PoW","PoC","A11Y","PR","BANT","KPI","MQL","NPS","POS","SPIN","SQL","SWOT","AFA","ADR","CCPA","CFAA","CISG","DMCA","EULA","GDPR","HIPAA","NDA","SOW","TOS","CEO","CEOs","CFO","CFOs","CIO","CIOs","CMO","CMOs","COO","COOs","CPO","CPOs","CRO","CROs","CSO","CSOs","CTO","CTOs","EVP","EVPs","HR","HRs","SVP","SVPs","VP","VPs","NGO","NPO","NGOs","NPOs","UN","UNESCO","UNICEF","UNHCR","UNODC","UNDP","UNFPA","UNEP","Adobe","Airbnb","Alibaba","Allstate","American Express","Apple","AT&T","BMW","Boeing","Cisco","Citigroup","Coca","Deloitte","Disney","Dropbox","ExxonMobil","Ford","GE","General","Goldman Sachs","Google","Hilton","HP","IBM","Intel","JPMorgan","Johnson & Johnson","LinkedIn","McDonald's","Mercedes-Benz","Microsoft","Nestle","Nike","Nissan","Oracle","PepsiCo","Pfizer","Salesforce","Samsung","Shell","Sony","Tesla","Toyota","Uber","Verizon","Visa","Walmart","Wells Fargo","Yahoo","Zara","IKEA","Facebook","YouTube","Instagram","Twitter","TensorFlow","Amazon","Netflix","eBay","iPhone","iPad","iPod","PlayStation","PayPal","GitHub","GitLab","CodeIgniter","WordPress","WooCommerce","MongoDB","JIRA","HubSpot","AirDrop","AirPlay","AirPods","AirTags","FinalCut","GarageBand","iBooks","iCloud","iLife","iMac","iMessage","iMovie","iPhoto","iWatch","iWork","LogicPro","macOS","ProTools","QuickTime","AdWords","AdSense","TikTok","Slack","Trello","Zoom","Twitch","Snapchat","WhatsApp","Telegram","Discord","Reddit","Quora","StackOverflow","StackExchange","Coca-Cola","AWS","GCP","VMware","CVS","ESL","EE","NBA","NCAA","NFL","WWE","WWF","FIFA","a.m.","p.m.","ca.","cc.","fig.","pl.","pt.","rev.","sr.","v.","vol.","et al.","pp.","p.","ph.d.","m.d.","d.d.s.","d.m.d.","d.o.","d.c.","d.v.m.","d.n.p.","d.p.m.","d.s.w.","d.s.n.","d.n.sc.","d.n.a.","d.n.t.","d.n.p.t.","d.n.o.","d.n.m.","d.n.e.","d.n.s.","d.n.p.s.","adj.","adv.","cf.","cm.","co.","corp.","dept.","dist.","ed.","edn.","esp.","etc.","ex.","i.e.","e.g.","op. cit.","vs.","Ltd.","Co.","Inc.","St.","Ave.","Bldg.","No."];t.wordReplacementsList=[{"a.k.a":"AKA"},{"a.s.a.p":"ASAP"},{angularjs:"Angular.js"},{"back-end":"Backend"},{"d.i.y":"DIY"},{"e-book":"eBook"},{"e-books":"eBooks"},{"e-commerce":"eCommerce"},{ecom:"eCommerce"},{ecommerce:"eCommerce"},{"f.a.q":"FAQ"},{"f.a.q.a":"FAQs"},{"f.a.q.s":"FAQs"},{"f.y.i":"FYI"},{"front-end":"Frontend"},{"full-stack":"Fullstack"},{nextjs:"Next.js"},{nodejs:"Node.js"},{nuxtjs:"Nuxt.js"},{reactjs:"React.js"},{"t.b.d":"TBD"},{vuejs:"Vue.js"},{phd:"ph.d."}];var r=Object.freeze({AP:"ap",APA:"apa",BRITISH:"british",CHICAGO:"chicago",NYT:"nyt",WIKIPEDIA:"wikipedia"});t.titleCaseStylesList=r;var n=Object.values(r);t.allowedTitleCaseStylesList=n;var o=Object.freeze({ap:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]},apa:{shortConjunctionsList:["and","as","but","by","for","in","nor","of","on","or","so","to","yet"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","for","in","of","on","to","up","via"],neverCapitalizedList:[]},british:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]},chicago:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","for","in","of","on","to","up","with","via"],neverCapitalizedList:["etc."]},nyt:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]},wikipedia:{shortConjunctionsList:["and","as","but","for","if","nor","or","so","yet"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]}});t.titleCaseDefaultOptionsList=o;t.ignoredWordList=[];t.correctPhraseCasingList=["The Cybersmile Foundation","CO. by Colgate","The Simpsons"]}.apply(t,[t]))||(e.exports=r)},858:(e,t,r)=>{var n,o;n=[t,r(485)],void 0===(o=function(e,r){"use strict";function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}function o(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,o,i,a,s=[],u=!0,l=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=i.call(r)).done)&&(s.push(n.value),s.length!==t);u=!0);}catch(e){l=!0,o=e}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw o}}return s}}(e,t)||l(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(e){return function(e){if(Array.isArray(e))return c(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||l(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){f(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function u(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=l(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function l(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(e,t):void 0}}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function p(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,y(n.key),n)}}function f(e,t,r){return(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(e){var t=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===n(t)?t:String(t)}Object.defineProperty(e,"__esModule",{value:!0}),t.TitleCaserUtils=void 0;var d=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,a,l;return t=e,l=[{key:"validateOption",value:function(e,t){if(!Array.isArray(t))throw new TypeError("Invalid option: ".concat(e," must be an array"));if(!t.every((function(e){return"string"==typeof e})))throw new TypeError("Invalid option: ".concat(e," must be an array of strings"))}},{key:"validateOptions",value:function(e){for(var t=0,n=Object.keys(e);t<n.length;t++){var o=n[t];if("style"!==o)if("wordReplacementsList"!==o){if(!r.titleCaseDefaultOptionsList.hasOwnProperty(o))throw new TypeError("Invalid option: ".concat(o));this.TitleCaseValidator.validateOption(o,e[o])}else{if(!Array.isArray(e.wordReplacementsList))throw new TypeError("Invalid option: ".concat(o," must be an array"));var i,a=u(e.wordReplacementsList);try{for(a.s();!(i=a.n()).done;)if("string"!=typeof i.value)throw new TypeError("Invalid option: ".concat(o," must contain only strings"))}catch(e){a.e(e)}finally{a.f()}}else{if("string"!=typeof e.style)throw new TypeError("Invalid option: ".concat(o," must be a string"));if(!r.allowedTitleCaseStylesList.includes(e.style))throw new TypeError("Invalid option: ".concat(o," must be a string"))}}}},{key:"getTitleCaseOptions",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],a=JSON.stringify({options:t,lowercaseWords:n});if(e.titleCaseOptionsCache.has(a))return e.titleCaseOptionsCache.get(a);var u=s(s({},r.titleCaseDefaultOptionsList[t.style||"ap"]),t),l=u.articlesList.concat(n).filter((function(e,t,r){return r.indexOf(e)===t})),c=u.shortConjunctionsList.concat(n).filter((function(e,t,r){return r.indexOf(e)===t})),p=u.shortPrepositionsList.concat(n).filter((function(e,t,r){return r.indexOf(e)===t})),f=[].concat(i((u.replaceTerms||[]).map((function(e){var t=o(e,2),r=t[0],n=t[1];return[r.toLowerCase(),n]}))),i(r.wordReplacementsList)),y={articlesList:l,shortConjunctionsList:c,shortPrepositionsList:p,neverCapitalizedList:i(u.neverCapitalizedList),replaceTerms:f};return e.titleCaseOptionsCache.set(a,y),y}},{key:"isShortConjunction",value:function(t,r){var n=i(e.getTitleCaseOptions({style:r}).shortConjunctionsList),o=t.toLowerCase();return n.includes(o)}},{key:"isArticle",value:function(t,r){return e.getTitleCaseOptions({style:r}).articlesList.includes(t.toLowerCase())}},{key:"isShortPreposition",value:function(t,r){return e.getTitleCaseOptions({style:r}).shortPrepositionsList.includes(t.toLowerCase())}},{key:"isNeverCapitalized",value:function(t,r){var n="".concat(r,"_").concat(t.toLowerCase());if(e.isNeverCapitalizedCache.has(n))return e.isNeverCapitalizedCache.get(n);var o=e.getTitleCaseOptions({style:r}).neverCapitalizedList.includes(t.toLowerCase());return e.isNeverCapitalizedCache.set(n,o),o}},{key:"isShortWord",value:function(t,o){if("string"!=typeof t)throw new TypeError("Invalid input: word must be a string. Received ".concat(n(t),"."));if(!r.allowedTitleCaseStylesList.includes(o))throw new Error("Invalid option: style must be one of ".concat(r.allowedTitleCaseStylesList.join(", "),"."));return e.isShortConjunction(t,o)||e.isArticle(t,o)||e.isShortPreposition(t,o)||e.isNeverCapitalized(t,o)}},{key:"hasNumbers",value:function(e){return/\d/.test(e)}},{key:"hasUppercaseMultiple",value:function(e){for(var t=0,r=0;r<e.length&&t<2;r++)/[A-Z]/.test(e[r])&&t++;return t>=2}},{key:"hasUppercaseIntentional",value:function(e){return/[A-Z]/.test(e.slice(1))&&/[a-z]/.test(e.slice(0,-1))}},{key:"hasSuffix",value:function(e){return e.length>"'s".length&&e.endsWith("'s")}},{key:"hasApostrophe",value:function(e){return-1!==e.indexOf("'")}},{key:"hasHyphen",value:function(e){return-1!==e.indexOf("-")||-1!==e.indexOf("–")||-1!==e.indexOf("—")}},{key:"hasRomanNumeral",value:function(e){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");return/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i.test(e)}},{key:"hasHyphenRomanNumeral",value:function(t){if("string"!=typeof t||""===t)throw new TypeError("Invalid input: word must be a non-empty string.");for(var r=t.split("-"),n=0;n<r.length;n++)if(!e.hasRomanNumeral(r[n]))return!1;return!0}},{key:"hasHtmlBreak",value:function(e){return"nl2br"===e}},{key:"hasUnicodeSymbols",value:function(e){return/[^\x00-\x7F\u00A0-\u00FF\u0100-\u017F\u0180-\u024F\u0250-\u02AF\u02B0-\u02FF\u0300-\u036F\u0370-\u03FF\u0400-\u04FF\u0500-\u052F\u0530-\u058F\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u0780-\u07BF\u07C0-\u07FF\u0800-\u083F\u0840-\u085F\u0860-\u087F\u0880-\u08AF\u08B0-\u08FF\u0900-\u097F\u0980-\u09FF\u0A00-\u0A7F\u0A80-\u0AFF\u0B00-\u0B7F\u0B80-\u0BFF\u0C00-\u0C7F\u0C80-\u0CFF\u0D00-\u0D7F\u0D80-\u0DFF\u0E00-\u0E7F\u0E80-\u0EFF\u0F00-\u0FFF]/.test(e)}},{key:"hasCurrencySymbols",value:function(e){return/[^\x00-\x7F\u00A0-\u00FF\u20AC\u20A0-\u20B9\u20BD\u20A1-\u20A2\u00A3-\u00A5\u058F\u060B\u09F2-\u09F3\u0AF1\u0BF9\u0E3F\u17DB\u20A6\u20A8\u20B1\u2113\u20AA-\u20AB\u20AA\u20AC-\u20AD\u20B9]/.test(e)}},{key:"isWordAmpersand",value:function(e){return/&amp;|&/.test(e)}},{key:"startsWithSymbol",value:function(e){if("string"!=typeof e)throw new Error("Parameter 'word' must be a string. Received '".concat(n(e),"' instead."));if(0===e.length)return!1;var t=e.charAt(0);return"#"===t||"@"===t||"."===t}},{key:"escapeSpecialCharacters",value:function(e){return e.replace(/[&<>"']/g,(function(e){switch(e){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case"'":return"&#x27;";default:return e}}))}},{key:"unescapeSpecialCharacters",value:function(e){return e.replace(/&amp;|&lt;|&gt;|&quot;|&#x27;/g,(function(e){switch(e){case"&amp;":return"&";case"&lt;":return"<";case"&gt;":return">";case"&quot;":return'"';case"&#x27;":return"'";default:return e}}))}},{key:"endsWithSymbol",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[".",",",";",":","?","!"];if("string"!=typeof e||!Array.isArray(t))throw new Error("Invalid arguments");return t.some((function(t){return e.endsWith(t)}))||t.includes(e.slice(-2))}},{key:"isWordIgnored",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.ignoredWordList;if(!Array.isArray(n))throw new TypeError("Invalid input: ignoredWords must be an array.");if("string"!=typeof e||""===e.trim())throw new TypeError("Invalid input: word must be a non-empty string.");return t=e.toLowerCase().trim(),n.includes(t)}},{key:"isWordInArray",value:function(e,t){return!!Array.isArray(t)&&t.some((function(t){return t.toLowerCase()===e.toLowerCase()}))}},{key:"replaceTerm",value:function(e,t){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");if(!t||"object"!==n(t))throw new TypeError("Invalid input: replaceTermObj must be a non-null object.");var r;if(r=e.toLowerCase(),t.hasOwnProperty(r))return t[r];if(t.hasOwnProperty(e))return t[e];var o=e.toUpperCase();return t.hasOwnProperty(o)?t[o]:e}},{key:"correctSuffix",value:function(e,t){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");if(!t||!Array.isArray(t)||t.some((function(e){return"string"!=typeof e})))throw new TypeError("Invalid input: correctTerms must be an array of strings.");if(/'s$/i.test(e)){var r=e.slice(0,-2),n=t.findIndex((function(e){return e.toLowerCase()===r.toLowerCase()}));if(n>=0){var o=t[n];return"".concat(o,"'s")}var i=r.charAt(0).toUpperCase()+r.slice(1);return"".concat(i,"'s")}return e}},{key:"correctTerm",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:/[-']/;if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");if(!t||!Array.isArray(t))throw new TypeError("Invalid input: correctTerms must be an array.");if(!("string"==typeof r||Array.isArray(r)||r instanceof RegExp))throw new TypeError("Invalid input: delimiters must be a string, an array of strings, or a regular expression.");"string"==typeof r?r=new RegExp("[".concat(r,"]")):Array.isArray(r)&&(r=new RegExp("[".concat(r.join(""),"]")));for(var n=e.split(r),o=n.length,i=function(){var e=n[a].toLowerCase(),r=t.findIndex((function(t){return t.toLowerCase()===e}));r>=0&&(n[a]=t[r])},a=0;a<o;a++)i();return n.join(r.source.charAt(0))}},{key:"correctTermHyphenated",value:function(t,n){var o=t.split("-"),i=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},a=function(e){return e.charAt(0)+e.slice(1).toLowerCase()},s={ap:function(e,t){return 0===t?i(e):a(e)},chicago:i,apa:function(t,r,o){return e.isShortWord(t,n)&&r>0&&r<o-1?t.toLowerCase():i(t)},nyt:function(e,t){return 0===t?i(e):a(e)},wikipedia:function(e,t){return 0===t?i(e):a(e)}},u=s[n]||a,l=o.map((function(e,t){if(/^(M{0,3})(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i.test(e))return e.toUpperCase();var n=e,i=e.toLowerCase(),a=r.correctTitleCasingList.findIndex((function(e){return e.toLowerCase()===i}));if(a>=0)n=r.correctTitleCasingList[a];else if(i.endsWith("'s")){var s=i.substring(0,i.length-2),l=r.correctTitleCasingList.findIndex((function(e){return e.toLowerCase()===s}));l>=0&&(n="".concat(r.correctTitleCasingList[l],"'s"))}return u(n,t,o.length)}));return l.join("-")}}],(a=null)&&p(t.prototype,a),l&&p(t,l),Object.defineProperty(t,"prototype",{writable:!1}),e}();t.TitleCaserUtils=d,f(d,"TitleCaseValidator",void 0),f(d,"titleCaseOptionsCache",new Map),f(d,"isNeverCapitalizedCache",new Map)}.apply(t,n))||(e.exports=o)},352:(e,t,r)=>{var n,o;n=[t,r(429)],void 0===(o=function(e,t){"use strict";function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"TitleCaser",{enumerable:!0,get:function(){return t.TitleCaser}}),"function"!=typeof String.prototype.toTitleCase&&(String.prototype.toTitleCase=function(e){return new t.TitleCaser(e).toTitleCase(this)}),"object"===("undefined"==typeof window?"undefined":r(window))&&(window.TitleCaser=t.TitleCaser)}.apply(t,n))||(e.exports=o)}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={id:n,loaded:!1,exports:{}};return e[n](i,i.exports,r),i.loaded=!0,i.exports}r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);r(352)})();
@@ -1 +1 @@
1
- (()=>{"use strict";var e={429:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TitleCaser=void 0;var s,i=r(485),o=(s=r(858))&&s.__esModule?s:{default:s};class a{constructor(e={}){this.options=e,this.wordReplacementsList=i.wordReplacementsList}toTitleCase(e){try{if(0===e.trim().length)throw new TypeError("Invalid input: input must not be empty.");if("string"!=typeof e)throw new TypeError("Invalid input: input must be a string.");if(void 0!==this.options&&"object"!=typeof this.options)throw new TypeError("Invalid options: options must be an object.");const{style:t="ap",neverCapitalize:r=[],replaceTermList:s=i.wordReplacementsList}=this.options,a=["nl2br",...r],{articlesList:n,shortConjunctionsList:c,shortPrepositionsList:l,neverCapitalizedList:u,replaceTerms:p}=o.default.getTitleCaseOptions(this.options,i.commonAbbreviationList,i.wordReplacementsList),d=s.map((e=>Object.keys(e)[0].toLowerCase())),C=Object.fromEntries(s.map((e=>[Object.keys(e)[0].toLowerCase(),Object.values(e)[0]])));let f=e.trim();f=f.replace(/ {2,}/g,(e=>e.slice(0,1))),f=f.replace(/<br\s*\/?>/gi,"nl2br ");const h=f.split(" ");f=h.map(((e,r)=>{switch(!0){case o.default.isWordAmpersand(e):case o.default.hasHtmlBreak(e):case o.default.isWordIgnored(e,a):return e;case d.includes(e.toLowerCase()):return C[e.toLowerCase()];case o.default.isWordInArray(e,i.correctTitleCasingList):return o.default.correctTerm(e,i.correctTitleCasingList);case o.default.hasSuffix(e,t):return o.default.correctSuffix(e,i.correctTitleCasingList);case o.default.hasHyphen(e):return o.default.correctTermHyphenated(e,t);case o.default.hasUppercaseIntentional(e):return e;case o.default.isShortWord(e,t)&&0!==r:return r>0&&o.default.endsWithSymbol(h[r-1],[":","?","!","."])?e.charAt(0).toUpperCase()+e.slice(1):e.toLowerCase();case o.default.endsWithSymbol(e):const s=e.split(/([.,\/#!$%\^&\*;:{}=\-_`~()])/g).map(((e,t)=>o.default.isWordInArray(e,i.correctTitleCasingList)?o.default.correctTerm(e,i.correctTitleCasingList):(t>0&&o.default.endsWithSymbol(e),e.charAt(0).toUpperCase()+e.slice(1))));return s.join("");case o.default.startsWithSymbol(e):return o.default.isWordInArray(e,i.correctTitleCasingList)?o.default.correctTerm(e):e;case o.default.hasRomanNumeral(e):return e.toUpperCase();case o.default.hasNumbers(e):return e;default:return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}})).join(" ");for(const e of i.correctPhraseCasingList)f.toLowerCase().includes(e.toLowerCase())&&(f=f.replace(new RegExp(e,"gi"),e));return f=f.replace(/nl2br /gi,"<br />"),f}catch(e){throw new Error(e)}}setReplaceTerms(e){if("object"!=typeof e)throw new TypeError("Invalid argument: replace terms must be an object.");Object.entries(e).forEach((([e,t])=>{const r=i.wordReplacementsList.findIndex((t=>t[e]));-1!==r?i.wordReplacementsList[r][e]=t:i.wordReplacementsList.push({[e]:t})})),this.options.wordReplacementsList=i.wordReplacementsList}addReplaceTerm(e,t){if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Invalid argument: term and replacement must be strings.");const r=this.wordReplacementsList.findIndex((t=>t[e]));-1!==r?this.wordReplacementsList[r][e]=t:this.wordReplacementsList.push({[e]:t}),this.options.wordReplacementsList=this.wordReplacementsList}removeReplaceTerm(e){if("string"!=typeof e)throw new TypeError("Invalid argument: term must be a string.");const t=this.wordReplacementsList.findIndex((t=>Object.keys(t)[0]===e));if(-1===t)throw new Error(`Term '${e}' not found in word replacements list.`);this.wordReplacementsList.splice(t,1),this.options.wordReplacementsList=this.wordReplacementsList}setStyle(e){if("string"!=typeof e)throw new TypeError("Invalid argument: style must be a string.");this.options.style=e}}t.TitleCaser=a,e.exports&&(e.exports={TitleCaser:a})},485:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.wordReplacementsList=t.titleCaseStylesList=t.titleCaseDefaultOptionsList=t.ignoredWordList=t.correctTitleCasingList=t.correctPhraseCasingList=t.commonAbbreviationList=t.allowedTitleCaseStylesList=void 0;t.commonAbbreviationList=["a","an","the","as","at","by","for","in","of","on","to","up","yet","so","but","nor","or","and"];t.correctTitleCasingList=["AJAX","CSS","DOM","ES6","HTML","JavaScript","jQuery","MobX","SCSS","TypeScript","Vue.js",".NET","ASP","ASPX","MySQL","PHP","PostgresQL","Python","SQL","GraphQL","HTML5","API","APIs","ASCII","CI","CircleCI","CLI","DLL","DNS","EC2","FTP","HTTP","HTTPs","ICMP","IDE","IP","ISP","JSON","JSP","LPWAN","M2M","MQTT","OOP","REST","SSH","SSL","TCP","UDP","URL","WLAN","WYSIWYG","XML","YAML","YML","IMAP","RSS","IaaS","PaaS","SaaS","CaaS","FaaS","XaaS","RaaS","IoE","IoT","LoRa","NB-IoT","RFID","RF","RFI","RFQ","ECMAScript","IO","I/O","DevOps","SecOps","DDoS","VoIP","AI","AR","ML","VR","w/","w/o","e-Book","e-Books","eBook","eBooks","eCommerce","eMarket","eMarketplace","eMarketplaces","eMarkets","eReader","eShop","eShops","eStore","eStores","E-commerce","AP","COGS","EBIT","EPS","FIFO","GAAP","LIFO","P&L","ROI","SOX","TCO","VAT","CAGR","DCF","ETF","IPO","IRR","M&A","NAV","PE","PEG","PPE","ROE","S&P","TVM","VC","B2B","B2C","CMO","CPA","CPC","CPL","CPM","CRM","CTA","CTR","SEO","SEM","SMM","USP","A/B","CTA","CTOR","CTR","KPI","PWA","SEM","SERP","SERPs","SMM","SMO","FAQ","FAQA","FAQS","UI","UI/UX","UX","T&C","TOS","PP","CRM","PoE","PoW","PoC","A11Y","PR","BANT","KPI","MQL","NPS","POS","SPIN","SQL","SWOT","AFA","ADR","CCPA","CFAA","CISG","DMCA","EULA","GDPR","HIPAA","NDA","SOW","TOS","CEO","CEOs","CFO","CFOs","CIO","CIOs","CMO","CMOs","COO","COOs","CPO","CPOs","CRO","CROs","CSO","CSOs","CTO","CTOs","EVP","EVPs","HR","HRs","SVP","SVPs","VP","VPs","NGO","NPO","NGOs","NPOs","UN","UNESCO","UNICEF","UNHCR","UNODC","UNDP","UNFPA","UNEP","Adobe","Airbnb","Alibaba","Allstate","American Express","Apple","AT&T","BMW","Boeing","Cisco","Citigroup","Coca","Deloitte","Disney","Dropbox","ExxonMobil","Ford","GE","General","Goldman Sachs","Google","Hilton","HP","IBM","Intel","JPMorgan","Johnson & Johnson","LinkedIn","McDonald's","Mercedes-Benz","Microsoft","Nestle","Nike","Nissan","Oracle","PepsiCo","Pfizer","Salesforce","Samsung","Shell","Sony","Tesla","Toyota","Uber","Verizon","Visa","Walmart","Wells Fargo","Yahoo","Zara","IKEA","Facebook","YouTube","Instagram","Twitter","TensorFlow","Amazon","Netflix","eBay","iPhone","iPad","iPod","PlayStation","PayPal","GitHub","GitLab","CodeIgniter","WordPress","WooCommerce","MongoDB","JIRA","HubSpot","AirDrop","AirPlay","AirPods","AirTags","FinalCut","GarageBand","iBooks","iCloud","iLife","iMac","iMessage","iMovie","iPhoto","iWatch","iWork","LogicPro","macOS","ProTools","QuickTime","AdWords","AdSense","TikTok","Slack","Trello","Zoom","Twitch","Snapchat","WhatsApp","Telegram","Discord","Reddit","Quora","StackOverflow","StackExchange","Coca-Cola","AWS","GCP","VMware","CVS","ESL","EE","NBA","NCAA","NFL","WWE","WWF","FIFA","a.m.","p.m.","ca.","cc.","fig.","pl.","pt.","rev.","sr.","v.","vol.","et al.","pp.","p.","ph.d.","m.d.","d.d.s.","d.m.d.","d.o.","d.c.","d.v.m.","d.n.p.","d.p.m.","d.s.w.","d.s.n.","d.n.sc.","d.n.a.","d.n.t.","d.n.p.t.","d.n.o.","d.n.m.","d.n.e.","d.n.s.","d.n.p.s.","adj.","adv.","cf.","cm.","co.","corp.","dept.","dist.","ed.","edn.","esp.","etc.","ex.","i.e.","e.g.","op. cit.","vs.","Ltd.","Co.","Inc.","St.","Ave.","Bldg.","No."];t.wordReplacementsList=[{"a.k.a":"AKA"},{"a.s.a.p":"ASAP"},{angularjs:"Angular.js"},{"back-end":"Backend"},{"d.i.y":"DIY"},{"e-book":"eBook"},{"e-books":"eBooks"},{"e-commerce":"eCommerce"},{ecom:"eCommerce"},{ecommerce:"eCommerce"},{"f.a.q":"FAQ"},{"f.a.q.a":"FAQs"},{"f.a.q.s":"FAQs"},{"f.y.i":"FYI"},{"front-end":"Frontend"},{"full-stack":"Fullstack"},{nextjs:"Next.js"},{nodejs:"Node.js"},{nuxtjs:"Nuxt.js"},{reactjs:"React.js"},{"t.b.d":"TBD"},{vuejs:"Vue.js"},{phd:"ph.d."}];const r=Object.freeze({AP:"ap",APA:"apa",BRITISH:"british",CHICAGO:"chicago",NYT:"nyt",WIKIPEDIA:"wikipedia"});t.titleCaseStylesList=r;const s=Object.values(r);t.allowedTitleCaseStylesList=s;const i=Object.freeze({ap:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]},apa:{shortConjunctionsList:["and","as","but","by","for","in","nor","of","on","or","so","to","yet"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","for","in","of","on","to","up","via"],neverCapitalizedList:[]},british:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]},chicago:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","for","in","of","on","to","up","with","via"],neverCapitalizedList:["etc."]},nyt:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]},wikipedia:{shortConjunctionsList:["and","as","but","for","if","nor","or","so","yet"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]}});t.titleCaseDefaultOptionsList=i;t.ignoredWordList=[];t.correctPhraseCasingList=["The Cybersmile Foundation","CO. by Colgate","The Simpsons"]},858:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var s=r(485);function i(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class o{static validateOption(e,t){if(!Array.isArray(t))throw new TypeError(`Invalid option: ${e} must be an array`);if(!t.every((e=>"string"==typeof e)))throw new TypeError(`Invalid option: ${e} must be an array of strings`)}static validateOptions(e){for(const t of Object.keys(e))if("style"!==t)if("wordReplacementsList"!==t){if(!s.titleCaseDefaultOptionsList.hasOwnProperty(t))throw new TypeError(`Invalid option: ${t}`);this.TitleCaseValidator.validateOption(t,e[t])}else{if(!Array.isArray(e.wordReplacementsList))throw new TypeError(`Invalid option: ${t} must be an array`);for(const r of e.wordReplacementsList)if("string"!=typeof r)throw new TypeError(`Invalid option: ${t} must contain only strings`)}else{if("string"!=typeof e.style)throw new TypeError(`Invalid option: ${t} must be a string`);if(!s.allowedTitleCaseStylesList.includes(e.style))throw new TypeError(`Invalid option: ${t} must be a string`)}}static getTitleCaseOptions(e={},t=[]){const r=JSON.stringify({options:e,lowercaseWords:t});if(o.titleCaseOptionsCache.has(r))return o.titleCaseOptionsCache.get(r);const i={...s.titleCaseDefaultOptionsList[e.style||"ap"],...e},a=i.articlesList.concat(t).filter(((e,t,r)=>r.indexOf(e)===t)),n=i.shortConjunctionsList.concat(t).filter(((e,t,r)=>r.indexOf(e)===t)),c=i.shortPrepositionsList.concat(t).filter(((e,t,r)=>r.indexOf(e)===t)),l=[...(i.replaceTerms||[]).map((([e,t])=>[e.toLowerCase(),t])),...s.wordReplacementsList],u={articlesList:a,shortConjunctionsList:n,shortPrepositionsList:c,neverCapitalizedList:[...i.neverCapitalizedList],replaceTerms:l};return o.titleCaseOptionsCache.set(r,u),u}static isShortConjunction(e,t){const r=[...o.getTitleCaseOptions({style:t}).shortConjunctionsList],s=e.toLowerCase();return r.includes(s)}static isArticle(e,t){return o.getTitleCaseOptions({style:t}).articlesList.includes(e.toLowerCase())}static isShortPreposition(e,t){const{shortPrepositionsList:r}=o.getTitleCaseOptions({style:t});return r.includes(e.toLowerCase())}static isNeverCapitalized(e,t){const r=`${t}_${e.toLowerCase()}`;if(o.isNeverCapitalizedCache.has(r))return o.isNeverCapitalizedCache.get(r);const{neverCapitalizedList:s}=o.getTitleCaseOptions({style:t}),i=s.includes(e.toLowerCase());return o.isNeverCapitalizedCache.set(r,i),i}static isShortWord(e,t){if("string"!=typeof e)throw new TypeError(`Invalid input: word must be a string. Received ${typeof e}.`);if(!s.allowedTitleCaseStylesList.includes(t))throw new Error(`Invalid option: style must be one of ${s.allowedTitleCaseStylesList.join(", ")}.`);return o.isShortConjunction(e,t)||o.isArticle(e,t)||o.isShortPreposition(e,t)||o.isNeverCapitalized(e,t)}static hasNumbers(e){return/\d/.test(e)}static hasUppercaseMultiple(e){let t=0;for(let r=0;r<e.length&&t<2;r++)/[A-Z]/.test(e[r])&&t++;return t>=2}static hasUppercaseIntentional(e){return/[A-Z]/.test(e.slice(1))&&/[a-z]/.test(e.slice(0,-1))}static hasSuffix(e){return e.length>"'s".length&&e.endsWith("'s")}static hasApostrophe(e){return-1!==e.indexOf("'")}static hasHyphen(e){return-1!==e.indexOf("-")||-1!==e.indexOf("–")||-1!==e.indexOf("—")}static hasRomanNumeral(e){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");return/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i.test(e)}static hasHyphenRomanNumeral(e){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");const t=e.split("-");for(let e=0;e<t.length;e++)if(!o.hasRomanNumeral(t[e]))return!1;return!0}static hasHtmlBreak(e){return"nl2br"===e}static hasUnicodeSymbols(e){return/[^\x00-\x7F\u00A0-\u00FF\u0100-\u017F\u0180-\u024F\u0250-\u02AF\u02B0-\u02FF\u0300-\u036F\u0370-\u03FF\u0400-\u04FF\u0500-\u052F\u0530-\u058F\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u0780-\u07BF\u07C0-\u07FF\u0800-\u083F\u0840-\u085F\u0860-\u087F\u0880-\u08AF\u08B0-\u08FF\u0900-\u097F\u0980-\u09FF\u0A00-\u0A7F\u0A80-\u0AFF\u0B00-\u0B7F\u0B80-\u0BFF\u0C00-\u0C7F\u0C80-\u0CFF\u0D00-\u0D7F\u0D80-\u0DFF\u0E00-\u0E7F\u0E80-\u0EFF\u0F00-\u0FFF]/.test(e)}static hasCurrencySymbols(e){return/[^\x00-\x7F\u00A0-\u00FF\u20AC\u20A0-\u20B9\u20BD\u20A1-\u20A2\u00A3-\u00A5\u058F\u060B\u09F2-\u09F3\u0AF1\u0BF9\u0E3F\u17DB\u20A6\u20A8\u20B1\u2113\u20AA-\u20AB\u20AA\u20AC-\u20AD\u20B9]/.test(e)}static isWordAmpersand(e){return/&amp;|&/.test(e)}static startsWithSymbol(e){if("string"!=typeof e)throw new Error(`Parameter 'word' must be a string. Received '${typeof e}' instead.`);if(0===e.length)return!1;const t=e.charAt(0);return"#"===t||"@"===t||"."===t}static escapeSpecialCharacters(e){return e.replace(/[&<>"']/g,(function(e){switch(e){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case"'":return"&#x27;";default:return e}}))}static unescapeSpecialCharacters(e){return e.replace(/&amp;|&lt;|&gt;|&quot;|&#x27;/g,(function(e){switch(e){case"&amp;":return"&";case"&lt;":return"<";case"&gt;":return">";case"&quot;":return'"';case"&#x27;":return"'";default:return e}}))}static endsWithSymbol(e,t=[".",",",";",":","?","!"]){if("string"!=typeof e||!Array.isArray(t))throw new Error("Invalid arguments");return t.some((t=>e.endsWith(t)))||t.includes(e.slice(-2))}static isWordIgnored(e,t=s.ignoredWordList){if(!Array.isArray(t))throw new TypeError("Invalid input: ignoredWords must be an array.");if("string"!=typeof e||""===e.trim())throw new TypeError("Invalid input: word must be a non-empty string.");let r;return r=e.toLowerCase().trim(),t.includes(r)}static isWordInArray(e,t){return!!Array.isArray(t)&&t.some((t=>t.toLowerCase()===e.toLowerCase()))}static replaceTerm(e,t){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");if(!t||"object"!=typeof t)throw new TypeError("Invalid input: replaceTermObj must be a non-null object.");let r;if(r=e.toLowerCase(),t.hasOwnProperty(r))return t[r];if(t.hasOwnProperty(e))return t[e];const s=e.toUpperCase();return t.hasOwnProperty(s)?t[s]:e}static correctSuffix(e,t){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");if(!t||!Array.isArray(t)||t.some((e=>"string"!=typeof e)))throw new TypeError("Invalid input: correctTerms must be an array of strings.");if(/'s$/i.test(e)){const r=e.slice(0,-2),s=t.findIndex((e=>e.toLowerCase()===r.toLowerCase()));if(s>=0){return`${t[s]}'s`}return`${r.charAt(0).toUpperCase()+r.slice(1)}'s`}return e}static correctTerm(e,t,r=/[-']/){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");if(!t||!Array.isArray(t))throw new TypeError("Invalid input: correctTerms must be an array.");if(!("string"==typeof r||Array.isArray(r)||r instanceof RegExp))throw new TypeError("Invalid input: delimiters must be a string, an array of strings, or a regular expression.");"string"==typeof r?r=new RegExp(`[${r}]`):Array.isArray(r)&&(r=new RegExp(`[${r.join("")}]`));const s=e.split(r),i=s.length;for(let e=0;e<i;e++){const r=s[e].toLowerCase(),i=t.findIndex((e=>e.toLowerCase()===r));i>=0&&(s[e]=t[i])}return s.join(r.source.charAt(0))}static correctTermHyphenated(e,t){const r=e.split("-"),i=e=>e.charAt(0).toUpperCase()+e.slice(1),a=e=>e.charAt(0)+e.slice(1).toLowerCase(),n={ap:(e,t)=>0===t?i(e):a(e),chicago:i,apa:(e,r,s)=>o.isShortWord(e,t)&&r>0&&r<s-1?e.toLowerCase():i(e),nyt:(e,t)=>0===t?i(e):a(e),wikipedia:(e,t)=>0===t?i(e):a(e)},c=n[t]||a,l=r.map(((e,t)=>{if(/^(M{0,3})(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i.test(e))return e.toUpperCase();let i=e;const o=e.toLowerCase(),a=s.correctTitleCasingList.findIndex((e=>e.toLowerCase()===o));if(a>=0)i=s.correctTitleCasingList[a];else if(o.endsWith("'s")){const e=o.substring(0,o.length-2),t=s.correctTitleCasingList.findIndex((t=>t.toLowerCase()===e));t>=0&&(i=`${s.correctTitleCasingList[t]}'s`)}return c(i,t,r.length)}));return l.join("-")}}t.default=o,i(o,"TitleCaseValidator",void 0),i(o,"titleCaseOptionsCache",new Map),i(o,"isNeverCapitalizedCache",new Map)}},t={};function r(s){var i=t[s];if(void 0!==i)return i.exports;var o=t[s]={exports:{}};return e[s](o,o.exports,r),o.exports}var s={};(()=>{var e=s;Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"TitleCaser",{enumerable:!0,get:function(){return t.TitleCaser}});var t=r(429);"function"!=typeof String.prototype.toTitleCase&&(String.prototype.toTitleCase=function(e){return new t.TitleCaser(e).toTitleCase(this)}),"object"==typeof window&&(window.TitleCaser=t.TitleCaser)})(),module.exports=s})();
1
+ (()=>{"use strict";var e={429:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TitleCaser=void 0;var s=r(485),i=r(858);class o{constructor(e={}){this.options=e,this.wordReplacementsList=s.wordReplacementsList}toTitleCase(e){try{if(0===e.trim().length)throw new TypeError("Invalid input: input must not be empty.");if("string"!=typeof e)throw new TypeError("Invalid input: input must be a string.");if(void 0!==this.options&&"object"!=typeof this.options)throw new TypeError("Invalid options: options must be an object.");const{style:t="ap",neverCapitalize:r=[],replaceTermList:o=s.wordReplacementsList}=this.options,a=["nl2br",...r],{articlesList:n,shortConjunctionsList:l,shortPrepositionsList:c,neverCapitalizedList:u,replaceTerms:p}=i.TitleCaserUtils.getTitleCaseOptions(this.options,s.commonAbbreviationList,s.wordReplacementsList),d=o.map((e=>Object.keys(e)[0].toLowerCase())),C=Object.fromEntries(o.map((e=>[Object.keys(e)[0].toLowerCase(),Object.values(e)[0]])));let h=e.trim();h=h.replace(/ {2,}/g,(e=>e.slice(0,1))),h=h.replace(/<br\s*\/?>/gi,"nl2br ");const m=h.split(" ");h=m.map(((e,r)=>{switch(!0){case i.TitleCaserUtils.isWordAmpersand(e):case i.TitleCaserUtils.hasHtmlBreak(e):case i.TitleCaserUtils.isWordIgnored(e,a):return e;case d.includes(e.toLowerCase()):return C[e.toLowerCase()];case i.TitleCaserUtils.isWordInArray(e,s.correctTitleCasingList):return i.TitleCaserUtils.correctTerm(e,s.correctTitleCasingList);case i.TitleCaserUtils.hasSuffix(e,t):return i.TitleCaserUtils.correctSuffix(e,s.correctTitleCasingList);case i.TitleCaserUtils.hasHyphen(e):return i.TitleCaserUtils.correctTermHyphenated(e,t);case i.TitleCaserUtils.hasUppercaseIntentional(e):return e;case i.TitleCaserUtils.isShortWord(e,t)&&0!==r:return r>0&&i.TitleCaserUtils.endsWithSymbol(m[r-1],[":","?","!","."])?e.charAt(0).toUpperCase()+e.slice(1):e.toLowerCase();case i.TitleCaserUtils.endsWithSymbol(e):const o=e.split(/([.,\/#!$%\^&\*;:{}=\-_`~()])/g).map(((e,t)=>i.TitleCaserUtils.isWordInArray(e,s.correctTitleCasingList)?i.TitleCaserUtils.correctTerm(e,s.correctTitleCasingList):(t>0&&i.TitleCaserUtils.endsWithSymbol(e),e.charAt(0).toUpperCase()+e.slice(1))));return o.join("");case i.TitleCaserUtils.startsWithSymbol(e):return i.TitleCaserUtils.isWordInArray(e,s.correctTitleCasingList)?i.TitleCaserUtils.correctTerm(e):e;case i.TitleCaserUtils.hasRomanNumeral(e):return e.toUpperCase();case i.TitleCaserUtils.hasNumbers(e):return e;default:return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}})).join(" ");for(const e of s.correctPhraseCasingList)h.toLowerCase().includes(e.toLowerCase())&&(h=h.replace(new RegExp(e,"gi"),e));return h=h.replace(/nl2br /gi,"<br />"),h}catch(e){throw new Error(e)}}setReplaceTerms(e){if("object"!=typeof e)throw new TypeError("Invalid argument: replace terms must be an object.");Object.entries(e).forEach((([e,t])=>{const r=s.wordReplacementsList.findIndex((t=>t[e]));-1!==r?s.wordReplacementsList[r][e]=t:s.wordReplacementsList.push({[e]:t})})),this.options.wordReplacementsList=s.wordReplacementsList}addReplaceTerm(e,t){if("string"!=typeof e||"string"!=typeof t)throw new TypeError("Invalid argument: term and replacement must be strings.");const r=this.wordReplacementsList.findIndex((t=>t[e]));-1!==r?this.wordReplacementsList[r][e]=t:this.wordReplacementsList.push({[e]:t}),this.options.wordReplacementsList=this.wordReplacementsList}removeReplaceTerm(e){if("string"!=typeof e)throw new TypeError("Invalid argument: term must be a string.");const t=this.wordReplacementsList.findIndex((t=>Object.keys(t)[0]===e));if(-1===t)throw new Error(`Term '${e}' not found in word replacements list.`);this.wordReplacementsList.splice(t,1),this.options.wordReplacementsList=this.wordReplacementsList}setStyle(e){if("string"!=typeof e)throw new TypeError("Invalid argument: style must be a string.");this.options.style=e}}t.TitleCaser=o,e.exports&&(e.exports={TitleCaser:o})},485:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.wordReplacementsList=t.titleCaseStylesList=t.titleCaseDefaultOptionsList=t.ignoredWordList=t.correctTitleCasingList=t.correctPhraseCasingList=t.commonAbbreviationList=t.allowedTitleCaseStylesList=void 0;t.commonAbbreviationList=["a","an","the","as","at","by","for","in","of","on","to","up","yet","so","but","nor","or","and"];t.correctTitleCasingList=["AJAX","CSS","DOM","ES6","HTML","JavaScript","jQuery","MobX","SCSS","TypeScript","Vue.js",".NET","ASP","ASPX","MySQL","PHP","PostgresQL","Python","SQL","GraphQL","HTML5","API","APIs","ASCII","CI","CircleCI","CLI","DLL","DNS","EC2","FTP","HTTP","HTTPs","ICMP","IDE","IP","ISP","JSON","JSP","LPWAN","M2M","MQTT","OOP","REST","SSH","SSL","TCP","UDP","URL","WLAN","WYSIWYG","XML","YAML","YML","IMAP","RSS","IaaS","PaaS","SaaS","CaaS","FaaS","XaaS","RaaS","IoE","IoT","LoRa","NB-IoT","RFID","RF","RFI","RFQ","ECMAScript","IO","I/O","DevOps","SecOps","DDoS","VoIP","AI","AR","ML","VR","w/","w/o","e-Book","e-Books","eBook","eBooks","eCommerce","eMarket","eMarketplace","eMarketplaces","eMarkets","eReader","eShop","eShops","eStore","eStores","E-commerce","AP","COGS","EBIT","EPS","FIFO","GAAP","LIFO","P&L","ROI","SOX","TCO","VAT","CAGR","DCF","ETF","IPO","IRR","M&A","NAV","PE","PEG","PPE","ROE","S&P","TVM","VC","B2B","B2C","CMO","CPA","CPC","CPL","CPM","CRM","CTA","CTR","SEO","SEM","SMM","USP","A/B","CTA","CTOR","CTR","KPI","PWA","SEM","SERP","SERPs","SMM","SMO","FAQ","FAQA","FAQS","UI","UI/UX","UX","T&C","TOS","PP","CRM","PoE","PoW","PoC","A11Y","PR","BANT","KPI","MQL","NPS","POS","SPIN","SQL","SWOT","AFA","ADR","CCPA","CFAA","CISG","DMCA","EULA","GDPR","HIPAA","NDA","SOW","TOS","CEO","CEOs","CFO","CFOs","CIO","CIOs","CMO","CMOs","COO","COOs","CPO","CPOs","CRO","CROs","CSO","CSOs","CTO","CTOs","EVP","EVPs","HR","HRs","SVP","SVPs","VP","VPs","NGO","NPO","NGOs","NPOs","UN","UNESCO","UNICEF","UNHCR","UNODC","UNDP","UNFPA","UNEP","Adobe","Airbnb","Alibaba","Allstate","American Express","Apple","AT&T","BMW","Boeing","Cisco","Citigroup","Coca","Deloitte","Disney","Dropbox","ExxonMobil","Ford","GE","General","Goldman Sachs","Google","Hilton","HP","IBM","Intel","JPMorgan","Johnson & Johnson","LinkedIn","McDonald's","Mercedes-Benz","Microsoft","Nestle","Nike","Nissan","Oracle","PepsiCo","Pfizer","Salesforce","Samsung","Shell","Sony","Tesla","Toyota","Uber","Verizon","Visa","Walmart","Wells Fargo","Yahoo","Zara","IKEA","Facebook","YouTube","Instagram","Twitter","TensorFlow","Amazon","Netflix","eBay","iPhone","iPad","iPod","PlayStation","PayPal","GitHub","GitLab","CodeIgniter","WordPress","WooCommerce","MongoDB","JIRA","HubSpot","AirDrop","AirPlay","AirPods","AirTags","FinalCut","GarageBand","iBooks","iCloud","iLife","iMac","iMessage","iMovie","iPhoto","iWatch","iWork","LogicPro","macOS","ProTools","QuickTime","AdWords","AdSense","TikTok","Slack","Trello","Zoom","Twitch","Snapchat","WhatsApp","Telegram","Discord","Reddit","Quora","StackOverflow","StackExchange","Coca-Cola","AWS","GCP","VMware","CVS","ESL","EE","NBA","NCAA","NFL","WWE","WWF","FIFA","a.m.","p.m.","ca.","cc.","fig.","pl.","pt.","rev.","sr.","v.","vol.","et al.","pp.","p.","ph.d.","m.d.","d.d.s.","d.m.d.","d.o.","d.c.","d.v.m.","d.n.p.","d.p.m.","d.s.w.","d.s.n.","d.n.sc.","d.n.a.","d.n.t.","d.n.p.t.","d.n.o.","d.n.m.","d.n.e.","d.n.s.","d.n.p.s.","adj.","adv.","cf.","cm.","co.","corp.","dept.","dist.","ed.","edn.","esp.","etc.","ex.","i.e.","e.g.","op. cit.","vs.","Ltd.","Co.","Inc.","St.","Ave.","Bldg.","No."];t.wordReplacementsList=[{"a.k.a":"AKA"},{"a.s.a.p":"ASAP"},{angularjs:"Angular.js"},{"back-end":"Backend"},{"d.i.y":"DIY"},{"e-book":"eBook"},{"e-books":"eBooks"},{"e-commerce":"eCommerce"},{ecom:"eCommerce"},{ecommerce:"eCommerce"},{"f.a.q":"FAQ"},{"f.a.q.a":"FAQs"},{"f.a.q.s":"FAQs"},{"f.y.i":"FYI"},{"front-end":"Frontend"},{"full-stack":"Fullstack"},{nextjs:"Next.js"},{nodejs:"Node.js"},{nuxtjs:"Nuxt.js"},{reactjs:"React.js"},{"t.b.d":"TBD"},{vuejs:"Vue.js"},{phd:"ph.d."}];const r=Object.freeze({AP:"ap",APA:"apa",BRITISH:"british",CHICAGO:"chicago",NYT:"nyt",WIKIPEDIA:"wikipedia"});t.titleCaseStylesList=r;const s=Object.values(r);t.allowedTitleCaseStylesList=s;const i=Object.freeze({ap:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]},apa:{shortConjunctionsList:["and","as","but","by","for","in","nor","of","on","or","so","to","yet"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","for","in","of","on","to","up","via"],neverCapitalizedList:[]},british:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]},chicago:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","for","in","of","on","to","up","with","via"],neverCapitalizedList:["etc."]},nyt:{shortConjunctionsList:["and","but","or","for","nor","yet","so"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]},wikipedia:{shortConjunctionsList:["and","as","but","for","if","nor","or","so","yet"],articlesList:["a","an","the"],shortPrepositionsList:["as","at","by","in","of","on","to","up","via"],neverCapitalizedList:[]}});t.titleCaseDefaultOptionsList=i;t.ignoredWordList=[];t.correctPhraseCasingList=["The Cybersmile Foundation","CO. by Colgate","The Simpsons"]},858:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TitleCaserUtils=void 0;var s=r(485);function i(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var s=r.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class o{static validateOption(e,t){if(!Array.isArray(t))throw new TypeError(`Invalid option: ${e} must be an array`);if(!t.every((e=>"string"==typeof e)))throw new TypeError(`Invalid option: ${e} must be an array of strings`)}static validateOptions(e){for(const t of Object.keys(e))if("style"!==t)if("wordReplacementsList"!==t){if(!s.titleCaseDefaultOptionsList.hasOwnProperty(t))throw new TypeError(`Invalid option: ${t}`);this.TitleCaseValidator.validateOption(t,e[t])}else{if(!Array.isArray(e.wordReplacementsList))throw new TypeError(`Invalid option: ${t} must be an array`);for(const r of e.wordReplacementsList)if("string"!=typeof r)throw new TypeError(`Invalid option: ${t} must contain only strings`)}else{if("string"!=typeof e.style)throw new TypeError(`Invalid option: ${t} must be a string`);if(!s.allowedTitleCaseStylesList.includes(e.style))throw new TypeError(`Invalid option: ${t} must be a string`)}}static getTitleCaseOptions(e={},t=[]){const r=JSON.stringify({options:e,lowercaseWords:t});if(o.titleCaseOptionsCache.has(r))return o.titleCaseOptionsCache.get(r);const i={...s.titleCaseDefaultOptionsList[e.style||"ap"],...e},a=i.articlesList.concat(t).filter(((e,t,r)=>r.indexOf(e)===t)),n=i.shortConjunctionsList.concat(t).filter(((e,t,r)=>r.indexOf(e)===t)),l=i.shortPrepositionsList.concat(t).filter(((e,t,r)=>r.indexOf(e)===t)),c=[...(i.replaceTerms||[]).map((([e,t])=>[e.toLowerCase(),t])),...s.wordReplacementsList],u={articlesList:a,shortConjunctionsList:n,shortPrepositionsList:l,neverCapitalizedList:[...i.neverCapitalizedList],replaceTerms:c};return o.titleCaseOptionsCache.set(r,u),u}static isShortConjunction(e,t){const r=[...o.getTitleCaseOptions({style:t}).shortConjunctionsList],s=e.toLowerCase();return r.includes(s)}static isArticle(e,t){return o.getTitleCaseOptions({style:t}).articlesList.includes(e.toLowerCase())}static isShortPreposition(e,t){const{shortPrepositionsList:r}=o.getTitleCaseOptions({style:t});return r.includes(e.toLowerCase())}static isNeverCapitalized(e,t){const r=`${t}_${e.toLowerCase()}`;if(o.isNeverCapitalizedCache.has(r))return o.isNeverCapitalizedCache.get(r);const{neverCapitalizedList:s}=o.getTitleCaseOptions({style:t}),i=s.includes(e.toLowerCase());return o.isNeverCapitalizedCache.set(r,i),i}static isShortWord(e,t){if("string"!=typeof e)throw new TypeError(`Invalid input: word must be a string. Received ${typeof e}.`);if(!s.allowedTitleCaseStylesList.includes(t))throw new Error(`Invalid option: style must be one of ${s.allowedTitleCaseStylesList.join(", ")}.`);return o.isShortConjunction(e,t)||o.isArticle(e,t)||o.isShortPreposition(e,t)||o.isNeverCapitalized(e,t)}static hasNumbers(e){return/\d/.test(e)}static hasUppercaseMultiple(e){let t=0;for(let r=0;r<e.length&&t<2;r++)/[A-Z]/.test(e[r])&&t++;return t>=2}static hasUppercaseIntentional(e){return/[A-Z]/.test(e.slice(1))&&/[a-z]/.test(e.slice(0,-1))}static hasSuffix(e){return e.length>"'s".length&&e.endsWith("'s")}static hasApostrophe(e){return-1!==e.indexOf("'")}static hasHyphen(e){return-1!==e.indexOf("-")||-1!==e.indexOf("–")||-1!==e.indexOf("—")}static hasRomanNumeral(e){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");return/^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i.test(e)}static hasHyphenRomanNumeral(e){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");const t=e.split("-");for(let e=0;e<t.length;e++)if(!o.hasRomanNumeral(t[e]))return!1;return!0}static hasHtmlBreak(e){return"nl2br"===e}static hasUnicodeSymbols(e){return/[^\x00-\x7F\u00A0-\u00FF\u0100-\u017F\u0180-\u024F\u0250-\u02AF\u02B0-\u02FF\u0300-\u036F\u0370-\u03FF\u0400-\u04FF\u0500-\u052F\u0530-\u058F\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u0780-\u07BF\u07C0-\u07FF\u0800-\u083F\u0840-\u085F\u0860-\u087F\u0880-\u08AF\u08B0-\u08FF\u0900-\u097F\u0980-\u09FF\u0A00-\u0A7F\u0A80-\u0AFF\u0B00-\u0B7F\u0B80-\u0BFF\u0C00-\u0C7F\u0C80-\u0CFF\u0D00-\u0D7F\u0D80-\u0DFF\u0E00-\u0E7F\u0E80-\u0EFF\u0F00-\u0FFF]/.test(e)}static hasCurrencySymbols(e){return/[^\x00-\x7F\u00A0-\u00FF\u20AC\u20A0-\u20B9\u20BD\u20A1-\u20A2\u00A3-\u00A5\u058F\u060B\u09F2-\u09F3\u0AF1\u0BF9\u0E3F\u17DB\u20A6\u20A8\u20B1\u2113\u20AA-\u20AB\u20AA\u20AC-\u20AD\u20B9]/.test(e)}static isWordAmpersand(e){return/&amp;|&/.test(e)}static startsWithSymbol(e){if("string"!=typeof e)throw new Error(`Parameter 'word' must be a string. Received '${typeof e}' instead.`);if(0===e.length)return!1;const t=e.charAt(0);return"#"===t||"@"===t||"."===t}static escapeSpecialCharacters(e){return e.replace(/[&<>"']/g,(function(e){switch(e){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case"'":return"&#x27;";default:return e}}))}static unescapeSpecialCharacters(e){return e.replace(/&amp;|&lt;|&gt;|&quot;|&#x27;/g,(function(e){switch(e){case"&amp;":return"&";case"&lt;":return"<";case"&gt;":return">";case"&quot;":return'"';case"&#x27;":return"'";default:return e}}))}static endsWithSymbol(e,t=[".",",",";",":","?","!"]){if("string"!=typeof e||!Array.isArray(t))throw new Error("Invalid arguments");return t.some((t=>e.endsWith(t)))||t.includes(e.slice(-2))}static isWordIgnored(e,t=s.ignoredWordList){if(!Array.isArray(t))throw new TypeError("Invalid input: ignoredWords must be an array.");if("string"!=typeof e||""===e.trim())throw new TypeError("Invalid input: word must be a non-empty string.");let r;return r=e.toLowerCase().trim(),t.includes(r)}static isWordInArray(e,t){return!!Array.isArray(t)&&t.some((t=>t.toLowerCase()===e.toLowerCase()))}static replaceTerm(e,t){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");if(!t||"object"!=typeof t)throw new TypeError("Invalid input: replaceTermObj must be a non-null object.");let r;if(r=e.toLowerCase(),t.hasOwnProperty(r))return t[r];if(t.hasOwnProperty(e))return t[e];const s=e.toUpperCase();return t.hasOwnProperty(s)?t[s]:e}static correctSuffix(e,t){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");if(!t||!Array.isArray(t)||t.some((e=>"string"!=typeof e)))throw new TypeError("Invalid input: correctTerms must be an array of strings.");if(/'s$/i.test(e)){const r=e.slice(0,-2),s=t.findIndex((e=>e.toLowerCase()===r.toLowerCase()));if(s>=0){return`${t[s]}'s`}return`${r.charAt(0).toUpperCase()+r.slice(1)}'s`}return e}static correctTerm(e,t,r=/[-']/){if("string"!=typeof e||""===e)throw new TypeError("Invalid input: word must be a non-empty string.");if(!t||!Array.isArray(t))throw new TypeError("Invalid input: correctTerms must be an array.");if(!("string"==typeof r||Array.isArray(r)||r instanceof RegExp))throw new TypeError("Invalid input: delimiters must be a string, an array of strings, or a regular expression.");"string"==typeof r?r=new RegExp(`[${r}]`):Array.isArray(r)&&(r=new RegExp(`[${r.join("")}]`));const s=e.split(r),i=s.length;for(let e=0;e<i;e++){const r=s[e].toLowerCase(),i=t.findIndex((e=>e.toLowerCase()===r));i>=0&&(s[e]=t[i])}return s.join(r.source.charAt(0))}static correctTermHyphenated(e,t){const r=e.split("-"),i=e=>e.charAt(0).toUpperCase()+e.slice(1),a=e=>e.charAt(0)+e.slice(1).toLowerCase(),n={ap:(e,t)=>0===t?i(e):a(e),chicago:i,apa:(e,r,s)=>o.isShortWord(e,t)&&r>0&&r<s-1?e.toLowerCase():i(e),nyt:(e,t)=>0===t?i(e):a(e),wikipedia:(e,t)=>0===t?i(e):a(e)},l=n[t]||a,c=r.map(((e,t)=>{if(/^(M{0,3})(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i.test(e))return e.toUpperCase();let i=e;const o=e.toLowerCase(),a=s.correctTitleCasingList.findIndex((e=>e.toLowerCase()===o));if(a>=0)i=s.correctTitleCasingList[a];else if(o.endsWith("'s")){const e=o.substring(0,o.length-2),t=s.correctTitleCasingList.findIndex((t=>t.toLowerCase()===e));t>=0&&(i=`${s.correctTitleCasingList[t]}'s`)}return l(i,t,r.length)}));return c.join("-")}}t.TitleCaserUtils=o,i(o,"TitleCaseValidator",void 0),i(o,"titleCaseOptionsCache",new Map),i(o,"isNeverCapitalizedCache",new Map)}},t={};function r(s){var i=t[s];if(void 0!==i)return i.exports;var o=t[s]={exports:{}};return e[s](o,o.exports,r),o.exports}var s={};(()=>{var e=s;Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"TitleCaser",{enumerable:!0,get:function(){return t.TitleCaser}});var t=r(429);"function"!=typeof String.prototype.toTitleCase&&(String.prototype.toTitleCase=function(e){return new t.TitleCaser(e).toTitleCase(this)}),"object"==typeof window&&(window.TitleCaser=t.TitleCaser)})(),module.exports=s})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielhaim/titlecaser",
3
- "version": "1.2.37",
3
+ "version": "1.2.38",
4
4
  "description": "Converts a string to title case with multiple style options, ability to ignore certain words, and handle acronyms",
5
5
  "keywords": [
6
6
  "title case",
@@ -40,10 +40,10 @@
40
40
  "LICENSE",
41
41
  "README.md",
42
42
  "package.json",
43
- "src/index.js",
44
- "src/TitleCaser.js",
45
43
  "src/TitleCaserConsts.js",
46
- "src/TitleCaseUtils.js",
44
+ "src/TitleCaserUtils.js",
45
+ "src/TitleCaser.js",
46
+ "src/index.js",
47
47
  "dist/titlecaser.min.js",
48
48
  "dist/titlecaser.amd.js"
49
49
  ],
package/src/TitleCaser.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  }
7
7
  from "./TitleCaserConsts.js";
8
8
 
9
- import TitleCaserUtils from "./TitleCaserUtils.js";
9
+ import { TitleCaserUtils } from "./TitleCaserUtils.js";
10
10
 
11
11
  export class TitleCaser {
12
12
  constructor (options = {}) {
@@ -0,0 +1,569 @@
1
+ import {
2
+ allowedTitleCaseStylesList,
3
+ titleCaseDefaultOptionsList,
4
+ wordReplacementsList,
5
+ correctTitleCasingList,
6
+ ignoredWordList,
7
+ } from "./TitleCaserConsts.js";
8
+
9
+ export class TitleCaserUtils {
10
+
11
+ // Validate the option key
12
+ static validateOption(key, value) {
13
+ // Check if value is an array
14
+ if (!Array.isArray(value)) {
15
+ throw new TypeError(`Invalid option: ${key} must be an array`);
16
+ }
17
+
18
+ // Check if all values in the array are strings
19
+ if (!value.every((word) => typeof word === "string")) {
20
+ throw new TypeError(`Invalid option: ${key} must be an array of strings`);
21
+ }
22
+ }
23
+
24
+ // Validate the option object
25
+ static TitleCaseValidator;
26
+ static validateOptions(options) {
27
+ for (const key of Object.keys(options)) {
28
+
29
+ if (key === 'style') {
30
+ if (typeof options.style !== 'string') {
31
+ throw new TypeError(`Invalid option: ${key} must be a string`);
32
+ } else if (!allowedTitleCaseStylesList.includes(options.style)) {
33
+ throw new TypeError(`Invalid option: ${key} must be a string`);
34
+ }
35
+ continue;
36
+ }
37
+
38
+ if (key === 'wordReplacementsList') {
39
+ if (!Array.isArray(options.wordReplacementsList)) {
40
+ throw new TypeError(`Invalid option: ${key} must be an array`);
41
+ } else {
42
+ for (const term of options.wordReplacementsList) {
43
+ if (typeof term !== 'string') {
44
+ throw new TypeError(`Invalid option: ${key} must contain only strings`);
45
+ }
46
+ }
47
+ }
48
+ continue;
49
+ }
50
+
51
+ if (!titleCaseDefaultOptionsList.hasOwnProperty(key)) {
52
+ throw new TypeError(`Invalid option: ${key}`);
53
+ }
54
+
55
+ this.TitleCaseValidator.validateOption(key, options[key]);
56
+ }
57
+ }
58
+
59
+ static titleCaseOptionsCache = new Map();
60
+ static getTitleCaseOptions(options = {}, lowercaseWords = []) {
61
+ // Create a unique key for the cache that combines the options and the lowercase words
62
+ const cacheKey = JSON.stringify({
63
+ options,
64
+ lowercaseWords
65
+ });
66
+
67
+ // If the cache already has an entry for this key, return the cached options
68
+ if (TitleCaserUtils.titleCaseOptionsCache.has(cacheKey)) {
69
+ return TitleCaserUtils.titleCaseOptionsCache.get(cacheKey);
70
+ }
71
+
72
+ // Merge the default options with the user-provided options
73
+ const mergedOptions = {
74
+ ...titleCaseDefaultOptionsList[options.style || "ap"],
75
+ ...options
76
+ };
77
+
78
+ // Merge the default articles with user-provided articles and lowercase words
79
+ const mergedArticles = mergedOptions.articlesList.concat(lowercaseWords)
80
+ .filter((word, index, array) => array.indexOf(word) === index);
81
+
82
+ // Merge the default short conjunctions with user-provided conjunctions and lowercase words
83
+ const mergedShortConjunctions = mergedOptions.shortConjunctionsList.concat(lowercaseWords)
84
+ .filter((word, index, array) => array.indexOf(word) === index);
85
+
86
+ // Merge the default short prepositions with user-provided prepositions and lowercase words
87
+ const mergedShortPrepositions = mergedOptions.shortPrepositionsList.concat(lowercaseWords)
88
+ .filter((word, index, array) => array.indexOf(word) === index);
89
+
90
+ // Merge the default word replacements with the user-provided replacements
91
+ const mergedReplaceTerms = [
92
+ ...(mergedOptions.replaceTerms || [])
93
+ .map(([key, value]) => [key.toLowerCase(), value]),
94
+ ...wordReplacementsList,
95
+ ];
96
+
97
+ // Return the merged options
98
+ const result = {
99
+ articlesList: mergedArticles,
100
+ shortConjunctionsList: mergedShortConjunctions,
101
+ shortPrepositionsList: mergedShortPrepositions,
102
+ neverCapitalizedList: [...mergedOptions.neverCapitalizedList],
103
+ replaceTerms: mergedReplaceTerms,
104
+ };
105
+
106
+ // Add the merged options to the cache and return them
107
+ TitleCaserUtils.titleCaseOptionsCache.set(cacheKey, result);
108
+ return result;
109
+ }
110
+
111
+ static isNeverCapitalizedCache = new Map();
112
+
113
+ // Check if the word is a short conjunction
114
+ static isShortConjunction(word, style) {
115
+ // Get the list of short conjunctions from the TitleCaseHelper
116
+ const shortConjunctionsList = [...TitleCaserUtils.getTitleCaseOptions({
117
+ style: style
118
+ })
119
+ .shortConjunctionsList
120
+ ];
121
+
122
+ // Convert the word to lowercase
123
+ const wordLowerCase = word.toLowerCase();
124
+
125
+ // Return true if the word is in the list of short conjunctions
126
+ return shortConjunctionsList.includes(wordLowerCase);
127
+ }
128
+
129
+ // Check if the word is an article
130
+ static isArticle(word, style) {
131
+ // Get the list of articles for the language
132
+ const articlesList = TitleCaserUtils.getTitleCaseOptions({
133
+ style: style
134
+ })
135
+ .articlesList;
136
+ // Return true if the word matches an article
137
+ return articlesList.includes(word.toLowerCase());
138
+ }
139
+
140
+ // Check if the word is a short preposition
141
+ static isShortPreposition(word, style) {
142
+ // Get the list of short prepositions from the Title Case Helper.
143
+ const {
144
+ shortPrepositionsList
145
+ } = TitleCaserUtils.getTitleCaseOptions({
146
+ style: style
147
+ });
148
+ // Check if the word is in the list of short prepositions.
149
+ return shortPrepositionsList.includes(word.toLowerCase());
150
+ }
151
+
152
+ // This function is only ever called once per word per style, since the result is cached.
153
+ // The cache key is a combination of the style and the lowercase word.
154
+ static isNeverCapitalized(word, style) {
155
+ // Check if the word is in the cache. If it is, return it.
156
+ const cacheKey = `${style}_${word.toLowerCase()}`;
157
+ if (TitleCaserUtils.isNeverCapitalizedCache.has(cacheKey)) {
158
+ return TitleCaserUtils.isNeverCapitalizedCache.get(cacheKey);
159
+ }
160
+
161
+ // If the word is not in the cache, then check if it is in the word list for the given style.
162
+ const {
163
+ neverCapitalizedList
164
+ } = TitleCaserUtils.getTitleCaseOptions({
165
+ style
166
+ });
167
+
168
+ const result = neverCapitalizedList.includes(word.toLowerCase());
169
+ // Store the result in the cache so it can be used again
170
+ TitleCaserUtils.isNeverCapitalizedCache.set(cacheKey, result);
171
+
172
+ return result;
173
+ }
174
+
175
+ static isShortWord(word, style) {
176
+ // If the word is not a string, throw a TypeError.
177
+ if (typeof word !== "string") {
178
+ throw new TypeError(`Invalid input: word must be a string. Received ${typeof word}.`);
179
+ }
180
+
181
+ // If the style is not one of the allowed styles, throw an Error.
182
+ if (!allowedTitleCaseStylesList.includes(style)) {
183
+ throw new Error(`Invalid option: style must be one of ${allowedTitleCaseStylesList.join(", ")}.`);
184
+ }
185
+
186
+ // If the word is a short conjunction, article, preposition, or is in the never-capitalized list, return true.
187
+ // Otherwise, return false.
188
+ return TitleCaserUtils.isShortConjunction(word, style) ||
189
+ TitleCaserUtils.isArticle(word, style) ||
190
+ TitleCaserUtils.isShortPreposition(word, style) ||
191
+ TitleCaserUtils.isNeverCapitalized(word, style);
192
+ }
193
+
194
+ // Check if a word has a number
195
+ static hasNumbers(word) {
196
+ return /\d/.test(word);
197
+ }
198
+
199
+ // Check if a word has multiple uppercase letters
200
+ static hasUppercaseMultiple(word) {
201
+ // initialize count to 0
202
+ let count = 0;
203
+ // loop through each character of the word
204
+ for (let i = 0; i < word.length && count < 2; i++) {
205
+ // if the character is an uppercase letter
206
+ if (/[A-Z]/.test(word[i])) {
207
+ // increment count by 1
208
+ count++;
209
+ }
210
+ }
211
+ // return true if count is greater or equal to 2, false otherwise
212
+ return count >= 2;
213
+ }
214
+
215
+ // Check if a word has an intentional uppercase letter
216
+ // (i.e. not the first letter of the word)
217
+ static hasUppercaseIntentional(word) {
218
+ // Only check for uppercase letters after the first letter
219
+ // and only check for lowercase letters before the last letter
220
+ return /[A-Z]/.test(word.slice(1)) && /[a-z]/.test(word.slice(0, -1));
221
+ }
222
+
223
+ // Check if a word has a suffix
224
+ static hasSuffix(word) {
225
+ // Test if word is longer than suffix
226
+ const suffix = "'s";
227
+ // Test if word ends with suffix
228
+ return word.length > suffix.length && word.endsWith(suffix);
229
+ }
230
+
231
+ // Check if a word has an apostrophe
232
+ static hasApostrophe(word) {
233
+ return word.indexOf("'") !== -1;
234
+ }
235
+
236
+ // Check if a word has a hyphen
237
+ static hasHyphen(word) {
238
+ return word.indexOf('-') !== -1 || word.indexOf('–') !== -1 || word.indexOf('—') !== -1;
239
+ }
240
+
241
+ // Check if a word is a Roman numeral
242
+ static hasRomanNumeral(word) {
243
+ // Check if the input is a string
244
+ if (typeof word !== 'string' || word === '') {
245
+ // Throw an error if the input is not a string
246
+ throw new TypeError('Invalid input: word must be a non-empty string.');
247
+ }
248
+
249
+ // Define a regular expression that matches a roman numeral
250
+ const romanNumeralRegex = /^M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i;
251
+ // Check if the input word matches the regular expression
252
+ return romanNumeralRegex.test(word);
253
+ }
254
+
255
+ // Check if a word is a hyphenated Roman numeral
256
+ static hasHyphenRomanNumeral(word) {
257
+ if (typeof word !== "string" || word === "") {
258
+ throw new TypeError("Invalid input: word must be a non-empty string.");
259
+ }
260
+
261
+ const parts = word.split("-");
262
+ for (let i = 0; i < parts.length; i++) {
263
+ if (!TitleCaserUtils.hasRomanNumeral(parts[i])) {
264
+ return false;
265
+ }
266
+ }
267
+ return true;
268
+ }
269
+
270
+ // Check if a word has `nl2br` in it
271
+ static hasHtmlBreak(word) {
272
+ return word === "nl2br";
273
+ }
274
+
275
+ // Check if a string has Unicode symbols.
276
+ static hasUnicodeSymbols(str) {
277
+ return /[^\x00-\x7F\u00A0-\u00FF\u0100-\u017F\u0180-\u024F\u0250-\u02AF\u02B0-\u02FF\u0300-\u036F\u0370-\u03FF\u0400-\u04FF\u0500-\u052F\u0530-\u058F\u0590-\u05FF\u0600-\u06FF\u0700-\u074F\u0750-\u077F\u0780-\u07BF\u07C0-\u07FF\u0800-\u083F\u0840-\u085F\u0860-\u087F\u0880-\u08AF\u08B0-\u08FF\u0900-\u097F\u0980-\u09FF\u0A00-\u0A7F\u0A80-\u0AFF\u0B00-\u0B7F\u0B80-\u0BFF\u0C00-\u0C7F\u0C80-\u0CFF\u0D00-\u0D7F\u0D80-\u0DFF\u0E00-\u0E7F\u0E80-\u0EFF\u0F00-\u0FFF]/.test(str);
278
+ }
279
+
280
+ // Checks whether a string contains any currency symbols
281
+ static hasCurrencySymbols(str) {
282
+ return /[^\x00-\x7F\u00A0-\u00FF\u20AC\u20A0-\u20B9\u20BD\u20A1-\u20A2\u00A3-\u00A5\u058F\u060B\u09F2-\u09F3\u0AF1\u0BF9\u0E3F\u17DB\u20A6\u20A8\u20B1\u2113\u20AA-\u20AB\u20AA\u20AC-\u20AD\u20B9]/.test(str);
283
+ }
284
+
285
+ // Check if a word is ampersand
286
+ static isWordAmpersand(str) {
287
+ return /&amp;|&/.test(str);
288
+ }
289
+
290
+
291
+ // Check if a word starts with a symbol
292
+ static startsWithSymbol(word) {
293
+ if (typeof word !== 'string') {
294
+ throw new Error(`Parameter 'word' must be a string. Received '${typeof word}' instead.`);
295
+ }
296
+
297
+ if (word.length === 0) {
298
+ return false;
299
+ }
300
+
301
+ const firstChar = word.charAt(0);
302
+
303
+ return (
304
+ firstChar === '#' ||
305
+ firstChar === '@' ||
306
+ firstChar === '.'
307
+ );
308
+ }
309
+
310
+ static escapeSpecialCharacters(str) {
311
+ return str.replace(/[&<>"']/g, function (match) {
312
+ switch (match) {
313
+ case "&":
314
+ return "&amp;";
315
+ case "<":
316
+ return "&lt;";
317
+ case ">":
318
+ return "&gt;";
319
+ case '"':
320
+ return "&quot;";
321
+ case "'":
322
+ return "&#x27;";
323
+ default:
324
+ return match;
325
+ }
326
+ });
327
+ }
328
+
329
+ static unescapeSpecialCharacters(str) {
330
+ return str.replace(/&amp;|&lt;|&gt;|&quot;|&#x27;/g, function (match) {
331
+ switch (match) {
332
+ case "&amp;":
333
+ return "&";
334
+ case "&lt;":
335
+ return "<";
336
+ case "&gt;":
337
+ return ">";
338
+ case "&quot;":
339
+ return '"';
340
+ case "&#x27;":
341
+ return "'";
342
+ default:
343
+ return match;
344
+ }
345
+ });
346
+ }
347
+
348
+
349
+ // Check if a word ends with a symbol
350
+ static endsWithSymbol(word, symbols = [".", ",", ";", ":", "?", "!"]) {
351
+ // Check if the word is a string and the symbols is an array
352
+ if (typeof word !== "string" || !Array.isArray(symbols))
353
+ throw new Error("Invalid arguments");
354
+ // Check if the word ends with a symbol or two symbols
355
+ return symbols.some(symbol => word.endsWith(symbol)) || symbols.includes(word.slice(-2));
356
+ }
357
+
358
+ // This function accepts two arguments: a word and an array of ignored words.
359
+ static isWordIgnored(word, ignoredWords = ignoredWordList) {
360
+ // If the ignoredWords argument is not an array, throw an error.
361
+ if (!Array.isArray(ignoredWords)) {
362
+ throw new TypeError("Invalid input: ignoredWords must be an array.");
363
+ }
364
+
365
+ // If the word argument is not a non-empty string, throw an error.
366
+ if (typeof word !== "string" || word.trim() === "") {
367
+ throw new TypeError("Invalid input: word must be a non-empty string.");
368
+ }
369
+
370
+ // Convert the word to lowercase and trim any space.
371
+ let lowercasedWord;
372
+ lowercasedWord = word.toLowerCase()
373
+ .trim();
374
+
375
+ // If the word is in the ignoredWords array, return true. Otherwise, return false.
376
+ return ignoredWords.includes(lowercasedWord);
377
+ }
378
+
379
+ // Check if the wordList is a valid array
380
+ static isWordInArray(targetWord, wordList) {
381
+ if (!Array.isArray(wordList)) {
382
+ return false;
383
+ }
384
+
385
+ // Check if the targetWord is in the wordList
386
+ return wordList.some((word) => word.toLowerCase() === targetWord.toLowerCase());
387
+ }
388
+
389
+ // This function is used to replace a word with a term in the replaceTerms object
390
+ static replaceTerm(word, replaceTermObj) {
391
+ // Validate input
392
+ if (typeof word !== "string" || word === "") {
393
+ throw new TypeError("Invalid input: word must be a non-empty string.");
394
+ }
395
+
396
+ if (!replaceTermObj || typeof replaceTermObj !== "object") {
397
+ throw new TypeError("Invalid input: replaceTermObj must be a non-null object.");
398
+ }
399
+
400
+ // Convert the word to lowercase
401
+ let lowercasedWord;
402
+ lowercasedWord = word.toLowerCase();
403
+
404
+ // Check if the word is in the object with lowercase key
405
+ if (replaceTermObj.hasOwnProperty(lowercasedWord)) {
406
+ return replaceTermObj[lowercasedWord];
407
+ }
408
+
409
+ // Check if the word is in the object with original case key
410
+ if (replaceTermObj.hasOwnProperty(word)) {
411
+ return replaceTermObj[word];
412
+ }
413
+
414
+ // Check if the word is in the object with uppercase key
415
+ const uppercasedWord = word.toUpperCase();
416
+ if (replaceTermObj.hasOwnProperty(uppercasedWord)) {
417
+ return replaceTermObj[uppercasedWord];
418
+ }
419
+
420
+ // If the word is not in the object, return the original word
421
+ return word;
422
+ }
423
+
424
+ // This function is used to check if a suffix is present in a word that is in the correct terms list
425
+ static correctSuffix(word, correctTerms) {
426
+ // Validate input
427
+ if (typeof word !== "string" || word === "") {
428
+ throw new TypeError("Invalid input: word must be a non-empty string.");
429
+ }
430
+
431
+ if (!correctTerms || !Array.isArray(correctTerms) || correctTerms.some((term) => typeof term !== "string")) {
432
+ throw new TypeError("Invalid input: correctTerms must be an array of strings.");
433
+ }
434
+
435
+ // Define the regular expression for the suffix
436
+ const suffixRegex = /'s$/i;
437
+
438
+ // If the word ends with the suffix
439
+ if (suffixRegex.test(word)) {
440
+ // Remove the suffix from the word
441
+ const wordWithoutSuffix = word.slice(0, -2);
442
+ // Check if the word without the suffix matches any of the correct terms
443
+ const matchingIndex = correctTerms.findIndex((term) => term.toLowerCase() === wordWithoutSuffix.toLowerCase());
444
+
445
+ if (matchingIndex >= 0) {
446
+ // If it does, return the correct term with the suffix
447
+ const correctCase = correctTerms[matchingIndex];
448
+ return `${correctCase}'s`;
449
+ } else {
450
+ // If not, capitalize the first letter and append the suffix
451
+ const capitalizedWord = wordWithoutSuffix.charAt(0).toUpperCase() + wordWithoutSuffix.slice(1);
452
+ return `${capitalizedWord}'s`;
453
+ }
454
+ }
455
+
456
+ // If the word doesn't end with the suffix, return the word as-is
457
+ return word;
458
+ }
459
+
460
+ // This function is used to check if a word is in the correct terms list
461
+ static correctTerm(word, correctTerms, delimiters = /[-']/) {
462
+ // Validate input
463
+ if (typeof word !== "string" || word === "") {
464
+ throw new TypeError("Invalid input: word must be a non-empty string.");
465
+ }
466
+
467
+ if (!correctTerms || !Array.isArray(correctTerms)) {
468
+ throw new TypeError("Invalid input: correctTerms must be an array.");
469
+ }
470
+
471
+ if (typeof delimiters !== "string" && !Array.isArray(delimiters) && !(delimiters instanceof RegExp)) {
472
+ throw new TypeError("Invalid input: delimiters must be a string, an array of strings, or a regular expression.");
473
+ }
474
+
475
+ // Convert delimiters to a regular expression if it is a string or an array
476
+ if (typeof delimiters === "string") {
477
+ delimiters = new RegExp(`[${delimiters}]`);
478
+ } else if (Array.isArray(delimiters)) {
479
+ delimiters = new RegExp(`[${delimiters.join("")}]`);
480
+ }
481
+
482
+ // Split the word into parts delimited by the specified delimiters
483
+ const parts = word.split(delimiters);
484
+ // Count the number of parts
485
+ const numParts = parts.length;
486
+
487
+ // For each part
488
+ for (let i = 0; i < numParts; i++) {
489
+ // Lowercase the part
490
+ const lowercasedPart = parts[i].toLowerCase();
491
+ // Search for the part in the list of correct terms
492
+ const index = correctTerms.findIndex((t) => t.toLowerCase() === lowercasedPart);
493
+ // If the part is found in the list of correct terms
494
+ if (index >= 0) {
495
+ // Replace the part with the correct term
496
+ parts[i] = correctTerms[index];
497
+ }
498
+ }
499
+
500
+ // Join the parts back together using the first delimiter as the default delimiter
501
+ return parts.join(delimiters.source.charAt(0));
502
+ }
503
+
504
+ // This function is used to check if a word is in the correct terms list
505
+ static correctTermHyphenated(word, style) {
506
+ // Split the word into an array of words
507
+ const hyphenatedWords = word.split("-");
508
+
509
+ // Define functions to process words
510
+ const capitalizeFirst = (word) => word.charAt(0)
511
+ .toUpperCase() + word.slice(1);
512
+ const lowercaseRest = (word) => word.charAt(0) + word.slice(1)
513
+ .toLowerCase();
514
+
515
+ // Define the style-specific processing functions
516
+ const styleFunctions = {
517
+ ap: (word, index) => (index === 0 ? capitalizeFirst(word) : lowercaseRest(word)),
518
+ chicago: capitalizeFirst,
519
+ apa: (word, index, length) => {
520
+ if (TitleCaserUtils.isShortWord(word, style) && index > 0 && index < length - 1) {
521
+ return word.toLowerCase();
522
+ }
523
+ else {
524
+ return capitalizeFirst(word);
525
+ }
526
+ },
527
+ nyt: (word, index) => (index === 0 ? capitalizeFirst(word) : lowercaseRest(word)),
528
+ wikipedia: (word, index) => (index === 0 ? capitalizeFirst(word) : lowercaseRest(word)),
529
+ };
530
+
531
+ // Get the style-specific processing function
532
+ const processWord = styleFunctions[style] || lowercaseRest;
533
+
534
+ // Process each word
535
+ const processedWords = hyphenatedWords.map((word, i) => {
536
+
537
+ // Check if the word is a Roman numeral
538
+ const romanNumeralRegex = /^(M{0,3})(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i;
539
+ if (romanNumeralRegex.test(word)) {
540
+ return word.toUpperCase();
541
+ }
542
+
543
+ // Preserve the original word
544
+ let correctedWord = word;
545
+
546
+ // Check if the word is in the list of words to preserve
547
+ const lowerCaseWord = word.toLowerCase();
548
+ const uniqueTermsIndex = correctTitleCasingList.findIndex((w) => w.toLowerCase() === lowerCaseWord);
549
+ if (uniqueTermsIndex >= 0) {
550
+ correctedWord = correctTitleCasingList[uniqueTermsIndex];
551
+ }
552
+ // Check if the word is a possessive form
553
+ else if (lowerCaseWord.endsWith("'s")) {
554
+ const rootWord = lowerCaseWord.substring(0, lowerCaseWord.length - 2);
555
+ const rootWordIndex = correctTitleCasingList.findIndex((w) => w.toLowerCase() === rootWord);
556
+ if (rootWordIndex >= 0) {
557
+ correctedWord = `${correctTitleCasingList[rootWordIndex]}'s`;
558
+ }
559
+ }
560
+
561
+ // Process the word
562
+ return processWord(correctedWord, i, hyphenatedWords.length);
563
+ });
564
+
565
+ // Rejoin the words
566
+ return processedWords.join("-");
567
+ }
568
+
569
+ }