@petitchevalroux/canonical-url

1.0.0 • Public • Published

node-url-canonical

Generate canonical url resolved from redirect and removing tracking parameters

Getting canonical url

const canonicalUrl = new (require("@petitchevalroux/canonical-url"));
canonicalUrl.get("http://google.com").then(url=>console.log(url)); // https://www.google.com
canonicalUrl.get("https://bit.ly/1bdDlXc").then(url=>console.log(url)); // https://www.google.com

Getting canonical hash

const canonicalUrl = new (require("@petitchevalroux/canonical-url"));
canonicalUrl.getHash("http://google.com").then(hash=>console.log(url)); // d4c9d9027326271a89ce51fcaf328ed673f17be33469ff979e8ab8dd501e664f
canonicalUrl.getHash("https://www.google.com").then(hash=>console.log(url));  // d4c9d9027326271a89ce51fcaf328ed673f17be33469ff979e8ab8dd501e664f
canonicalUrl.getHash("https://bit.ly/1bdDlXc").then(hash=>console.log(url));  // d4c9d9027326271a89ce51fcaf328ed673f17be33469ff979e8ab8dd501e664f

Readme

Keywords

none

Package Sidebar

Install

npm i @petitchevalroux/canonical-url

Weekly Downloads

2

Version

1.0.0

License

GPL-3.0

Unpacked Size

14.1 kB

Total Files

12

Last publish

Collaborators

  • petitchevalroux