Defang and fang your dangerous URLs, IPs and emails! No dependencies, you only get the dentist.
$ npm install defang-refang
import dr from "./defangrefang";
dr.defang("http://dr.evils.lair/");
=> "hXXp://dr[.]evils[.]lair/"
dr.refang("'192[.]168[.]1[.]0'");
=> "192.168.1.0"
Handles the following:
- Emails
- IPv4
- URLs
- Prefixes
- ftp
- http
- https
- ssh
Argument | Defanged |
---|---|
faust@evil.com | faust[at]evil[.]com |
192.168.1.1 | 192[.]168[.]1[.]1 |
https://totally.legit.com | hXXps://totally[.]legit[.]com |