lib/server/transformers/out.js   A
last analyzed

Complexity

Total Complexity 4
Complexity/F 2

Size

Lines of Code 28
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 22.22%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
c 1
b 0
f 0
nc 1
dl 0
loc 28
ccs 2
cts 9
cp 0.2222
crap 0
rs 10
wmc 4
mnd 1
bc 4
fnc 2
bpm 2
cpm 2
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A out.js ➔ ??? 0 19 2
1
"use strict";
2
3
const Response = require('../../model/Response');
4
5
/**
6
 * @param {Response} response
7
 *
8
 * @returns {Object}
9
 */
10
module.exports = response => {
11
    const format = object => {
12 2
        if (object instanceof Response) {
13
            return {
14
                body: object.getBody(),
15
                statusCode: object.getStatusCode(),
16
                headers: object.getHeaders()
17
            };
18
        }
19
20
        return object;
21
    };
22
23 2
    if (Array.isArray(response)) {
24
        return response.map(format);
25
    }
26
27
    return format(response);
28
};
29