Socket
Socket
Sign inDemoInstall

slugify-url

Package Overview
Dependencies
0
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.1 to 1.2.0

10

index.js

@@ -56,2 +56,12 @@ "use strict";

}
/* replace multiple occurences of the slashChar with just one */
if (options.slashChar.length > 0) {
sanitized = sanitized.replace(new RegExp('['+options.slashChar+']{2,}','g'),options.slashChar);
}
/* make sure we don't leave any slashChar in the end*/
if (options.slashChar.length > 0) {
sanitized = sanitized.replace(new RegExp('['+options.slashChar+']$'),'');
}

@@ -58,0 +68,0 @@ /* truncate to max length */

2

package.json

@@ -11,3 +11,3 @@ {

],
"version": "1.1.1",
"version": "1.2.0",
"repository": {

@@ -14,0 +14,0 @@ "type": "git",

@@ -15,2 +15,4 @@ Converts urls to simplified strings

- Unless a unixOnly option is given it maps all windows invalid chars to !
- It collapses multiple !'s to a single !
- It omits ending !'s
- It truncates the URL to 100 chars

@@ -17,0 +19,0 @@ - It includes an optional options argument that allows the user to override the behavior

@@ -23,4 +23,4 @@ /*

test("test if slugify-url skips protocol and username/password", function (t) {
t.equal(slugify_url("https://www.odesk.com/mc/"), "www.odesk.com!mc!");
t.equal(slugify_url("https://www.odesk.com/mc/", {skipProtocol: false}), "https!!!www.odesk.com!mc!");
t.equal(slugify_url("https://www.odesk.com/mc/"), "www.odesk.com!mc");
t.equal(slugify_url("https://www.odesk.com/mc/", {skipProtocol: false}), "https!www.odesk.com!mc");
t.equal(slugify_url("https://admin:test@www.odesk.com"), "www.odesk.com");

@@ -41,1 +41,7 @@ t.end();

});
test("test that we don't have multiple slashchars in a row and none at the end", function(t) {
t.equal(slugify_url("https://www.odesk.com/?q=a||**b"), "www.odesk.com!q=a!b");
t.equal(slugify_url("https://www.odesk.com/?"), "www.odesk.com");
t.end();
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc