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