Conditions | 1 |
Paths | 1 |
Total Lines | 97 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
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:
If many parameters/temporary variables are present:
1 | /* |
||
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.format = ""; |
||
27 | /** |
||
28 | * "fmt " |
||
29 | * @type {string} |
||
30 | */ |
||
31 | this.fmtChunkId = ""; |
||
32 | /** @type {number} */ |
||
33 | this.fmtChunkSize = 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 {number} */ |
||
51 | this.validBitsPerSample = 0; |
||
52 | |||
53 | /** |
||
54 | * "fact" |
||
55 | * @type {string} |
||
56 | */ |
||
57 | this.factChunkId = ""; |
||
58 | /** @type {number} */ |
||
59 | this.factChunkSize = 0; |
||
60 | /** @type {Array<number>} */ |
||
61 | this.factChunkData = []; |
||
62 | /** @type {number} */ |
||
63 | this.dwSampleLength = 0; |
||
64 | |||
65 | /** |
||
66 | * "cue " |
||
67 | * @type {string} |
||
68 | */ |
||
69 | this.cueChunkId = ""; |
||
70 | /** @type {number} */ |
||
71 | this.cueChunkSize = -1; |
||
72 | /** @type {Array<number>} */ |
||
73 | this.cueChunkData = []; |
||
74 | |||
75 | /** |
||
76 | * "bext" |
||
77 | * @type {string} |
||
78 | */ |
||
79 | this.bextChunkId = ""; |
||
80 | /** @type {number} */ |
||
81 | this.bextChunkSize = 0; |
||
82 | /** @type {Array<number>} */ |
||
83 | this.bextChunkData = []; |
||
84 | /** @type {Object} */ |
||
85 | this.bextChunkFields = { |
||
86 | "description": "", //256 |
||
87 | "originator": "", //32 |
||
88 | "originatorReference": "", //32 |
||
89 | "originationDate": "", //10 |
||
90 | "originationTime": "", //8 |
||
91 | "timeReference": "", //64-bit value |
||
92 | "version": "", //WORD |
||
93 | "UMID": "", // 64 |
||
94 | "loudnessValue": "", //WORD |
||
95 | "loudnessRange": "", //WORD |
||
96 | "maxTruePeakLevel": "", //WORD |
||
97 | "maxMomentaryLoudness": "", //WORD |
||
98 | "maxShortTermLoudness": "", //WORD |
||
99 | "reserved": "", //180 |
||
100 | "codingHistory": "" // string, unlimited |
||
101 | }; |
||
102 | |||
103 | /** |
||
104 | * "data" |
||
105 | * @type {string} |
||
106 | */ |
||
107 | this.dataChunkId = ""; |
||
108 | /** @type {number} */ |
||
109 | this.dataChunkSize = 0; |
||
110 | } |
||
111 | } |
||
114 |