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

Functionally similar to PHP urlencode and urldecode functions

  • 1.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

phpurlencode

Functionally similar to PHP urlencode and urldecode functions. No dependencies.

Install

NPM

$ npm install phpurlencode

Yarn

$ yarn add phpurlencode

Usage

Include it in your Node.js file

var phpurlencode = require('phpurlencode');

phpurlencode(string)

var encodedString = phpurlencode("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.67 Safari/537.36");
console.log(encodedString);
// => Mozilla%2F5.0+%28Macintosh%3B+Intel+Mac+OS+X+10_12_2%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F56.0.2924.67+Safari%2F537.36

phpurlencode.encode(string) [ alias of phpurlencode( ) ]

var encodedString = phpurlencode.encode("!@#$%^&*()-+='\"");
console.log(encodedString);
// => %21%40%23%24%25%5E%26%2A%28%29-%2B%3D%27%22

phpurlencode.decode(string)

var decodedString = phpurlencode.decode('%21%40%23%24%25%5E%26%2A%28%29-%2B%3D%27%22');
console.log(decodedString);
// => !@#$%^&*()-+='"

phpurlencode.definePrototypes()

Globally defines .urlencode and .urldecode String prototypes
// Register String prototypes. 
// Once this function is called, the String prototypes will be available across your entire project
phpurlencode.definePrototypes();

var decodedString = '%21%40%23%24%25%5E%26%2A%28%29-%2B%3D%27%22'.urldecode();
console.log(decodedString);
// => !@#$%^&*()-+='"

var encodedString = decodedString.urlencode();
console.log(encodedString);
// => %21%40%23%24%25%5E%26%2A%28%29-%2B%3D%27%22

FAQs

Package last updated on 04 May 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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