(encoding, start, end)
| 10140 | Buffer.byteLength = byteLength |
| 10141 | |
| 10142 | function slowToString (encoding, start, end) { |
| 10143 | var loweredCase = false |
| 10144 | |
| 10145 | // No need to verify that "this.length <= MAX_UINT32" since it's a read-only |
| 10146 | // property of a typed array. |
| 10147 | |
| 10148 | // This behaves neither like String nor Uint8Array in that we set start/end |
| 10149 | // to their upper/lower bounds if the value passed is out of range. |
| 10150 | // undefined is handled specially as per ECMA-262 6th Edition, |
| 10151 | // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. |
| 10152 | if (start === undefined || start < 0) { |
| 10153 | start = 0 |
| 10154 | } |
| 10155 | // Return early if start > this.length. Done here to prevent potential uint32 |
| 10156 | // coercion fail below. |
| 10157 | if (start > this.length) { |
| 10158 | return '' |
| 10159 | } |
| 10160 | |
| 10161 | if (end === undefined || end > this.length) { |
| 10162 | end = this.length |
| 10163 | } |
| 10164 | |
| 10165 | if (end <= 0) { |
| 10166 | return '' |
| 10167 | } |
| 10168 | |
| 10169 | // Force coersion to uint32. This will also coerce falsey/NaN values to 0. |
| 10170 | end >>>= 0 |
| 10171 | start >>>= 0 |
| 10172 | |
| 10173 | if (end <= start) { |
| 10174 | return '' |
| 10175 | } |
| 10176 | |
| 10177 | if (!encoding) encoding = 'utf8' |
| 10178 | |
| 10179 | while (true) { |
| 10180 | switch (encoding) { |
| 10181 | case 'hex': |
| 10182 | return hexSlice(this, start, end) |
| 10183 | |
| 10184 | case 'utf8': |
| 10185 | case 'utf-8': |
| 10186 | return utf8Slice(this, start, end) |
| 10187 | |
| 10188 | case 'ascii': |
| 10189 | return asciiSlice(this, start, end) |
| 10190 | |
| 10191 | case 'latin1': |
| 10192 | case 'binary': |
| 10193 | return latin1Slice(this, start, end) |
| 10194 | |
| 10195 | case 'base64': |
| 10196 | return base64Slice(this, start, end) |
| 10197 | |
| 10198 | case 'ucs2': |
| 10199 | case 'ucs-2': |
nothing calls this directly
no test coverage detected