
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
text-to-link
Advanced tools
text-to-link is a small JavaScript and npm module that takes a string of text, finds URLs within it, and hyperlinks them.
text-to-link adds an autoLink() method to JavaScript's String prototype, so you can use it on any JavaScript string. Take a look at the tests, but essentially, after including either autolink.js or autolink-min.js to your page, it works like this:
// Input
let textTolink = require('text-to-link')
textTolink("This is a link to Google http://google.com")
// Output
"This is a link to Google <a href='http://google.com'>http://google.com</a>"
You can pass any additional HTML attributes to the anchor tag with a JavaScript object, like this:
// Input
let textTolink = require('text-to-link')
textTolink("This is a link to Google http://google.com", { target: "_blank", rel: "nofollow", id: "1" })
// Output
"This is a link to Google <a href='http://google.com' target='_blank' rel='nofollow' id='1'>http://google.com</a>"
Callback option can be used to redefine how links will be rendered.
// Input
let textTolink = require('text-to-link')
textTolink("This is a link to Google http://google.com", {
callback: function(url) {
return /\.(gif|png|jpe?g)$/i.test(url) ? '<img src="' + url + '">' : null;
}
})
// Output
"This is a link to image <img src='http://example.com/logo.png'>"
FAQs
npm module to find URLs in a string of text and hyperlink them
The npm package text-to-link receives a total of 9 weekly downloads. As such, text-to-link popularity was classified as not popular.
We found that text-to-link demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.