UNPKG

@nexusui/components

Version:

These are custom components specially-developed for NexusUI applications. They will make your life easier by giving you out-of-the-box implementations for various high-level UI elements that you can drop directly into your application.

2 lines (1 loc) 536 B
const t=/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-_]*)?\??(?:[-+=&;%@.\w_]*)#?(?:[\w]*))?)/,e=e=>"https://"===e||t.test(e),l=t=>{if("link"!==t.type&&"autolink"!==t.type||(null===t.target&&(t.target="_blank"),null===t.title&&(t.title=t.url)),t.children&&t.children.length>0)for(let e=0;e<t.children.length;e++)l(t.children[e])},n=t=>{const e=JSON.parse(JSON.stringify(t));return l(e.root),e};export{n as convertNodes,l as traverseAndModifyLinks,e as validateUrl};