GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

src/util/getCurrentRecords.js   A
last analyzed

Complexity

Total Complexity 3
Complexity/F 3

Size

Lines of Code 40
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 0
wmc 3
nc 1
mnd 1
bc 3
fnc 1
dl 0
loc 40
rs 10
bpm 3
cpm 3
noi 0
c 0
b 0
f 0
1
export const getCurrentRecords = (
2
    dataSource,
3
    pageIndex,
4
    pageSize,
5
    infinite,
6
    viewableIndex,
7
    viewableCount,
8
    bufferMultiplier
9
) => {
10
11
    if (!dataSource) {
12
        return {};
13
    }
14
15
    if (infinite) {
16
        const start = Math.max(
17
            viewableIndex - viewableCount * bufferMultiplier,
18
            0
19
        );
20
21
        const end = Math.min(
22
            viewableIndex + viewableCount * (bufferMultiplier + 1),
23
            dataSource.currentRecords.count()
24
        );
25
26
        return {
27
            data: dataSource.currentRecords.slice(start, end),
28
            startIndex: start,
29
            endIndex: end
30
        };
31
    }
32
33
    return {
34
        data: dataSource.data.slice(
35
            pageIndex * pageSize, (pageIndex + 1) * pageSize
36
        ),
37
        startIndex: null,
38
        endIndex: null
39
    };
40
};
41