function stringifyArrayReplacer (key, value, stack, replacer, spacer, indentation) {
	    if (typeof value === 'object' && value !== null && typeof value.toJSON === 'function') {
	      value = value.toJSON(key);
	    }

	    switch (typeof value) {
	      case 'string':
	        return `"${strEscape(value)}"`
	      case 'object': {
	        if (value === null) {
	          return 'null'
	        }
	        if (stack.indexOf(value) !== -1) {
	          return circularValue
	        }

	        const originalIndentation = indentation;
	        let res = '';
	        let join = ',';

	        if (Array.isArray(value)) {
	          if (value.length === 0) {
	            return '[]'
	          }
	          if (maximumDepth < stack.length + 1) {
	            return '"[Array]"'
	          }
	          stack.push(value);
	          if (spacer !== '') {
	            indentation += spacer;
	            res += `\n${indentation}`;
	            join = `,\n${indentation}`;
	          }
	          const maximumValuesToStringify = Math.min(value.length, maximumBreadth);
	          let i = 0;
	          for (; i < maximumValuesToStringify - 1; i++) {
	            const tmp = stringifyArrayReplacer(i, value[i], stack, replacer, spacer, indentation);
	            res += tmp !== undefined ? tmp : 'null';
	            res += join;
	          }
	          const tmp = stringifyArrayReplacer(i, value[i], stack, replacer, spacer, indentation);
	          res += tmp !== undefined ? tmp : 'null';
	          if (value.length - 1 > maximumBreadth) {
	            const removedKeys = value.length - maximumBreadth - 1;
	            res += `${join}"... ${getItemCount(removedKeys)} not stringified"`;
	          }
	          if (spacer !== '') {
	            res += `\n${originalIndentation}`;
	          }
	          stack.pop();
	          return `[${res}]`
	        }
	        stack.push(value);
	        let whitespace = '';
	        if (spacer !== '') {
	          indentation += spacer;
	          join = `,\n${indentation}`;
	          whitespace = ' ';
	        }
	        let separator = '';
	        for (const key of replacer) {
	          const tmp = stringifyArrayReplacer(key, value[key], stack, replacer, spacer, indentation);
	          if (tmp !== undefined) {
	            res += `${separator}"${strEscape(key)}":${whitespace}${tmp}`;
	            separator = join;
	          }
	        }
	        if (spacer !== '' && separator.length > 1) {
	          res = `\n${indentation}${res}\n${originalIndentation}`;
	        }
	        stack.pop();
	        return `{${res}}`
	      }
	      case 'number':
	        return isFinite(value) ? String(value) : fail ? fail(value) : 'null'
	      case 'boolean':
	        return value === true ? 'true' : 'false'
	      case 'undefined':
	        return undefined
	      case 'bigint':
	        if (bigint) {
	          return String(value)
	        }
	        // fallthrough
	      default:
	        return fail ? fail(value) : undefined
	    }
	  }
If the reader is active, behaves the same as {@link ReadableStream.cancel | stream.cancel(reason)}.