mirror of https://gitgud.io/fatchan/jschan.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
405 B
24 lines
405 B
'use strict';
|
|
|
|
module.exports = (req, res, next) => {
|
|
|
|
//for body
|
|
if (req.body.thread) {
|
|
req.body.thread = +req.body.thread;
|
|
}
|
|
if (req.body.checked) {
|
|
//syntax casts all string to number
|
|
req.body.checked = req.body.checked.map(Number);
|
|
}
|
|
|
|
//and for params
|
|
if (req.params.id) {
|
|
req.params.id = +req.params.id;
|
|
}
|
|
if (req.params.page) {
|
|
req.params.page = +req.params.page;
|
|
}
|
|
|
|
next();
|
|
|
|
}
|
|
|