Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

amazon-api-gateway-querystring

1.0.5 • Public • Published

amazon-api-gateway-querystring

Utility for parse nested parameters in query strings

To transform plain nested params in object inside querystring:

var mapQueryString = require('amazon-api-gateway-querystring');
event.queryStringParameters = mapQueryString(event.queryStringParameters);
event.queryStringParameters = {
  "person[0][name]": "Mark",
  "person[0][age]": 32,
  "person[1][name]": "Luke",
  "person[1][age]": 26,
  "contacts[home][phone]": "+3333333333",
  "contacts[home][email]": "email@email.com",
  "contacts[home][twitter]": "@username"
}
 
// become:
 
event.queryStringParameters = {
  "person": [{
    "name": "Mark",
    "age": 32
  }, {
    "name": "Luke",
    "age": 26
  }],
  "contacts": {
    "home": {
      "phone": "+3333333333",
      "email": "email@email.com",
      "twitter": "@username"
    }
  }
}

install

npm i amazon-api-gateway-querystring

Downloadsweekly downloads

84

version

1.0.5

license

ISC

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability