mas-server 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/old ADDED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mas-server",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "一款基于express面向中小型项目的后端框架",
5
5
  "main": "./src/index.js",
6
6
  "scripts": {
@@ -1,18 +1,18 @@
1
1
  module.exports = (req, res, next) => {
2
- req.body = req.fields
3
- let right=true
2
+ req.body = req.fields;
3
+ let right = true;
4
4
  res.return = async (data, status = 1, code = 200) => {
5
- if(!right) return
6
- right=false
7
- if(!data){
8
- status=0
5
+ if (!right) return;
6
+ right = false;
7
+ if (!data) {
8
+ status = 0;
9
9
  }
10
- if (Number.isInteger(data)) data = data + ''
11
- if(data instanceof Promise) data = await data
10
+ if (Number.isInteger(data)) data = data + '';
11
+ if (data instanceof Promise) data = await data;
12
12
  res.status(code).send({
13
13
  status: status >= 1 ? 1 : 0,
14
14
  data: data ? data : null
15
- })
16
- }
17
- next()
18
- }
15
+ });
16
+ };
17
+ next();
18
+ };