express-pascal-to-camelcase
v1.0.1
Published
Express middleware to convert keys in request body from PascalCase (UpperCamelCase) to lowerCamelCase
Downloads
79
Maintainers
Readme
express-pascal-to-camelcase
Express middleware to convert keys in request body from PascalCase (UpperCamelCase) to lowerCamelCase
Installation
$ npm install express-pascal-to-camelcase --save
Usage
const app = require('express')();
const bodyParser = require('body-parser');
const pascalToCamel = require('express-pascal-to-camelcase');
app.use(bodyParser.json());
app.use(pascalToCamel()); // add the middleware AFTER body-parser
/*
Converts request body
{
SimpleValue: 45,
InnerObject: {
Pascal: 'case',
UndefinedValue: undefined,
Arr: [1, null, { DeepInside: 'Value' }]
}
}
to
{
simpleValue: 45,
innerObject: {
pascal: 'case',
undefinedValue: undefined,
arr: [1, null, { deepInside: 'Value' }]
}
}
*/
License
MIT