Passed
Push — master ( e4164e...2222ad )
by Rafael S.
01:19
created

wavefile-header.js ➔ ???   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 59

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
nc 1
dl 0
loc 59
rs 9.597
cc 1
nop 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
/*
2
 * WaveFileHeader class
3
 * A structure representing a WAVE file header.
4
 * Copyright (c) 2017 Rafael da Silva Rocha. MIT License.
5
 * https://github.com/rochars/wavefile
6
 *
7
 */
8
9
/**
10
 * Wave file headers.
11
 */
12
module.exports.WaveFileHeader = class {
13
14
    constructor() {
15
        /**
16
         * "RIFF"
17
         * @type {string}
18
         */
19
        this.chunkId = "";
20
        /** @type {number} */
21
        this.chunkSize = 0;
22
        /**
23
         * "WAVE"
24
         * @type {string}
25
         */
26
        this.subChunk1Id = "";
27
        /**
28
         * "fmt "
29
         * @type {string}
30
         */
31
        this.format = "";
32
        /** @type {number} */
33
        this.subChunk1Size = 0;
34
        /** @type {number} */
35
        this.audioFormat = 0;
36
        /** @type {number} */
37
        this.numChannels = 0;
38
        /** @type {number} */
39
        this.sampleRate = 0;
40
        /** @type {number} */
41
        this.byteRate = 0;
42
        /** @type {number} */
43
        this.blockAlign = 0;
44
        /** @type {number} */
45
        this.bitsPerSample = 0;
46
47
        /** @type {number} */
48
        this.cbSize = 0;
49
50
        /** @type {string} */
51
        this.factChunkId = "";
52
        /**
53
         * minimum 4
54
         * @type {number}
55
         */
56
        this.factChunkSize = 4;
57
        /** @type {number} */
58
        this.dwSampleLength = 0;
59
        /**
60
         * "data"
61
         * @type {string}
62
         */
63
        this.subChunk2Id = "";
64
        /** @type {number} */
65
        this.subChunk2Size = 0;
66
        /**
67
         * "bext"
68
         * @type {string}
69
         */
70
        this.bextChunkId = "";
71
        // TODO bext data
72
    }
73
}
74