🦇 defangle
Defangle is a Gleam library for defanging URLs, Emails, and IP addresses making them safe to share.
📥 Install defangle
gleam add defangle
⚡ Usage
import defangle
pub fn main() {
// Defang a URL, email, or IP address to make it safe to share
"https://www.suspicious-url.com"
|> defangle.defang
// "hxxps[://]www[.]suspicious-url[.]com"
// Defang a URL to make it safe to share
"https://www.suspicious-url.com"
|> defangle.defang_url
// "hxxps[://]www[.]suspicious-url[.]com"
// Defang an email address to make it safe to share
"lucy@malicious.gleam"
|> defangle.defang_email
// "lucy[at]suspicious-url[.]com"
// Defang an IPv4 address to make it safe to share. Doesn't support IPv6 yet.
"103.253.144.32"
|> defangle.defang_ip
// "103[.]253[.]144[.]32"
}
Further documentation can be found at https://hexdocs.pm/defangle.
Development
gleam run # Run the project
gleam test # Run the tests
gleam shell # Run an Erlang shell