()
| 57426 | } |
| 57427 | exports.default = parseImage; |
| 57428 | function _parseImage() { |
| 57429 | _parseImage = (0, _asyncToGeneratorDefault.default)((0, _regeneratorDefault.default).mark(function _callee(arrayBuffer, options, context) { |
| 57430 | var imageOptions, imageType, _ref, url, loadType, image; |
| 57431 | return (0, _regeneratorDefault.default).wrap(function _callee$(_context) { |
| 57432 | while(true)switch(_context.prev = _context.next){ |
| 57433 | case 0: |
| 57434 | options = options || {}; |
| 57435 | imageOptions = options.image || {}; |
| 57436 | imageType = imageOptions.type || "auto"; |
| 57437 | _ref = context || {}, url = _ref.url; |
| 57438 | loadType = getLoadableImageType(imageType); |
| 57439 | _context.t0 = loadType; |
| 57440 | _context.next = _context.t0 === "imagebitmap" ? 8 : _context.t0 === "image" ? 12 : _context.t0 === "data" ? 16 : 20; |
| 57441 | break; |
| 57442 | case 8: |
| 57443 | _context.next = 10; |
| 57444 | return (0, _parseToImageBitmapDefault.default)(arrayBuffer, options, url); |
| 57445 | case 10: |
| 57446 | image = _context.sent; |
| 57447 | return _context.abrupt("break", 21); |
| 57448 | case 12: |
| 57449 | _context.next = 14; |
| 57450 | return (0, _parseToImageDefault.default)(arrayBuffer, options, url); |
| 57451 | case 14: |
| 57452 | image = _context.sent; |
| 57453 | return _context.abrupt("break", 21); |
| 57454 | case 16: |
| 57455 | _context.next = 18; |
| 57456 | return (0, _parseToNodeImageDefault.default)(arrayBuffer, options); |
| 57457 | case 18: |
| 57458 | image = _context.sent; |
| 57459 | return _context.abrupt("break", 21); |
| 57460 | case 20: |
| 57461 | (0, _assertDefault.default)(false); |
| 57462 | case 21: |
| 57463 | if (imageType === "data") image = (0, _parsedImageApi.getImageData)(image); |
| 57464 | return _context.abrupt("return", image); |
| 57465 | case 23: |
| 57466 | case "end": |
| 57467 | return _context.stop(); |
| 57468 | } |
| 57469 | }, _callee); |
| 57470 | })); |
| 57471 | return _parseImage.apply(this, arguments); |
| 57472 | } |
| 57473 | function getLoadableImageType(type) { |
| 57474 | switch(type){ |
| 57475 | case "auto": |
nothing calls this directly
no test coverage detected