urlifyed

1.0.2 • Public • Published

URLifyed

URLifyed is a lightweight npm package that simplifies the process of extracting URLs from plain text and converting them into clickable anchor tags. Whether you're working on a blog, chat application, or any other project, URLifyed has got you covered!

Installation

Install URLifyed using npm:

npm install urlifyed

Usage

  1. Import URLifyed into your project:
const urlifyed = require('urlifyed');
  1. Extract URLs from a string:
const inputText = 'Check out this awesome website: https://example.com and also visit https://another-site.org';
const extractedUrls = urlifyed.extractUrls(inputText);
console.log(extractedUrls);
//Output: 
[
  { url: 'https://example.com', startIndex: 32, endIndex: 51 },
  { url: 'https://another-site.org', startIndex: 67, endIndex: 91 }
]
  1. Convert URLs to anchor tags:
const formattedText = urlifyed.formatWithAnchors(inputText);
console.log(formattedText);
// Output: 'Check out this awesome website: <a href="https://example.com">example.com</a> and also visit <a href="https://another-site.org">another-site.org</a>'

That’s it! URLifyed makes handling URLs a breeze. Happy coding! 🚀

Package Sidebar

Install

npm i urlifyed

Weekly Downloads

2

Version

1.0.2

License

ISC

Unpacked Size

5.17 kB

Total Files

4

Last publish

Collaborators

  • bishakhdutta