Conditions | 1 |
Paths | 1 |
Total Lines | 215 |
Code Lines | 76 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | 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 | /* |
||
40 | constructor() { |
||
41 | /** |
||
42 | * The container identifier. |
||
43 | * 'RIFF', 'RIFX' and 'RF64' are supported. |
||
44 | * @type {string} |
||
45 | */ |
||
46 | this.container = ''; |
||
47 | /** |
||
48 | * @type {number} |
||
49 | */ |
||
50 | this.chunkSize = 0; |
||
51 | /** |
||
52 | * The format. |
||
53 | * Always 'WAVE'. |
||
54 | * @type {string} |
||
55 | */ |
||
56 | this.format = ''; |
||
57 | /** |
||
58 | * The data of the 'fmt' chunk. |
||
59 | * @type {!Object<string, *>} |
||
60 | */ |
||
61 | this.fmt = { |
||
62 | /** @type {string} */ |
||
63 | chunkId: '', |
||
64 | /** @type {number} */ |
||
65 | chunkSize: 0, |
||
66 | /** @type {number} */ |
||
67 | audioFormat: 0, |
||
68 | /** @type {number} */ |
||
69 | numChannels: 0, |
||
70 | /** @type {number} */ |
||
71 | sampleRate: 0, |
||
72 | /** @type {number} */ |
||
73 | byteRate: 0, |
||
74 | /** @type {number} */ |
||
75 | blockAlign: 0, |
||
76 | /** @type {number} */ |
||
77 | bitsPerSample: 0, |
||
78 | /** @type {number} */ |
||
79 | cbSize: 0, |
||
80 | /** @type {number} */ |
||
81 | validBitsPerSample: 0, |
||
82 | /** @type {number} */ |
||
83 | dwChannelMask: 0, |
||
84 | /** |
||
85 | * 4 32-bit values representing a 128-bit ID |
||
86 | * @type {!Array<number>} |
||
87 | */ |
||
88 | subformat: [] |
||
89 | }; |
||
90 | /** |
||
91 | * The data of the 'fact' chunk. |
||
92 | * @type {!Object<string, *>} |
||
93 | */ |
||
94 | this.fact = { |
||
95 | /** @type {string} */ |
||
96 | chunkId: '', |
||
97 | /** @type {number} */ |
||
98 | chunkSize: 0, |
||
99 | /** @type {number} */ |
||
100 | dwSampleLength: 0 |
||
101 | }; |
||
102 | /** |
||
103 | * The data of the 'cue ' chunk. |
||
104 | * @type {!Object<string, *>} |
||
105 | */ |
||
106 | this.cue = { |
||
107 | /** @type {string} */ |
||
108 | chunkId: '', |
||
109 | /** @type {number} */ |
||
110 | chunkSize: 0, |
||
111 | /** @type {number} */ |
||
112 | dwCuePoints: 0, |
||
113 | /** @type {!Array<!Object>} */ |
||
114 | points: [], |
||
115 | }; |
||
116 | /** |
||
117 | * The data of the 'smpl' chunk. |
||
118 | * @type {!Object<string, *>} |
||
119 | */ |
||
120 | this.smpl = { |
||
121 | /** @type {string} */ |
||
122 | chunkId: '', |
||
123 | /** @type {number} */ |
||
124 | chunkSize: 0, |
||
125 | /** @type {number} */ |
||
126 | dwManufacturer: 0, |
||
127 | /** @type {number} */ |
||
128 | dwProduct: 0, |
||
129 | /** @type {number} */ |
||
130 | dwSamplePeriod: 0, |
||
131 | /** @type {number} */ |
||
132 | dwMIDIUnityNote: 0, |
||
133 | /** @type {number} */ |
||
134 | dwMIDIPitchFraction: 0, |
||
135 | /** @type {number} */ |
||
136 | dwSMPTEFormat: 0, |
||
137 | /** @type {number} */ |
||
138 | dwSMPTEOffset: 0, |
||
139 | /** @type {number} */ |
||
140 | dwNumSampleLoops: 0, |
||
141 | /** @type {number} */ |
||
142 | dwSamplerData: 0, |
||
143 | /** @type {!Array<!Object>} */ |
||
144 | loops: [] |
||
145 | }; |
||
146 | /** |
||
147 | * The data of the 'bext' chunk. |
||
148 | * @type {!Object<string, *>} |
||
149 | */ |
||
150 | this.bext = { |
||
151 | /** @type {string} */ |
||
152 | chunkId: '', |
||
153 | /** @type {number} */ |
||
154 | chunkSize: 0, |
||
155 | /** @type {string} */ |
||
156 | description: '', //256 |
||
157 | /** @type {string} */ |
||
158 | originator: '', //32 |
||
159 | /** @type {string} */ |
||
160 | originatorReference: '', //32 |
||
161 | /** @type {string} */ |
||
162 | originationDate: '', //10 |
||
163 | /** @type {string} */ |
||
164 | originationTime: '', //8 |
||
165 | /** |
||
166 | * 2 32-bit values, timeReference high and low |
||
167 | * @type {!Array<number>} |
||
168 | */ |
||
169 | timeReference: [0, 0], |
||
170 | /** @type {number} */ |
||
171 | version: 0, //WORD |
||
172 | /** @type {string} */ |
||
173 | UMID: '', // 64 chars |
||
174 | /** @type {number} */ |
||
175 | loudnessValue: 0, //WORD |
||
176 | /** @type {number} */ |
||
177 | loudnessRange: 0, //WORD |
||
178 | /** @type {number} */ |
||
179 | maxTruePeakLevel: 0, //WORD |
||
180 | /** @type {number} */ |
||
181 | maxMomentaryLoudness: 0, //WORD |
||
182 | /** @type {number} */ |
||
183 | maxShortTermLoudness: 0, //WORD |
||
184 | /** @type {string} */ |
||
185 | reserved: '', //180 |
||
186 | /** @type {string} */ |
||
187 | codingHistory: '' // string, unlimited |
||
188 | }; |
||
189 | /** |
||
190 | * The data of the 'ds64' chunk. |
||
191 | * Used only with RF64 files. |
||
192 | * @type {!Object<string, *>} |
||
193 | */ |
||
194 | this.ds64 = { |
||
195 | /** @type {string} */ |
||
196 | chunkId: '', |
||
197 | /** @type {number} */ |
||
198 | chunkSize: 0, |
||
199 | /** @type {number} */ |
||
200 | riffSizeHigh: 0, // DWORD |
||
201 | /** @type {number} */ |
||
202 | riffSizeLow: 0, // DWORD |
||
203 | /** @type {number} */ |
||
204 | dataSizeHigh: 0, // DWORD |
||
205 | /** @type {number} */ |
||
206 | dataSizeLow: 0, // DWORD |
||
207 | /** @type {number} */ |
||
208 | originationTime: 0, // DWORD |
||
209 | /** @type {number} */ |
||
210 | sampleCountHigh: 0, // DWORD |
||
211 | /** @type {number} */ |
||
212 | sampleCountLow: 0 // DWORD |
||
213 | /** @type {number} */ |
||
214 | //'tableLength': 0, // DWORD |
||
215 | /** @type {!Array<number>} */ |
||
216 | //'table': [] |
||
217 | }; |
||
218 | /** |
||
219 | * The data of the 'data' chunk. |
||
220 | * @type {!Object<string, *>} |
||
221 | */ |
||
222 | this.data = { |
||
223 | /** @type {string} */ |
||
224 | chunkId: '', |
||
225 | /** @type {number} */ |
||
226 | chunkSize: 0, |
||
227 | /** @type {!Uint8Array} */ |
||
228 | samples: new Uint8Array(0) |
||
229 | }; |
||
230 | /** |
||
231 | * The data of the 'LIST' chunks. |
||
232 | * Each item in this list look like this: |
||
233 | * { |
||
234 | * chunkId: '', |
||
235 | * chunkSize: 0, |
||
236 | * format: '', |
||
237 | * subChunks: [] |
||
238 | * } |
||
239 | * @type {!Array<!Object>} |
||
240 | */ |
||
241 | this.LIST = []; |
||
242 | /** |
||
243 | * The data of the 'junk' chunk. |
||
244 | * @type {!Object<string, *>} |
||
245 | */ |
||
246 | this.junk = { |
||
247 | /** @type {string} */ |
||
248 | chunkId: '', |
||
249 | /** @type {number} */ |
||
250 | chunkSize: 0, |
||
251 | /** @type {!Array<number>} */ |
||
252 | chunkData: [] |
||
253 | }; |
||
254 | } |
||
255 | } |
||
256 |