MCPcopy Create free account
hub / github.com/microsoft/SandDance / _makeTextDecoderIterator

Function _makeTextDecoderIterator

docs/app/js/sanddance-app.js:53958–54040  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

53956 return _makeTextDecoderIterator.apply(this, arguments);
53957}
53958function _makeTextDecoderIterator() {
53959 _makeTextDecoderIterator = (0, _wrapAsyncGeneratorDefault.default)((0, _regeneratorDefault.default).mark(function _callee(arrayBufferIterator, options) {
53960 var textDecoder, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _value, arrayBuffer;
53961 return (0, _regeneratorDefault.default).wrap(function _callee$(_context) {
53962 while(true)switch(_context.prev = _context.next){
53963 case 0:
53964 textDecoder = new TextDecoder(options);
53965 _iteratorNormalCompletion = true;
53966 _didIteratorError = false;
53967 _context.prev = 3;
53968 _iterator = (0, _asyncIteratorDefault.default)(arrayBufferIterator);
53969 case 5:
53970 _context.next = 7;
53971 return (0, _awaitAsyncGeneratorDefault.default)(_iterator.next());
53972 case 7:
53973 _step = _context.sent;
53974 _iteratorNormalCompletion = _step.done;
53975 _context.next = 11;
53976 return (0, _awaitAsyncGeneratorDefault.default)(_step.value);
53977 case 11:
53978 _value = _context.sent;
53979 if (_iteratorNormalCompletion) {
53980 _context.next = 19;
53981 break;
53982 }
53983 arrayBuffer = _value;
53984 _context.next = 16;
53985 return typeof arrayBuffer === "string" ? arrayBuffer : textDecoder.decode(arrayBuffer, {
53986 stream: true
53987 });
53988 case 16:
53989 _iteratorNormalCompletion = true;
53990 _context.next = 5;
53991 break;
53992 case 19:
53993 _context.next = 25;
53994 break;
53995 case 21:
53996 _context.prev = 21;
53997 _context.t0 = _context["catch"](3);
53998 _didIteratorError = true;
53999 _iteratorError = _context.t0;
54000 case 25:
54001 _context.prev = 25;
54002 _context.prev = 26;
54003 if (!(!_iteratorNormalCompletion && _iterator["return"] != null)) {
54004 _context.next = 30;
54005 break;
54006 }
54007 _context.next = 30;
54008 return (0, _awaitAsyncGeneratorDefault.default)(_iterator["return"]());
54009 case 30:
54010 _context.prev = 30;
54011 if (!_didIteratorError) {
54012 _context.next = 33;
54013 break;
54014 }
54015 throw _iteratorError;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected