npm i select-link
or using yarn:
yarn add select-link
import format from 'select-link';
const text = format(
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, https://google.com sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.'
);
console.log(text);
// Lorem ipsum dolor sit amet, consectetur adipiscing elit, <a href="https://google.com">https://google.com</a> sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.