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

tiny-parse

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tiny-parse - npm Package Compare versions

Comparing version 2.0.2 to 2.1.0

8

lib/parse.js
"use strict";
const coerce = require("tiny-coerce"),
const tcoerce = require("tiny-coerce"),
each = require("retsu").each,

@@ -15,3 +15,3 @@ url = require("url");

function queryString (arg = "") {
function queryString (arg = "", coerce = true) {
const result = {},

@@ -28,3 +28,3 @@ items = arg.replace(/^\?/, "").split("&");

} else {
item[1] = coerce(decodeURIComponent(item[1]));
item[1] = coerce ? tcoerce(decodeURIComponent(item[1])) : decodeURIComponent(item[1]);
}

@@ -63,3 +63,3 @@

parsed = url.parse(uri);
parsed.pathname = (parsed.pathname || "").replace(/%20/g, " ");
parsed.pathname = (parsed.pathname || "").replace(/(%20|\+)/g, " ");
parsed.path = parsed.pathname + (parsed.search || "");

@@ -66,0 +66,0 @@ parsed.query = typeof parsed.search === "string" ? queryString(parsed.search) : {};

{
"name": "tiny-parse",
"version": "2.0.2",
"version": "2.1.0",
"description": "URL parsing with coercion of `query`",

@@ -36,5 +36,5 @@ "main": "index.js",

"grunt": "~1.0.1",
"grunt-eslint": "~18.1.0",
"grunt-nsp": "~2.2.0"
"grunt-eslint": "~20.1.0",
"grunt-nsp": "~2.3.1"
}
}

@@ -15,6 +15,7 @@ # tiny-parse

console.log(parse("/?abc=true").query.abc === true); // true
console.log(parse("/?abc=true", false).query.abc === true); // false
```
### API
*parse()*
*parse(arg, coerce=true)*
Parses the input, accepts a URL or `http.ClientRequest`

@@ -21,0 +22,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