Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

phpurlencode

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

phpurlencode - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

19

index.js
"use strict";
function encode(str) {
return encodeURIComponent(str)
const encode = str => {
return encodeURIComponent(str + '')
.replace(/[!'()]/g, escape)
.replace(/\*/g, "%2A")
.replace(/\%20/g, "+");
}
.replace(/\%20/g, "+")
.replace(/~/g, '%7E');
};
function decode(str) {
return decodeURIComponent(str.replace(/\+/g, " ").replace(/\%2A/g, "*"));
}
const decode = str => {
return decodeURIComponent(
(str + '')
.replace(/%(?![\da-f]{2})/gi, () => '%25')
.replace(/\+/g, '%20')
);
};

@@ -13,0 +18,0 @@ module.exports = encode;

{
"name": "phpurlencode",
"description": "Functionally similar to PHP urlencode and urldecode functions",
"version": "1.0.0",
"version": "1.0.1",
"main": "index.js",

@@ -16,3 +16,4 @@ "license": "MIT",

"url": "https://github.com/luke3butler/node-phpurlencode.git"
}
},
"dependencies": {}
}

@@ -11,4 +11,4 @@ "use strict";

assert.equal(
"%21%40%23%24%25%5E%26%2A%28%29%2B%27",
urlencode("!@#$%^&*()+'")
"%21%40%23%24%25%5E%26%2A%28%29%2B%27%7E%22%3C%3E%2C.",
urlencode("!@#$%^&*()+'~\"<>,.")
);

@@ -32,4 +32,4 @@ }

assert.equal(
"!@#$%^&*()+'",
urlencode.decode("%21%40%23%24%25%5E%26%2A%28%29%2B%27")
"!@#$%^&*()+'~\"<>,.",
urlencode.decode("%21%40%23%24%25%5E%26%2A%28%29%2B%27%7E%22%3C%3E%2C.")
);

@@ -36,0 +36,0 @@ }

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc