json-ext.js 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  3. typeof define === 'function' && define.amd ? define(factory) :
  4. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.jsonExt = factory());
  5. })(this, (function () { 'use strict';
  6. var version = "0.5.7";
  7. const PrimitiveType = 1;
  8. const ObjectType = 2;
  9. const ArrayType = 3;
  10. const PromiseType = 4;
  11. const ReadableStringType = 5;
  12. const ReadableObjectType = 6;
  13. // https://tc39.es/ecma262/#table-json-single-character-escapes
  14. const escapableCharCodeSubstitution$1 = { // JSON Single Character Escape Sequences
  15. 0x08: '\\b',
  16. 0x09: '\\t',
  17. 0x0a: '\\n',
  18. 0x0c: '\\f',
  19. 0x0d: '\\r',
  20. 0x22: '\\\"',
  21. 0x5c: '\\\\'
  22. };
  23. function isLeadingSurrogate$1(code) {
  24. return code >= 0xD800 && code <= 0xDBFF;
  25. }
  26. function isTrailingSurrogate$1(code) {
  27. return code >= 0xDC00 && code <= 0xDFFF;
  28. }
  29. function isReadableStream$1(value) {
  30. return (
  31. typeof value.pipe === 'function' &&
  32. typeof value._read === 'function' &&
  33. typeof value._readableState === 'object' && value._readableState !== null
  34. );
  35. }
  36. function replaceValue$1(holder, key, value, replacer) {
  37. if (value && typeof value.toJSON === 'function') {
  38. value = value.toJSON();
  39. }
  40. if (replacer !== null) {
  41. value = replacer.call(holder, String(key), value);
  42. }
  43. switch (typeof value) {
  44. case 'function':
  45. case 'symbol':
  46. value = undefined;
  47. break;
  48. case 'object':
  49. if (value !== null) {
  50. const cls = value.constructor;
  51. if (cls === String || cls === Number || cls === Boolean) {
  52. value = value.valueOf();
  53. }
  54. }
  55. break;
  56. }
  57. return value;
  58. }
  59. function getTypeNative$1(value) {
  60. if (value === null || typeof value !== 'object') {
  61. return PrimitiveType;
  62. }
  63. if (Array.isArray(value)) {
  64. return ArrayType;
  65. }
  66. return ObjectType;
  67. }
  68. function getTypeAsync$1(value) {
  69. if (value === null || typeof value !== 'object') {
  70. return PrimitiveType;
  71. }
  72. if (typeof value.then === 'function') {
  73. return PromiseType;
  74. }
  75. if (isReadableStream$1(value)) {
  76. return value._readableState.objectMode ? ReadableObjectType : ReadableStringType;
  77. }
  78. if (Array.isArray(value)) {
  79. return ArrayType;
  80. }
  81. return ObjectType;
  82. }
  83. function normalizeReplacer$1(replacer) {
  84. if (typeof replacer === 'function') {
  85. return replacer;
  86. }
  87. if (Array.isArray(replacer)) {
  88. const allowlist = new Set(replacer
  89. .map(item => {
  90. const cls = item && item.constructor;
  91. return cls === String || cls === Number ? String(item) : null;
  92. })
  93. .filter(item => typeof item === 'string')
  94. );
  95. return [...allowlist];
  96. }
  97. return null;
  98. }
  99. function normalizeSpace$1(space) {
  100. if (typeof space === 'number') {
  101. if (!Number.isFinite(space) || space < 1) {
  102. return false;
  103. }
  104. return ' '.repeat(Math.min(space, 10));
  105. }
  106. if (typeof space === 'string') {
  107. return space.slice(0, 10) || false;
  108. }
  109. return false;
  110. }
  111. var utils = {
  112. escapableCharCodeSubstitution: escapableCharCodeSubstitution$1,
  113. isLeadingSurrogate: isLeadingSurrogate$1,
  114. isTrailingSurrogate: isTrailingSurrogate$1,
  115. type: {
  116. PRIMITIVE: PrimitiveType,
  117. PROMISE: PromiseType,
  118. ARRAY: ArrayType,
  119. OBJECT: ObjectType,
  120. STRING_STREAM: ReadableStringType,
  121. OBJECT_STREAM: ReadableObjectType
  122. },
  123. isReadableStream: isReadableStream$1,
  124. replaceValue: replaceValue$1,
  125. getTypeNative: getTypeNative$1,
  126. getTypeAsync: getTypeAsync$1,
  127. normalizeReplacer: normalizeReplacer$1,
  128. normalizeSpace: normalizeSpace$1
  129. };
  130. const {
  131. normalizeReplacer,
  132. normalizeSpace,
  133. replaceValue,
  134. getTypeNative,
  135. getTypeAsync,
  136. isLeadingSurrogate,
  137. isTrailingSurrogate,
  138. escapableCharCodeSubstitution,
  139. type: {
  140. PRIMITIVE,
  141. OBJECT,
  142. ARRAY,
  143. PROMISE,
  144. STRING_STREAM,
  145. OBJECT_STREAM
  146. }
  147. } = utils;
  148. const charLength2048 = Array.from({ length: 2048 }).map((_, code) => {
  149. if (escapableCharCodeSubstitution.hasOwnProperty(code)) {
  150. return 2; // \X
  151. }
  152. if (code < 0x20) {
  153. return 6; // \uXXXX
  154. }
  155. return code < 128 ? 1 : 2; // UTF8 bytes
  156. });
  157. function stringLength(str) {
  158. let len = 0;
  159. let prevLeadingSurrogate = false;
  160. for (let i = 0; i < str.length; i++) {
  161. const code = str.charCodeAt(i);
  162. if (code < 2048) {
  163. len += charLength2048[code];
  164. } else if (isLeadingSurrogate(code)) {
  165. len += 6; // \uXXXX since no pair with trailing surrogate yet
  166. prevLeadingSurrogate = true;
  167. continue;
  168. } else if (isTrailingSurrogate(code)) {
  169. len = prevLeadingSurrogate
  170. ? len - 2 // surrogate pair (4 bytes), since we calculate prev leading surrogate as 6 bytes, substruct 2 bytes
  171. : len + 6; // \uXXXX
  172. } else {
  173. len += 3; // code >= 2048 is 3 bytes length for UTF8
  174. }
  175. prevLeadingSurrogate = false;
  176. }
  177. return len + 2; // +2 for quotes
  178. }
  179. function primitiveLength(value) {
  180. switch (typeof value) {
  181. case 'string':
  182. return stringLength(value);
  183. case 'number':
  184. return Number.isFinite(value) ? String(value).length : 4 /* null */;
  185. case 'boolean':
  186. return value ? 4 /* true */ : 5 /* false */;
  187. case 'undefined':
  188. case 'object':
  189. return 4; /* null */
  190. default:
  191. return 0;
  192. }
  193. }
  194. function spaceLength(space) {
  195. space = normalizeSpace(space);
  196. return typeof space === 'string' ? space.length : 0;
  197. }
  198. var stringifyInfo = function jsonStringifyInfo(value, replacer, space, options) {
  199. function walk(holder, key, value) {
  200. if (stop) {
  201. return;
  202. }
  203. value = replaceValue(holder, key, value, replacer);
  204. let type = getType(value);
  205. // check for circular structure
  206. if (type !== PRIMITIVE && stack.has(value)) {
  207. circular.add(value);
  208. length += 4; // treat as null
  209. if (!options.continueOnCircular) {
  210. stop = true;
  211. }
  212. return;
  213. }
  214. switch (type) {
  215. case PRIMITIVE:
  216. if (value !== undefined || Array.isArray(holder)) {
  217. length += primitiveLength(value);
  218. } else if (holder === root) {
  219. length += 9; // FIXME: that's the length of undefined, should we normalize behaviour to convert it to null?
  220. }
  221. break;
  222. case OBJECT: {
  223. if (visited.has(value)) {
  224. duplicate.add(value);
  225. length += visited.get(value);
  226. break;
  227. }
  228. const valueLength = length;
  229. let entries = 0;
  230. length += 2; // {}
  231. stack.add(value);
  232. for (const key in value) {
  233. if (hasOwnProperty.call(value, key) && (allowlist === null || allowlist.has(key))) {
  234. const prevLength = length;
  235. walk(value, key, value[key]);
  236. if (prevLength !== length) {
  237. // value is printed
  238. length += stringLength(key) + 1; // "key":
  239. entries++;
  240. }
  241. }
  242. }
  243. if (entries > 1) {
  244. length += entries - 1; // commas
  245. }
  246. stack.delete(value);
  247. if (space > 0 && entries > 0) {
  248. length += (1 + (stack.size + 1) * space + 1) * entries; // for each key-value: \n{space}
  249. length += 1 + stack.size * space; // for }
  250. }
  251. visited.set(value, length - valueLength);
  252. break;
  253. }
  254. case ARRAY: {
  255. if (visited.has(value)) {
  256. duplicate.add(value);
  257. length += visited.get(value);
  258. break;
  259. }
  260. const valueLength = length;
  261. length += 2; // []
  262. stack.add(value);
  263. for (let i = 0; i < value.length; i++) {
  264. walk(value, i, value[i]);
  265. }
  266. if (value.length > 1) {
  267. length += value.length - 1; // commas
  268. }
  269. stack.delete(value);
  270. if (space > 0 && value.length > 0) {
  271. length += (1 + (stack.size + 1) * space) * value.length; // for each element: \n{space}
  272. length += 1 + stack.size * space; // for ]
  273. }
  274. visited.set(value, length - valueLength);
  275. break;
  276. }
  277. case PROMISE:
  278. case STRING_STREAM:
  279. async.add(value);
  280. break;
  281. case OBJECT_STREAM:
  282. length += 2; // []
  283. async.add(value);
  284. break;
  285. }
  286. }
  287. let allowlist = null;
  288. replacer = normalizeReplacer(replacer);
  289. if (Array.isArray(replacer)) {
  290. allowlist = new Set(replacer);
  291. replacer = null;
  292. }
  293. space = spaceLength(space);
  294. options = options || {};
  295. const visited = new Map();
  296. const stack = new Set();
  297. const duplicate = new Set();
  298. const circular = new Set();
  299. const async = new Set();
  300. const getType = options.async ? getTypeAsync : getTypeNative;
  301. const root = { '': value };
  302. let stop = false;
  303. let length = 0;
  304. walk(root, '', value);
  305. return {
  306. minLength: isNaN(length) ? Infinity : length,
  307. circular: [...circular],
  308. duplicate: [...duplicate],
  309. async: [...async]
  310. };
  311. };
  312. var stringifyStreamBrowser = () => {
  313. throw new Error('Method is not supported');
  314. };
  315. var textDecoderBrowser = TextDecoder;
  316. const { isReadableStream } = utils;
  317. const STACK_OBJECT = 1;
  318. const STACK_ARRAY = 2;
  319. const decoder = new textDecoderBrowser();
  320. function isObject(value) {
  321. return value !== null && typeof value === 'object';
  322. }
  323. function adjustPosition(error, parser) {
  324. if (error.name === 'SyntaxError' && parser.jsonParseOffset) {
  325. error.message = error.message.replace(/at position (\d+)/, (_, pos) =>
  326. 'at position ' + (Number(pos) + parser.jsonParseOffset)
  327. );
  328. }
  329. return error;
  330. }
  331. function append(array, elements) {
  332. // Note: Avoid to use array.push(...elements) since it may lead to
  333. // "RangeError: Maximum call stack size exceeded" for a long arrays
  334. const initialLength = array.length;
  335. array.length += elements.length;
  336. for (let i = 0; i < elements.length; i++) {
  337. array[initialLength + i] = elements[i];
  338. }
  339. }
  340. var parseChunked = function(chunkEmitter) {
  341. let parser = new ChunkParser();
  342. if (isObject(chunkEmitter) && isReadableStream(chunkEmitter)) {
  343. return new Promise((resolve, reject) => {
  344. chunkEmitter
  345. .on('data', chunk => {
  346. try {
  347. parser.push(chunk);
  348. } catch (e) {
  349. reject(adjustPosition(e, parser));
  350. parser = null;
  351. }
  352. })
  353. .on('error', (e) => {
  354. parser = null;
  355. reject(e);
  356. })
  357. .on('end', () => {
  358. try {
  359. resolve(parser.finish());
  360. } catch (e) {
  361. reject(adjustPosition(e, parser));
  362. } finally {
  363. parser = null;
  364. }
  365. });
  366. });
  367. }
  368. if (typeof chunkEmitter === 'function') {
  369. const iterator = chunkEmitter();
  370. if (isObject(iterator) && (Symbol.iterator in iterator || Symbol.asyncIterator in iterator)) {
  371. return new Promise(async (resolve, reject) => {
  372. try {
  373. for await (const chunk of iterator) {
  374. parser.push(chunk);
  375. }
  376. resolve(parser.finish());
  377. } catch (e) {
  378. reject(adjustPosition(e, parser));
  379. } finally {
  380. parser = null;
  381. }
  382. });
  383. }
  384. }
  385. throw new Error(
  386. 'Chunk emitter should be readable stream, generator, ' +
  387. 'async generator or function returning an iterable object'
  388. );
  389. };
  390. class ChunkParser {
  391. constructor() {
  392. this.value = undefined;
  393. this.valueStack = null;
  394. this.stack = new Array(100);
  395. this.lastFlushDepth = 0;
  396. this.flushDepth = 0;
  397. this.stateString = false;
  398. this.stateStringEscape = false;
  399. this.pendingByteSeq = null;
  400. this.pendingChunk = null;
  401. this.chunkOffset = 0;
  402. this.jsonParseOffset = 0;
  403. }
  404. parseAndAppend(fragment, wrap) {
  405. // Append new entries or elements
  406. if (this.stack[this.lastFlushDepth - 1] === STACK_OBJECT) {
  407. if (wrap) {
  408. this.jsonParseOffset--;
  409. fragment = '{' + fragment + '}';
  410. }
  411. Object.assign(this.valueStack.value, JSON.parse(fragment));
  412. } else {
  413. if (wrap) {
  414. this.jsonParseOffset--;
  415. fragment = '[' + fragment + ']';
  416. }
  417. append(this.valueStack.value, JSON.parse(fragment));
  418. }
  419. }
  420. prepareAddition(fragment) {
  421. const { value } = this.valueStack;
  422. const expectComma = Array.isArray(value)
  423. ? value.length !== 0
  424. : Object.keys(value).length !== 0;
  425. if (expectComma) {
  426. // Skip a comma at the beginning of fragment, otherwise it would
  427. // fail to parse
  428. if (fragment[0] === ',') {
  429. this.jsonParseOffset++;
  430. return fragment.slice(1);
  431. }
  432. // When value (an object or array) is not empty and a fragment
  433. // doesn't start with a comma, a single valid fragment starting
  434. // is a closing bracket. If it's not, a prefix is adding to fail
  435. // parsing. Otherwise, the sequence of chunks can be successfully
  436. // parsed, although it should not, e.g. ["[{}", "{}]"]
  437. if (fragment[0] !== '}' && fragment[0] !== ']') {
  438. this.jsonParseOffset -= 3;
  439. return '[[]' + fragment;
  440. }
  441. }
  442. return fragment;
  443. }
  444. flush(chunk, start, end) {
  445. let fragment = chunk.slice(start, end);
  446. // Save position correction an error in JSON.parse() if any
  447. this.jsonParseOffset = this.chunkOffset + start;
  448. // Prepend pending chunk if any
  449. if (this.pendingChunk !== null) {
  450. fragment = this.pendingChunk + fragment;
  451. this.jsonParseOffset -= this.pendingChunk.length;
  452. this.pendingChunk = null;
  453. }
  454. if (this.flushDepth === this.lastFlushDepth) {
  455. // Depth didn't changed, so it's a root value or entry/element set
  456. if (this.flushDepth > 0) {
  457. this.parseAndAppend(this.prepareAddition(fragment), true);
  458. } else {
  459. // That's an entire value on a top level
  460. this.value = JSON.parse(fragment);
  461. this.valueStack = {
  462. value: this.value,
  463. prev: null
  464. };
  465. }
  466. } else if (this.flushDepth > this.lastFlushDepth) {
  467. // Add missed closing brackets/parentheses
  468. for (let i = this.flushDepth - 1; i >= this.lastFlushDepth; i--) {
  469. fragment += this.stack[i] === STACK_OBJECT ? '}' : ']';
  470. }
  471. if (this.lastFlushDepth === 0) {
  472. // That's a root value
  473. this.value = JSON.parse(fragment);
  474. this.valueStack = {
  475. value: this.value,
  476. prev: null
  477. };
  478. } else {
  479. this.parseAndAppend(this.prepareAddition(fragment), true);
  480. }
  481. // Move down to the depths to the last object/array, which is current now
  482. for (let i = this.lastFlushDepth || 1; i < this.flushDepth; i++) {
  483. let value = this.valueStack.value;
  484. if (this.stack[i - 1] === STACK_OBJECT) {
  485. // find last entry
  486. let key;
  487. // eslint-disable-next-line curly
  488. for (key in value);
  489. value = value[key];
  490. } else {
  491. // last element
  492. value = value[value.length - 1];
  493. }
  494. this.valueStack = {
  495. value,
  496. prev: this.valueStack
  497. };
  498. }
  499. } else /* this.flushDepth < this.lastFlushDepth */ {
  500. fragment = this.prepareAddition(fragment);
  501. // Add missed opening brackets/parentheses
  502. for (let i = this.lastFlushDepth - 1; i >= this.flushDepth; i--) {
  503. this.jsonParseOffset--;
  504. fragment = (this.stack[i] === STACK_OBJECT ? '{' : '[') + fragment;
  505. }
  506. this.parseAndAppend(fragment, false);
  507. for (let i = this.lastFlushDepth - 1; i >= this.flushDepth; i--) {
  508. this.valueStack = this.valueStack.prev;
  509. }
  510. }
  511. this.lastFlushDepth = this.flushDepth;
  512. }
  513. push(chunk) {
  514. if (typeof chunk !== 'string') {
  515. // Suppose chunk is Buffer or Uint8Array
  516. // Prepend uncompleted byte sequence if any
  517. if (this.pendingByteSeq !== null) {
  518. const origRawChunk = chunk;
  519. chunk = new Uint8Array(this.pendingByteSeq.length + origRawChunk.length);
  520. chunk.set(this.pendingByteSeq);
  521. chunk.set(origRawChunk, this.pendingByteSeq.length);
  522. this.pendingByteSeq = null;
  523. }
  524. // In case Buffer/Uint8Array, an input is encoded in UTF8
  525. // Seek for parts of uncompleted UTF8 symbol on the ending
  526. // This makes sense only if we expect more chunks and last char is not multi-bytes
  527. if (chunk[chunk.length - 1] > 127) {
  528. for (let seqLength = 0; seqLength < chunk.length; seqLength++) {
  529. const byte = chunk[chunk.length - 1 - seqLength];
  530. // 10xxxxxx - 2nd, 3rd or 4th byte
  531. // 110xxxxx – first byte of 2-byte sequence
  532. // 1110xxxx - first byte of 3-byte sequence
  533. // 11110xxx - first byte of 4-byte sequence
  534. if (byte >> 6 === 3) {
  535. seqLength++;
  536. // If the sequence is really incomplete, then preserve it
  537. // for the future chunk and cut off it from the current chunk
  538. if ((seqLength !== 4 && byte >> 3 === 0b11110) ||
  539. (seqLength !== 3 && byte >> 4 === 0b1110) ||
  540. (seqLength !== 2 && byte >> 5 === 0b110)) {
  541. this.pendingByteSeq = chunk.slice(chunk.length - seqLength);
  542. chunk = chunk.slice(0, -seqLength);
  543. }
  544. break;
  545. }
  546. }
  547. }
  548. // Convert chunk to a string, since single decode per chunk
  549. // is much effective than decode multiple small substrings
  550. chunk = decoder.decode(chunk);
  551. }
  552. const chunkLength = chunk.length;
  553. let lastFlushPoint = 0;
  554. let flushPoint = 0;
  555. // Main scan loop
  556. scan: for (let i = 0; i < chunkLength; i++) {
  557. if (this.stateString) {
  558. for (; i < chunkLength; i++) {
  559. if (this.stateStringEscape) {
  560. this.stateStringEscape = false;
  561. } else {
  562. switch (chunk.charCodeAt(i)) {
  563. case 0x22: /* " */
  564. this.stateString = false;
  565. continue scan;
  566. case 0x5C: /* \ */
  567. this.stateStringEscape = true;
  568. }
  569. }
  570. }
  571. break;
  572. }
  573. switch (chunk.charCodeAt(i)) {
  574. case 0x22: /* " */
  575. this.stateString = true;
  576. this.stateStringEscape = false;
  577. break;
  578. case 0x2C: /* , */
  579. flushPoint = i;
  580. break;
  581. case 0x7B: /* { */
  582. // Open an object
  583. flushPoint = i + 1;
  584. this.stack[this.flushDepth++] = STACK_OBJECT;
  585. break;
  586. case 0x5B: /* [ */
  587. // Open an array
  588. flushPoint = i + 1;
  589. this.stack[this.flushDepth++] = STACK_ARRAY;
  590. break;
  591. case 0x5D: /* ] */
  592. case 0x7D: /* } */
  593. // Close an object or array
  594. flushPoint = i + 1;
  595. this.flushDepth--;
  596. if (this.flushDepth < this.lastFlushDepth) {
  597. this.flush(chunk, lastFlushPoint, flushPoint);
  598. lastFlushPoint = flushPoint;
  599. }
  600. break;
  601. case 0x09: /* \t */
  602. case 0x0A: /* \n */
  603. case 0x0D: /* \r */
  604. case 0x20: /* space */
  605. // Move points forward when they points on current position and it's a whitespace
  606. if (lastFlushPoint === i) {
  607. lastFlushPoint++;
  608. }
  609. if (flushPoint === i) {
  610. flushPoint++;
  611. }
  612. break;
  613. }
  614. }
  615. if (flushPoint > lastFlushPoint) {
  616. this.flush(chunk, lastFlushPoint, flushPoint);
  617. }
  618. // Produce pendingChunk if something left
  619. if (flushPoint < chunkLength) {
  620. if (this.pendingChunk !== null) {
  621. // When there is already a pending chunk then no flush happened,
  622. // appending entire chunk to pending one
  623. this.pendingChunk += chunk;
  624. } else {
  625. // Create a pending chunk, it will start with non-whitespace since
  626. // flushPoint was moved forward away from whitespaces on scan
  627. this.pendingChunk = chunk.slice(flushPoint, chunkLength);
  628. }
  629. }
  630. this.chunkOffset += chunkLength;
  631. }
  632. finish() {
  633. if (this.pendingChunk !== null) {
  634. this.flush('', 0, 0);
  635. this.pendingChunk = null;
  636. }
  637. return this.value;
  638. }
  639. }
  640. var src = {
  641. version: version,
  642. stringifyInfo: stringifyInfo,
  643. stringifyStream: stringifyStreamBrowser,
  644. parseChunked: parseChunked
  645. };
  646. return src;
  647. }));