JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 192
  • Score
    100M100P100Q93099F
  • License GPL-3.0

URL/IP defanging with Javascript

Package Exports

  • defangjs
  • defangjs/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (defangjs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

defangjs

URL/IP defanging with Javascript

Coded with 💙 by edoardottt

Install ⬇️

npm install defangjs@latest

Usage 🚀

var defangjs = require('defangjs');

var url = 'https://www.edoardoottavianelli.it/index.html';

console.log(defangjs.defangUrl(url)); 
// --> hxxps[://]www[.]edoardoottavianelli[.]it/index.html

var maliciousIp = '666.666.666.666';

console.log(defangjs.defangIp(maliciousIp)); 
// --> 666[.]666[.]666[.]666

Take a look to test.js, this file contains all the supported formats (various protocols, ports, Ipv4 and Ipv6...)

Test 🧑‍🏭

npm test

Contribute 🤝

Open an issue.

License 📝

This repository is under GNU General Public License v3.0.
edoardoottavianelli.it to contact me.