ccqp

camelcase query params express middleware

Usage no npm install needed!

<script type="module">
  import ccqp from 'https://cdn.skypack.dev/ccqp';
</script>

README

ccqp

Build Status npm version npm downloads minified size

express middleware to recursively transform query params keys to camel-case.

TL;DR

npm install ccqp
const express = require('express')
const ccqp = require('ccqp')

const app = express()
app.use(ccqp)

// ...

 

A request with the following querystring:

const qs = `
  ?first_name=John
  &LastName=Doe
  &date-of_-birth=01.01.1985
  &hair.color=brown
  &contact[email]=john.doe@example.com
  &contact[phone_number]=754-3010
`

will have the following req.query:

{
  firstName: 'John',
  lastName: 'Doe',
  dateOfBirth: '01.01.1985',
  hairColor: 'brown',
  contact: {
    email: 'john.doe@example.com',
    phoneNumber: '754-3010',
  },
 }