npm

Share private packages across your team with npm Orgs, now with simplified billing via the aws marketplace!Learn more »

form-data-to-object

0.2.0 • Public • Published

form-data-to-object

Converts application/x-www-form-urlencoded data structure to plain JS object

API

  • formData.toObj() - Converts keys in x-www-form-urlencoded format on an object to a normal object
  • formData.fromObj() - Converts a normal object to object with keys in x-www-form-urlencoded format
 
// keys in x-www-form-urlencoded format
{
  'foo': 'bar',
  'foo2[name]': 'bar2',
  'foo3[0]': 'bar3',
  'foo3[1][name]': 'bar4'
}
 
// converts from/to
 
// normal object
{
  foo: 'bar',
  foo2: {
    name: 'bar2'
  },
  foo3: ['bar3', {
    name: 'bar4'
  }]
}

install

npm i form-data-to-object

Downloadsweekly downloads

39,926

version

0.2.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability