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

deparam

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deparam

$.param() reverse function

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
27K
increased by45.96%
Maintainers
1
Weekly downloads
 
Created
Source

deparam()

A $.param() reverse function without dependencies. Supports array-parameters and object-parameters with infinite nesting. An extracted and refactored deparam method from Ben Alman's jQuery BBQ

##tests

  it('should deparam obj', function () {
    var target= {a:"1", b:"qwerty"}
    var target2= deparam(decodeURIComponent($.param(target)))

    expect(target2).eql(target)
  })

  it('should deparam obj with array property', function () {
    var target= {a:["x", "y"]}
    var target2= deparam(decodeURIComponent($.param(target)))

    expect(target2).eql(target)
  })

  it('should deparam obj with obj property', function () {
    var target= {a:{b1:"x", b2:"y"}}
    var target2= deparam(decodeURIComponent($.param(target)))

    expect(target2).eql(target)
  })

  it('should deparam obj with obj with obj and arr property', function () {
    var target= {o1:{o2:{s:"x", a:["a1", "a2"]}}}
    var target2= deparam(decodeURIComponent($.param(target)))

    expect(target2).eql(target)
  })

##installation

npm i deparam

##usage

var deparam = require("deparam")
var query= "a=1&b=qwerty"
var params= deparam(query) //params == {a:"1", b:"qwerty"}

Keywords

FAQs

Package last updated on 28 Jan 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