New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@classuper/trim-request

Package Overview
Dependencies
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@classuper/trim-request

Express middleware to trim all incoming request object

2.0.0
latest
Source
npm
Version published
Maintainers
2
Created
Source

trim-request

Express middleware to trim all incoming request object

Installation

npm install trim-request

Usage

trim-request is very simple to use, just import the package and use one of its methods:

trimRequest.all trim body, params and query objects

trimRequest.body trim only the body object

trimRequest.param trim the params object

trimRequest.query trim the query string object

const trimRequest = require('@classuper/trim-request');

app.post('/person', trimRequest.all(), (req, res, next) => { 

    res.json(req.body);

});

if the client post:

{
    name: '  foo   ',
    age: 20,
}

the code above will return this object:

{
    name: 'foo',
    age: 20,
}

License

MIT License

Keywords

express

FAQs

Package last updated on 19 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts