(data, loader)
| 56081 | var _responseUtils = require("../utils/response-utils"); |
| 56082 | var ERR_DATA = "Cannot convert supplied data type"; |
| 56083 | function getArrayBufferOrStringFromDataSync(data, loader) { |
| 56084 | if (loader.text && typeof data === "string") return data; |
| 56085 | if (data instanceof ArrayBuffer) { |
| 56086 | var arrayBuffer = data; |
| 56087 | if (loader.text && !loader.binary) { |
| 56088 | var textDecoder = new TextDecoder("utf8"); |
| 56089 | return textDecoder.decode(arrayBuffer); |
| 56090 | } |
| 56091 | return arrayBuffer; |
| 56092 | } |
| 56093 | if (ArrayBuffer.isView(data) || (0, _isType.isBuffer)(data)) { |
| 56094 | if (loader.text && !loader.binary) { |
| 56095 | var _textDecoder = new TextDecoder("utf8"); |
| 56096 | return _textDecoder.decode(data); |
| 56097 | } |
| 56098 | var _arrayBuffer = data.buffer; |
| 56099 | var byteLength = data.byteLength || data.length; |
| 56100 | if (data.byteOffset !== 0 || byteLength !== _arrayBuffer.byteLength) _arrayBuffer = _arrayBuffer.slice(data.byteOffset, data.byteOffset + byteLength); |
| 56101 | return _arrayBuffer; |
| 56102 | } |
| 56103 | throw new Error(ERR_DATA); |
| 56104 | } |
| 56105 | function getArrayBufferOrStringFromData(_x, _x2) { |
| 56106 | return _getArrayBufferOrStringFromData.apply(this, arguments); |
| 56107 | } |
no outgoing calls
no test coverage detected