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,QAAQ,EAAE,CAAC,EAAE,CAAC,CAC/C,CAAC;QAEF,EAAE,CACA,wDAAwD,EACxD,IAAI,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CACjE,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;QAC9B,EAAE,CAAC,wDAAwD,EAAE,GAAG,EAAE;YAChE,EAAE,CAAC,MAAM,CACP,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,EAAE;gBACjC,MAAM,CAAC,SAAS,CAAC,iBAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACrD,CAAC,CAAC,CACH,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import * as fc from \"fast-check\";\nimport { satisfies } from \"semver\";\nimport { stringify, Options } from \"./index\";\n\n// Declare global window type.\ndeclare const window: any;\n\n// Evaluate a string into JavaScript\nconst evalValue = (str: string | undefined) => {\n // tslint:disable-next-line no-eval\n return eval(`(${str})`);\n};\n\n/**\n * Create a quick test function wrapper.\n */\nfunction test(\n value: any,\n result: string,\n indent?: string | number | null,\n options?: Options\n) {\n return () => {\n expect(stringify(value, null, indent, options)).toEqual(result);\n };\n}\n\n/**\n * Create a wrapper for round-trip eval tests.\n */\nfunction testRoundTrip(\n expression: string,\n indent?: string | number,\n options?: Options\n) {\n return () => test(evalValue(expression), expression, indent, options)();\n}\n\n/**\n * Check if syntax is supported.\n */\nfunction isSupported(expr: string) {\n try {\n // tslint:disable-next-line no-eval\n eval(expr);\n return true;\n } catch (err) {\n if (err.name === \"SyntaxError\") return false;\n throw err;\n }\n}\n\n/**\n * Generate a list of test cases to run.\n */\nfunction cases(cases: (string | undefined)[]) {\n return () => {\n for (const value of cases) {\n if (value) it(value, testRoundTrip(value));\n }\n };\n}\n\n/**\n * Conditionally execute test cases.\n */\nfunction describeIf(\n description: string,\n condition: boolean,\n fn: jest.EmptyFunction\n) {\n return condition ? describe(description, fn) : describe.skip(description, fn);\n}\n\ndescribe(\"javascript-stringify\", () => {\n describe(\"types\", () => {\n describe(\"booleans\", () => {\n it(\"should be stringified\", test(true, \"true\"));\n });\n\n describe(\"strings\", () => {\n it(\"should wrap in single quotes\", test(\"string\", \"'string'\"));\n\n it(\"should escape quote characters\", test(\"'test'\", \"'\\\\'test\\\\''\"));\n\n it(\n \"should escape control characters\",\n test(\"multi\\nline\", \"'multi\\\\nline'\")\n );\n\n it(\"should escape back slashes\", test(\"back\\\\slash\", \"'back\\\\\\\\slash'\"));\n\n it(\n \"should escape certain unicode sequences\",\n test(\"\\u0602\", \"'\\\\u0602'\")\n );\n });\n\n describe(\"numbers\", () => {\n it(\"should stringify integers\", test(10, \"10\"));\n\n it(\"should stringify floats\", test(10.5, \"10.5\"));\n\n it('should stringify \"NaN\"', test(10.5, \"10.5\"));\n\n it('should stringify \"Infinity\"', test(Infinity, \"Infinity\"));\n\n it('should stringify \"-Infinity\"', test(-Infinity, \"-Infinity\"));\n\n it('should stringify \"-0\"', test(-0, \"-0\"));\n });\n\n describe(\"arrays\", () => {\n it(\"should stringify as array shorthand\", test([1, 2, 3], \"[1,2,3]\"));\n\n it(\n \"should indent elements\",\n test([{ x: 10 }], \"[\\n\\t{\\n\\t\\tx: 10\\n\\t}\\n]\", \"\\t\")\n );\n });\n\n describe(\"objects\", () => {\n it(\n \"should stringify as object shorthand\",\n test({ key: \"value\", \"-\": 10 }, \"{key:'value','-':10}\")\n );\n\n it(\n \"should stringify undefined keys\",\n test({ a: true, b: undefined }, \"{a:true,b:undefined}\")\n );\n\n it(\n \"should stringify omit undefined keys\",\n test({ a: true, b: undefined }, \"{a:true}\", null, {\n skipUndefinedProperties: true\n })\n );\n\n it(\n \"should quote reserved word keys\",\n test({ if: true, else: false }, \"{'if':true,'else':false}\")\n );\n\n it(\n \"should not quote Object.prototype keys\",\n test({ constructor: 1, toString: 2 }, \"{constructor:1,toString:2}\")\n );\n });\n\n describe(\"functions\", () => {\n it(\n \"should reindent function bodies\",\n test(\n evalValue(\n `function() {\n if (true) {\n return \"hello\";\n }\n }`\n ),\n 'function () {\\n if (true) {\\n return \"hello\";\\n }\\n}',\n 2\n )\n );\n\n it(\n \"should reindent function bodies in objects\",\n test(\n evalValue(`\n {\n fn: function() {\n if (true) {\n return \"hello\";\n }\n }\n }\n `),\n '{\\n fn: function () {\\n if (true) {\\n return \"hello\";\\n }\\n }\\n}',\n 2\n )\n );\n\n it(\n \"should reindent function bodies in arrays\",\n test(\n evalValue(`[\n function() {\n if (true) {\n return \"hello\";\n }\n }\n ]`),\n '[\\n function () {\\n if (true) {\\n return \"hello\";\\n }\\n }\\n]',\n 2\n )\n );\n\n it(\n \"should not need to reindent one-liners\",\n testRoundTrip(\"{\\n fn: function () { return; }\\n}\", 2)\n );\n\n it(\"should gracefully handle unexpected Function.toString formats\", () => {\n const origToString = Function.prototype.toString;\n\n Function.prototype.toString = () => \"{nope}\";\n\n try {\n expect(\n stringify(function() {\n /* Empty */\n })\n ).toEqual(\"void '{nope}'\");\n } finally {\n Function.prototype.toString = origToString;\n }\n });\n\n describe(\n \"omit the names of their keys\",\n cases([\"{name:function () {}}\", \"{'tricky name':function () {}}\"])\n );\n });\n\n describe(\"native instances\", () => {\n describe(\"Date\", () => {\n const date = new Date();\n\n it(\"should stringify\", test(date, \"new Date(\" + date.getTime() + \")\"));\n });\n\n describe(\"RegExp\", () => {\n it(\"should stringify as shorthand\", test(/[abc]/gi, \"/[abc]/gi\"));\n });\n\n describe(\"Number\", () => {\n it(\"should stringify\", test(new Number(10), \"new Number(10)\"));\n });\n\n describe(\"String\", () => {\n it(\"should stringify\", test(new String(\"abc\"), \"new String('abc')\"));\n });\n\n describe(\"Boolean\", () => {\n it(\"should stringify\", test(new Boolean(true), \"new Boolean(true)\"));\n });\n\n describeIf(\"Buffer\", typeof (Buffer as any) === \"function\", () => {\n it(\"should stringify\", test(Buffer.from(\"test\"), \"new Buffer('test')\"));\n });\n\n describeIf(\"BigInt\", typeof (BigInt as any) === \"function\", () => {\n it(\"should stringify\", test(BigInt(\"10\"), \"BigInt('10')\"));\n });\n\n describe(\"Error\", () => {\n it(\"should stringify\", test(new Error(\"test\"), \"new Error('test')\"));\n });\n\n describe(\"unknown native type\", () => {\n it(\n \"should be omitted\",\n test(\n {\n k:\n typeof (process as any) === \"undefined\"\n ? window.navigator\n : process\n },\n \"{}\"\n )\n );\n });\n });\n\n describeIf(\"ES6\", typeof (Array as any).from === \"function\", () => {\n describeIf(\"Map\", typeof (Map as any) === \"function\", () => {\n it(\n \"should stringify\",\n test(new Map([[\"key\", \"value\"]]), \"new Map([['key','value']])\")\n );\n });\n\n describeIf(\"Set\", typeof (Set as any) === \"function\", () => {\n it(\n \"should stringify\",\n test(new Set([\"key\", \"value\"]), \"new Set(['key','value'])\")\n );\n });\n\n describe(\"arrow functions\", () => {\n describe(\n \"should stringify\",\n cases([\n \"(a, b) => a + b\",\n \"o => { return o.a + o.b; }\",\n \"(a, b) => { if (a) { return b; } }\",\n \"(a, b) => ({ [a]: b })\",\n \"a => b => () => a + b\"\n ])\n );\n\n it(\n \"should reindent function bodies\",\n test(\n evalValue(\n \" () => {\\n\" +\n \" if (true) {\\n\" +\n ' return \"hello\";\\n' +\n \" }\\n\" +\n \" }\"\n ),\n '() => {\\n if (true) {\\n return \"hello\";\\n }\\n}',\n 2\n )\n );\n\n describeIf(\"arrows with patterns\", isSupported(\"({x}) => x\"), () => {\n describe(\n \"should stringify\",\n cases([\n \"({ x, y }) => x + y\",\n \"({ x, y }) => { if (x === '}') { return y; } }\",\n \"({ x, y = /[/})]/.test(x) }) => { return y ? x : 0; }\"\n ])\n );\n });\n });\n\n describe(\"generators\", () => {\n it(\"should stringify\", testRoundTrip(\"function* (x) { yield x; }\"));\n });\n\n describe(\"class notation\", () => {\n it(\"should stringify classes\", testRoundTrip(\"class {}\"));\n it(\n \"should stringify class and method\",\n testRoundTrip(\"class { method() {} }\")\n );\n it(\n \"should stringify with newline\",\n testRoundTrip(\"class\\n{ method() {} }\")\n );\n it(\n \"should stringify with comment\",\n testRoundTrip(\"class/*test*/\\n{ method() {} }\")\n );\n });\n\n describe(\"method notation\", () => {\n it(\"should stringify\", testRoundTrip(\"{a(b, c) { return b + c; }}\"));\n\n it(\n \"should stringify generator methods\",\n testRoundTrip(\"{*a(b) { yield b; }}\")\n );\n\n describe(\n \"should not be fooled by tricky names\",\n cases([\n \"{'function a'(b, c) { return b + c; }}\",\n \"{'a(a'(b, c) { return b + c; }}\",\n \"{'() => function '() {}}\",\n \"{'['() { return x[y]()\\n{ return true; }}}\",\n \"{'() { return false;//'() { return true;\\n}}\"\n ])\n );\n\n it(\n \"should not be fooled by tricky generator names\",\n testRoundTrip(\"{*'function a'(b, c) { return b + c; }}\")\n );\n\n it(\n \"should not be fooled by empty names\",\n testRoundTrip(\"{''(b, c) { return b + c; }}\")\n );\n\n it(\"should not be fooled by keys that look like functions\", () => {\n const fn = evalValue('{ \"() => \": () => () => 42 }')[\"() => \"];\n expect(stringify(fn)).toEqual(\"() => () => 42\");\n });\n\n describe(\n \"should not be fooled by arrow functions\",\n cases([\n \"{a:(b, c) => b + c}\",\n \"{a:a => a + 1}\",\n \"{'() => ':() => () => 42}\",\n '{\\'() => \"\\':() => \"() {//\"}',\n '{\\'() => \"\\':() => \"() {`//\"}',\n '{\\'() => \"\\':() => \"() {`${//\"}',\n '{\\'() => \"\\':() => \"() {/*//\"}',\n satisfies(process.versions.node, \"<=4 || >=10\")\n ? \"{'a => function ':a => function () { return a + 1; }}\"\n : undefined\n ])\n );\n\n describe(\n \"should not be fooled by regexp literals\",\n cases([\n \"{' '(s) { return /}/.test(s); }}\",\n \"{' '(s) { return /abc/ .test(s); }}\",\n \"{' '() { return x / y; // /}\\n}}\",\n \"{' '() { return / y; }//* } */}}\",\n \"{' '() { return delete / y; }/.x}}\",\n \"{' '() { switch (x) { case / y; }}/: }}}\",\n \"{' '() { if (x) return; else / y;}/; }}\",\n \"{' '() { return x in / y;}/; }}\",\n \"{' '() { return x instanceof / y;}/; }}\",\n \"{' '() { return new / y;}/.x; }}\",\n \"{' '() { throw / y;}/.x; }}\",\n \"{' '() { return typeof / y;}/; }}\",\n \"{' '() { void / y;}/; }}\",\n \"{' '() { return x, / y;}/; }}\",\n \"{' '() { return x; / y;}/; }}\",\n \"{' '() { return { x: / y;}/ }; }}\",\n \"{' '() { return x + / y;}/.x; }}\",\n \"{' '() { return x - / y;}/.x; }}\",\n \"{' '() { return !/ y;}/; }}\",\n \"{' '() { return ~/ y;}/.x; }}\",\n \"{' '() { return x && / y;}/; }}\",\n \"{' '() { return x || / y;}/; }}\",\n \"{' '() { return x ^ / y;}/.x; }}\",\n \"{' '() { return x * / y;}/.x; }}\",\n \"{' '() { return x / / y;}/.x; }}\",\n \"{' '() { return x % / y;}/.x; }}\",\n \"{' '() { return x < / y;}/.x; }}\",\n \"{' '() { return x > / y;}/.x; }}\",\n \"{' '() { return x <= / y;}/.x; }}\",\n \"{' '() { return x /= / y;}/.x; }}\",\n \"{' '() { return x ? / y;}/ : false; }}\"\n ])\n );\n\n describe(\"should not be fooled by computed names\", () => {\n it(\n \"1\",\n test(\n evalValue('{ [\"foobar\".slice(3)](x) { return x + 1; } }'),\n \"{bar(x) { return x + 1; }}\"\n )\n );\n\n it(\n \"2\",\n test(\n evalValue(\n '{[((s,a,b)=>a+s(a)+\",\"+s(b)+b)(JSON.stringify,\"[((s,a,b)=>a+s(a)+\\\\\",\\\\\"+s(b)+b)(JSON.stringify,\",\")]() {}\")]() {}}'\n ),\n '{\\'[((s,a,b)=>a+s(a)+\",\"+s(b)+b)(JSON.stringify,\"[((s,a,b)=>a+s(a)+\\\\\\\\\",\\\\\\\\\"+s(b)+b)(JSON.stringify,\",\")]() {}\")]() {}\\'() {}}'\n )\n );\n\n it(\n \"3\",\n test(\n evalValue(\n '{[`over${`6${\"0\".repeat(3)}`.replace(\"6\", \"9\")}`]() { this.activateHair(); }}'\n ),\n \"{over9000() { this.activateHair(); }}\"\n )\n );\n\n it(\n \"4\",\n test(evalValue(\"{[\\\"() {'\\\"]() {''}}\"), \"{'() {\\\\''() {''}}\")\n );\n\n it(\"5\", test(evalValue('{[\"() {`\"]() {``}}'), \"{'() {`'() {``}}\"));\n\n it(\n \"6\",\n test(\n evalValue('{[\"() {/*\"]() {/*`${()=>{/*}*/}}'),\n \"{'() {/*'() {/*`${()=>{/*}*/}}\"\n )\n );\n });\n\n // These two cases demonstrate that branching on\n // METHOD_NAMES_ARE_QUOTED is unavoidable--you can't write code\n // without it that will pass both of these cases on both node.js 4\n // and node.js 10. (If you think you can, consider that the name and\n // toString of the first case when executed on node.js 10 are\n // identical to the name and toString of the second case when\n // executed on node.js 4, so good luck telling them apart without\n // knowing which node you're on.)\n describe(\"should handle different versions of node correctly\", () => {\n it(\n \"1\",\n test(\n evalValue(\n '{[((s,a,b)=>a+s(a)+\",\"+s(b)+b)(JSON.stringify,\"[((s,a,b)=>a+s(a)+\\\\\",\\\\\"+s(b)+b)(JSON.stringify,\",\")]() { return 0; /*\")]() { return 0; /*() {/* */ return 1;}}'\n ),\n '{\\'[((s,a,b)=>a+s(a)+\",\"+s(b)+b)(JSON.stringify,\"[((s,a,b)=>a+s(a)+\\\\\\\\\",\\\\\\\\\"+s(b)+b)(JSON.stringify,\",\")]() { return 0; /*\")]() { return 0; /*\\'() { return 0; /*() {/* */ return 1;}}'\n )\n );\n\n it(\n \"2\",\n test(\n evalValue(\n '{\\'[((s,a,b)=>a+s(a)+\",\"+s(b)+b)(JSON.stringify,\"[((s,a,b)=>a+s(a)+\\\\\\\\\",\\\\\\\\\"+s(b)+b)(JSON.stringify,\",\")]() { return 0; /*\")]() { return 0; /*\\'() {/* */ return 1;}}'\n ),\n '{\\'[((s,a,b)=>a+s(a)+\",\"+s(b)+b)(JSON.stringify,\"[((s,a,b)=>a+s(a)+\\\\\\\\\",\\\\\\\\\"+s(b)+b)(JSON.stringify,\",\")]() { return 0; /*\")]() { return 0; /*\\'() {/* */ return 1;}}'\n )\n );\n });\n\n it(\n \"should not be fooled by comments\",\n test(\n evalValue(\n \"{'method' /* a comment! */ () /* another comment! */ {}}\"\n ),\n \"{method() /* another comment! */ {}}\"\n )\n );\n\n it(\"should stringify extracted methods\", () => {\n const fn = evalValue(\"{ foo(x) { return x + 1; } }\").foo;\n expect(stringify(fn)).toEqual(\"function foo(x) { return x + 1; }\");\n });\n\n it(\"should stringify extracted generators\", () => {\n const fn = evalValue(\"{ *foo(x) { yield x; } }\").foo;\n expect(stringify(fn)).toEqual(\"function* foo(x) { yield x; }\");\n });\n\n it(\"should stringify extracted methods with tricky names\", () => {\n const fn = evalValue('{ \"a(a\"(x) { return x + 1; } }')[\"a(a\"];\n expect(stringify(fn)).toEqual(\"function (x) { return x + 1; }\");\n });\n\n it(\"should stringify extracted methods with arrow-like tricky names\", () => {\n const fn = evalValue('{ \"() => function \"(x) { return x + 1; } }')[\n \"() => function \"\n ];\n expect(stringify(fn)).toEqual(\"function (x) { return x + 1; }\");\n });\n\n it(\"should stringify extracted methods with empty names\", () => {\n const fn = evalValue('{ \"\"(x) { return x + 1; } }')[\"\"];\n expect(stringify(fn)).toEqual(\"function (x) { return x + 1; }\");\n });\n\n it(\"should handle transplanted names\", () => {\n const fn = evalValue(\"{ foo(x) { return x + 1; } }\").foo;\n\n expect(stringify({ bar: fn })).toEqual(\n \"{bar:function foo(x) { return x + 1; }}\"\n );\n });\n\n it(\"should handle transplanted names with generators\", () => {\n const fn = evalValue(\"{ *foo(x) { yield x; } }\").foo;\n\n expect(stringify({ bar: fn })).toEqual(\n \"{bar:function* foo(x) { yield x; }}\"\n );\n });\n\n it(\n \"should reindent methods\",\n test(\n evalValue(\n \" {\\n\" +\n \" fn() {\\n\" +\n \" if (true) {\\n\" +\n ' return \"hello\";\\n' +\n \" }\\n\" +\n \" }\\n\" +\n \" }\"\n ),\n '{\\n fn() {\\n if (true) {\\n return \"hello\";\\n }\\n }\\n}',\n 2\n )\n );\n });\n });\n\n describe(\"ES2017\", () => {\n describeIf(\n \"async functions\",\n isSupported(\"(async function () {})\"),\n () => {\n it(\n \"should stringify\",\n testRoundTrip(\"async function (x) { await x; }\")\n );\n\n it(\"should gracefully handle unexpected Function.toString formats\", () => {\n const origToString = Function.prototype.toString;\n\n Function.prototype.toString = () => \"{nope}\";\n\n try {\n expect(stringify(evalValue(\"async function () {}\"))).toEqual(\n \"void '{nope}'\"\n );\n } finally {\n Function.prototype.toString = origToString;\n }\n });\n }\n );\n\n describeIf(\"async arrows\", isSupported(\"async () => {}\"), () => {\n describe(\n \"should stringify\",\n cases([\n \"async (x) => x + 1\",\n \"async x => x + 1\",\n \"async x => { await x.then(y => y + 1); }\"\n ])\n );\n\n describe(\n \"should stringify as object properties\",\n cases([\n \"{f:async a => a + 1}\",\n satisfies(process.versions.node, \"<=4 || >=10\")\n ? \"{'async a => function ':async a => function () { return a + 1; }}\"\n : undefined\n ])\n );\n });\n });\n\n describe(\"ES2018\", () => {\n describeIf(\n \"async generators\",\n isSupported(\"(async function* () {})\"),\n () => {\n it(\n \"should stringify\",\n testRoundTrip(\"async function* (x) { yield x; }\")\n );\n\n it(\"should gracefully handle unexpected Function.toString formats\", () => {\n const origToString = Function.prototype.toString;\n\n Function.prototype.toString = () => \"{nope}\";\n\n try {\n expect(stringify(evalValue(\"async function* () {}\"))).toEqual(\n \"void '{nope}'\"\n );\n } finally {\n Function.prototype.toString = origToString;\n }\n });\n }\n );\n });\n\n describe(\"global\", () => {\n it(\n \"should access the global in the current environment\",\n testRoundTrip(\"Function('return this')()\")\n );\n });\n });\n\n describe(\"circular references\", () => {\n it(\"should omit circular references\", () => {\n const obj: any = { key: \"value\" };\n obj.obj = obj;\n\n const result = stringify(obj);\n\n expect(result).toEqual(\"{key:'value'}\");\n });\n\n it(\"should restore value\", () => {\n const obj: any = { key: \"value\" };\n obj.obj = obj;\n\n const result = stringify(obj, null, null, { references: true });\n\n expect(result).toEqual(\n \"(function(){var x={key:'value'};x.obj=x;return x;}())\"\n );\n });\n\n it(\"should omit recursive array value\", () => {\n const obj: any = [1, 2, 3];\n obj.push(obj);\n\n const result = stringify(obj);\n\n expect(result).toEqual(\"[1,2,3,undefined]\");\n });\n\n it(\"should restore array value\", () => {\n const obj: any = [1, 2, 3];\n obj.push(obj);\n\n const result = stringify(obj, null, null, { references: true });\n\n expect(result).toEqual(\n \"(function(){var x=[1,2,3,undefined];x[3]=x;return x;}())\"\n );\n });\n\n it(\"should print repeated values when no references enabled\", () => {\n const obj: any = {};\n const child = {};\n\n obj.a = child;\n obj.b = child;\n\n const result = stringify(obj);\n\n expect(result).toEqual(\"{a:{},b:{}}\");\n });\n\n it(\"should restore repeated values\", () => {\n const obj: any = {};\n const child = {};\n\n obj.a = child;\n obj.b = child;\n\n const result = stringify(obj, null, null, { references: true });\n\n expect(result).toEqual(\"(function(){var x={a:{}};x.b=x.a;return x;}())\");\n });\n\n it(\"should restore repeated values with indentation\", function() {\n const obj: any = {};\n const child = {};\n\n obj.a = child;\n obj.b = child;\n\n const result = stringify(obj, null, 2, { references: true });\n\n expect(result).toEqual(\n \"(function () {\\nvar x = {\\n a: {}\\n};\\nx.b = x.a;\\nreturn x;\\n}())\"\n );\n });\n });\n\n describe(\"custom indent\", () => {\n it(\"string\", () => {\n const result = stringify(\n {\n test: [1, 2, 3],\n nested: {\n key: \"value\"\n }\n },\n null,\n \"\\t\"\n );\n\n expect(result).toEqual(\n \"{\\n\" +\n \"\\ttest: [\\n\\t\\t1,\\n\\t\\t2,\\n\\t\\t3\\n\\t],\\n\" +\n \"\\tnested: {\\n\\t\\tkey: 'value'\\n\\t}\\n\" +\n \"}\"\n );\n });\n\n it(\"integer\", () => {\n const result = stringify(\n {\n test: [1, 2, 3],\n nested: {\n key: \"value\"\n }\n },\n null,\n 2\n );\n\n expect(result).toEqual(\n \"{\\n\" +\n \" test: [\\n 1,\\n 2,\\n 3\\n ],\\n\" +\n \" nested: {\\n key: 'value'\\n }\\n\" +\n \"}\"\n );\n });\n\n it(\"float\", () => {\n const result = stringify(\n {\n test: [1, 2, 3],\n nested: {\n key: \"value\"\n }\n },\n null,\n 2.6\n );\n\n expect(result).toEqual(\n \"{\\n\" +\n \" test: [\\n 1,\\n 2,\\n 3\\n ],\\n\" +\n \" nested: {\\n key: 'value'\\n }\\n\" +\n \"}\"\n );\n });\n });\n\n describe(\"replacer function\", () => {\n it(\"should allow custom replacements\", () => {\n let callCount = 0;\n\n const result = stringify(\n {\n test: \"value\"\n },\n function(value, indent, next) {\n callCount++;\n\n if (typeof value === \"string\") {\n return '\"hello\"';\n }\n\n return next(value);\n }\n );\n\n expect(callCount).toEqual(2);\n expect(result).toEqual('{test:\"hello\"}');\n });\n\n it(\"change primitive to object\", () => {\n const result = stringify(\n {\n test: 10\n },\n function(value, indent, next) {\n if (typeof value === \"number\") {\n return next({ obj: \"value\" });\n }\n\n return next(value);\n }\n );\n\n expect(result).toEqual(\"{test:{obj:'value'}}\");\n });\n\n it(\"change object to primitive\", () => {\n const result = stringify(\n {\n test: 10\n },\n value => Object.prototype.toString.call(value)\n );\n\n expect(result).toEqual(\"[object Object]\");\n });\n\n it(\"should support object functions\", () => {\n function makeRaw(str: string) {\n const fn = () => {\n /* Noop. */\n };\n fn.__expression = str;\n return fn;\n }\n\n const result = stringify(\n {\n \"no-console\": makeRaw(\n `process.env.NODE_ENV === 'production' ? 'error' : 'off'`\n ),\n \"no-debugger\": makeRaw(\n `process.env.NODE_ENV === 'production' ? 'error' : 'off'`\n )\n },\n (val, indent, stringify) => {\n if (val && val.__expression) {\n return val.__expression;\n }\n return stringify(val);\n },\n 2\n );\n\n expect(result).toEqual(`{\n 'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',\n 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'\n}`);\n });\n });\n\n describe(\"max depth\", () => {\n const obj = { a: { b: { c: 1 } } };\n\n it(\"should get all object\", test(obj, \"{a:{b:{c:1}}}\"));\n\n it(\n \"should get part of the object\",\n test(obj, \"{a:{b:{}}}\", null, { maxDepth: 2 })\n );\n\n it(\n \"should get part of the object when tracking references\",\n test(obj, \"{a:{b:{}}}\", null, { maxDepth: 2, references: true })\n );\n });\n\n describe(\"property based\", () => {\n it(\"should produce string evaluating to the original value\", () => {\n fc.assert(\n fc.property(fc.anything(), value => {\n expect(evalValue(stringify(value))).toEqual(value);\n })\n );\n });\n });\n});\n"]}