Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including koa-camelcase-keys with all npm packages installed. Try it out:

var koaCamelcaseKeys = require("koa-camelcase-keys")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

koa-camelcase-keys v1.0.1

a koa middleware for converting object keys to camelCase using camelcase-keys.


NPM version Build status Node.js Version Dependency status Dev Dependency status NPM downloads

A koa middleware for converting object keys to camelCase using camelcase-keys.


$ npm i --save koa-camelcase-keys


const Koa = require('koa')
const bodyParser = require('koa-bodyparser')
const camelCase = require('koa-camelcase-keys')

const app = new Koa()
// convert json body to object

// camel case the object from bodyParser middlerware

// Or
// exclude some routes
app.use(camelCase({ excludeRoutes: ['/route_a', 'route_b'] }))
app.use(camelCase({ excludeRoutes: '/route_a' }))
app.use(camelCase({ excludeRoutes: /a/ }))

// Or
// exclude some keys
app.use(camelCase({ exclude: ['a_b', 'c_d'] }))
app.use(camelCase({ exclude: 'a_b' }))

// Or
// disable deep match
app.use(camelCase({ deep: false }))


camelCase({ deep: true, exclude: [], excludeRoutes: '' } = {})


Type: string[] RegExp[]
Default: ''

Exclude routes from being camelCased.


Type: string[] RegExp[]
Default: []

Exclude keys from being camelCased.


Type: boolean
Default: false

Recurse nested objects and objects in arrays.


MIT @ Mindspop


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free