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

Function makeStringIterator

docs/app/js/sanddance-app.js:56307–56334  ·  view source on GitHub ↗
(string)

Source from the content-addressed store, hash-verified

56305var _regeneratorDefault = parcelHelpers.interopDefault(_regenerator);
56306var _marked = (0, _regeneratorDefault.default).mark(makeStringIterator);
56307function makeStringIterator(string) {
56308 var options, _options$chunkSize, chunkSize, offset, textEncoder, chunkLength, chunk, _args = arguments;
56309 return (0, _regeneratorDefault.default).wrap(function makeStringIterator$(_context) {
56310 while(true)switch(_context.prev = _context.next){
56311 case 0:
56312 options = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
56313 _options$chunkSize = options.chunkSize, chunkSize = _options$chunkSize === void 0 ? 262144 : _options$chunkSize;
56314 offset = 0;
56315 textEncoder = new TextEncoder();
56316 case 4:
56317 if (!(offset < string.length)) {
56318 _context.next = 12;
56319 break;
56320 }
56321 chunkLength = Math.min(string.length - offset, chunkSize);
56322 chunk = string.slice(offset, offset + chunkLength);
56323 offset += chunkLength;
56324 _context.next = 10;
56325 return textEncoder.encode(chunk);
56326 case 10:
56327 _context.next = 4;
56328 break;
56329 case 12:
56330 case "end":
56331 return _context.stop();
56332 }
56333 }, _marked);
56334}
56335
56336},{"@babel/runtime/regenerator":"hCi6z","@parcel/transformer-js/src/esmodule-helpers.js":"jA2du"}],"7RyGk":[function(require,module,exports) {
56337var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");

Callers

nothing calls this directly

Calls 1

minMethod · 0.45

Tested by

no test coverage detected