Registry / web-framework / express-normalize-query-params-middleware

express-normalize-query-params-middleware

JSON →
library0.5.1jsnpmunverified

Express middleware that normalizes incoming query parameter names to be case-insensitive. Current stable version is 0.5.1, with low release cadence (last update likely pre-2018). Key differentiator: simple array-based whitelist approach, no dependencies, small footprint. Alternative to libraries like 'express-case-sensitive' or manual normalization. Note: only handles case normalization, not type coercion or default values.

npm install express-normalize-query-params-middleware
INSTALL
IMPORT
SIG · EXPRESS-NORMALIZE-
E
express-normalize-query-params-middleware
web-frameworkjavascriptv0.5.1
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
✓ import normalizeQueryParams from 'express-normalize-query-params-middleware'
✗ const normalizeQueryParams = require('express-normalize-query-params-middleware').default
ESM default import recommended. CommonJS require() works but .default may be needed depending on bundler.
default
✓ const normalizeQueryParams = require('express-normalize-query-params-middleware')
CommonJS require() works directly, no need for .default.
TypeScript types
✓ import normalizeQueryParams from 'express-normalize-query-params-middleware'
Package does not ship TypeScript definitions; consider using @types/express or custom type declaration.

Demonstrates basic usage: normalizes query params to lowercase keys based on whitelist.

import normalizeQueryParams from 'express-normalize-query-params-middleware'; import express from 'express'; const app = express(); const allowedParams = ['name', 'email', 'age']; app.use(normalizeQueryParams(allowedParams)); app.get('/user', (req, res) => { // req.query.name, req.query.email, req.query.age are case-insensitive // e.g., ?Name=John&EMAIL=john@example.com works res.json(req.query); }); app.listen(3000);
Debug
Known issues
gotchaThe middleware only normalizes parameter names listed in the whitelist array; any extra params are left unchanged and case-sensitive.
fix
Ensure all expected parameters are included in the array passed to normalizeQueryParams.
affects: >=0.0.0
gotchaThe whitelist comparison is case-insensitive, but the result sets the key to the lowercase version of the whitelist entry, not the original incoming key. This may cause unexpected key naming if whitelist has mixed case.
fix
Always use lowercase strings in the whitelist to avoid confusion.
affects: >=0.0.0
gotchaThe middleware modifies req.query in place; if other middleware also modifies query, order matters.
fix
Place this middleware early in the stack, before any middleware that depends on normalized query params.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: normalizeQueryParams is not a function
Using ES6 import incorrectly with CommonJS require pattern.
fix
Use correct import: import normalizeQueryParams from 'express-normalize-query-params-middleware' or const normalizeQueryParams = require('express-normalize-query-params-middleware').default
Cannot find module 'express-normalize-query-params-middleware'
Package not installed or typo in package name.
fix
Run: npm install express-normalize-query-params-middleware
Upgrade
Version history
0.5.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
express-normalize-query-params-middleware — npm install express-normalize-query-params-middleware · libregistry