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

@polka/parse

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@polka/parse - npm Package Compare versions

Comparing version 1.0.0-next.1 to 1.0.0-next.3

index.mjs

28

index.js

@@ -1,6 +0,6 @@

const { parse } = require('querystring');
const { decode } = require('querystring');
const noop = x => x;
exports.parse = function (opts={}) {
function parse(opts={}) {
const { type, encoding='utf-8', parser=noop } = opts;

@@ -52,23 +52,29 @@ const limit = opts.limit || 100 * 1024; // 100kb

exports.json = function (opts={}) {
function json(opts={}) {
const { limit, parser=JSON.parse } = opts;
const type = opts.type || 'application/json';
return exports.parse({ type, parser, limit });
return parse({ type, parser, limit });
}
exports.urlencoded = function (opts={}) {
const { parser=parse, limit } = opts;
function urlencoded(opts={}) {
const { parser=decode, limit } = opts;
const type = opts.type || 'application/x-www-form-urlencoded';
return exports.parse({ type, parser, limit });
return parse({ type, parser, limit });
}
exports.raw = function (opts={}) {
function raw(opts={}) {
const { limit, encoding=null } = opts;
const type = opts.type || 'application/octet-stream';
return exports.parse({ limit, type, encoding });
return parse({ limit, type, encoding });
}
exports.text = function (opts={}) {
function text(opts={}) {
const { limit, type='text/plain' } = opts;
return exports.parse({ limit, type });
return parse({ limit, type });
}
exports.json = json;
exports.parse = parse;
exports.raw = raw;
exports.text = text;
exports.urlencoded = urlencoded;
{
"version": "1.0.0-next.1",
"version": "1.0.0-next.3",
"name": "@polka/parse",
"repository": "lukeed/polka",
"description": "WIP",
"module": "index.mjs",
"main": "index.js",
"license": "MIT",
"files": [
"*.js"
"*.js",
"*.mjs"
],

@@ -18,3 +21,3 @@ "author": {

},
"gitHead": "8d32406bd3fa924b648df3e67ed32da502293904"
"gitHead": "602086f1f4f1a6103e0589b04b69f8b4d934f0fc"
}
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