@dineroregnskab/eslint-plugin-custom-rules 2.0.6 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/README.md +49 -9
  2. package/eslint-plugin-custom-rules.js +10 -4
  3. package/package.json +2 -4
  4. package/rules/replace-first-with-take.js +31 -0
  5. package/rules/use-danish-currency-pipe.js +53 -0
  6. package/willy.yaml +5 -0
  7. package/node_modules/@aashutoshrathi/word-wrap/LICENSE +0 -21
  8. package/node_modules/@aashutoshrathi/word-wrap/README.md +0 -182
  9. package/node_modules/@aashutoshrathi/word-wrap/index.d.ts +0 -50
  10. package/node_modules/@aashutoshrathi/word-wrap/index.js +0 -52
  11. package/node_modules/@aashutoshrathi/word-wrap/package.json +0 -81
  12. package/node_modules/@angular-eslint/bundled-angular-compiler/README.md +0 -1
  13. package/node_modules/@angular-eslint/bundled-angular-compiler/dist/index.d.ts +0 -5
  14. package/node_modules/@angular-eslint/bundled-angular-compiler/dist/index.js +0 -32004
  15. package/node_modules/@angular-eslint/bundled-angular-compiler/package.json +0 -19
  16. package/node_modules/@angular-eslint/template-parser/LICENSE +0 -21
  17. package/node_modules/@angular-eslint/template-parser/README.md +0 -1
  18. package/node_modules/@angular-eslint/template-parser/dist/convert-source-span-to-loc.d.ts +0 -6
  19. package/node_modules/@angular-eslint/template-parser/dist/convert-source-span-to-loc.js +0 -69
  20. package/node_modules/@angular-eslint/template-parser/dist/index.d.ts +0 -44
  21. package/node_modules/@angular-eslint/template-parser/dist/index.js +0 -219
  22. package/node_modules/@angular-eslint/template-parser/package.json +0 -28
  23. package/node_modules/@eslint/eslintrc/LICENSE +0 -19
  24. package/node_modules/@eslint/eslintrc/README.md +0 -115
  25. package/node_modules/@eslint/eslintrc/conf/config-schema.js +0 -79
  26. package/node_modules/@eslint/eslintrc/conf/environments.js +0 -215
  27. package/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs +0 -1104
  28. package/node_modules/@eslint/eslintrc/dist/eslintrc-universal.cjs.map +0 -1
  29. package/node_modules/@eslint/eslintrc/dist/eslintrc.cjs +0 -4333
  30. package/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map +0 -1
  31. package/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js +0 -532
  32. package/node_modules/@eslint/eslintrc/lib/config-array/config-array.js +0 -523
  33. package/node_modules/@eslint/eslintrc/lib/config-array/config-dependency.js +0 -115
  34. package/node_modules/@eslint/eslintrc/lib/config-array/extracted-config.js +0 -145
  35. package/node_modules/@eslint/eslintrc/lib/config-array/ignore-pattern.js +0 -238
  36. package/node_modules/@eslint/eslintrc/lib/config-array/index.js +0 -19
  37. package/node_modules/@eslint/eslintrc/lib/config-array/override-tester.js +0 -225
  38. package/node_modules/@eslint/eslintrc/lib/config-array-factory.js +0 -1149
  39. package/node_modules/@eslint/eslintrc/lib/flat-compat.js +0 -318
  40. package/node_modules/@eslint/eslintrc/lib/index-universal.js +0 -29
  41. package/node_modules/@eslint/eslintrc/lib/index.js +0 -56
  42. package/node_modules/@eslint/eslintrc/lib/shared/ajv.js +0 -191
  43. package/node_modules/@eslint/eslintrc/lib/shared/config-ops.js +0 -135
  44. package/node_modules/@eslint/eslintrc/lib/shared/config-validator.js +0 -325
  45. package/node_modules/@eslint/eslintrc/lib/shared/deprecation-warnings.js +0 -63
  46. package/node_modules/@eslint/eslintrc/lib/shared/naming.js +0 -96
  47. package/node_modules/@eslint/eslintrc/lib/shared/relative-module-resolver.js +0 -42
  48. package/node_modules/@eslint/eslintrc/lib/shared/types.js +0 -149
  49. package/node_modules/@eslint/eslintrc/package.json +0 -82
  50. package/node_modules/@eslint/eslintrc/universal.js +0 -9
  51. package/node_modules/@eslint/js/LICENSE +0 -19
  52. package/node_modules/@eslint/js/README.md +0 -57
  53. package/node_modules/@eslint/js/package.json +0 -31
  54. package/node_modules/@eslint/js/src/configs/eslint-all.js +0 -211
  55. package/node_modules/@eslint/js/src/configs/eslint-recommended.js +0 -76
  56. package/node_modules/@eslint/js/src/index.js +0 -17
  57. package/node_modules/@eslint-community/eslint-utils/LICENSE +0 -21
  58. package/node_modules/@eslint-community/eslint-utils/README.md +0 -37
  59. package/node_modules/@eslint-community/eslint-utils/index.js +0 -2068
  60. package/node_modules/@eslint-community/eslint-utils/index.js.map +0 -1
  61. package/node_modules/@eslint-community/eslint-utils/index.mjs +0 -2027
  62. package/node_modules/@eslint-community/eslint-utils/index.mjs.map +0 -1
  63. package/node_modules/@eslint-community/eslint-utils/package.json +0 -73
  64. package/node_modules/@eslint-community/regexpp/LICENSE +0 -21
  65. package/node_modules/@eslint-community/regexpp/README.md +0 -177
  66. package/node_modules/@eslint-community/regexpp/index.d.ts +0 -1065
  67. package/node_modules/@eslint-community/regexpp/index.js +0 -2747
  68. package/node_modules/@eslint-community/regexpp/index.js.map +0 -1
  69. package/node_modules/@eslint-community/regexpp/index.mjs +0 -2737
  70. package/node_modules/@eslint-community/regexpp/index.mjs.map +0 -1
  71. package/node_modules/@eslint-community/regexpp/package.json +0 -93
  72. package/node_modules/@humanwhocodes/config-array/LICENSE +0 -201
  73. package/node_modules/@humanwhocodes/config-array/README.md +0 -342
  74. package/node_modules/@humanwhocodes/config-array/api.js +0 -1061
  75. package/node_modules/@humanwhocodes/config-array/package.json +0 -61
  76. package/node_modules/@humanwhocodes/module-importer/CHANGELOG.md +0 -15
  77. package/node_modules/@humanwhocodes/module-importer/LICENSE +0 -201
  78. package/node_modules/@humanwhocodes/module-importer/README.md +0 -80
  79. package/node_modules/@humanwhocodes/module-importer/dist/module-importer.cjs +0 -22
  80. package/node_modules/@humanwhocodes/module-importer/dist/module-importer.d.cts +0 -27
  81. package/node_modules/@humanwhocodes/module-importer/dist/module-importer.d.ts +0 -2
  82. package/node_modules/@humanwhocodes/module-importer/dist/module-importer.js +0 -18
  83. package/node_modules/@humanwhocodes/module-importer/package.json +0 -65
  84. package/node_modules/@humanwhocodes/module-importer/src/module-importer.cjs +0 -81
  85. package/node_modules/@humanwhocodes/module-importer/src/module-importer.js +0 -22
  86. package/node_modules/@humanwhocodes/object-schema/.eslintrc.js +0 -29
  87. package/node_modules/@humanwhocodes/object-schema/.github/workflows/nodejs-test.yml +0 -27
  88. package/node_modules/@humanwhocodes/object-schema/.github/workflows/release-please.yml +0 -39
  89. package/node_modules/@humanwhocodes/object-schema/CHANGELOG.md +0 -26
  90. package/node_modules/@humanwhocodes/object-schema/LICENSE +0 -29
  91. package/node_modules/@humanwhocodes/object-schema/README.md +0 -234
  92. package/node_modules/@humanwhocodes/object-schema/package.json +0 -33
  93. package/node_modules/@humanwhocodes/object-schema/src/index.js +0 -7
  94. package/node_modules/@humanwhocodes/object-schema/src/merge-strategy.js +0 -53
  95. package/node_modules/@humanwhocodes/object-schema/src/object-schema.js +0 -301
  96. package/node_modules/@humanwhocodes/object-schema/src/validation-strategy.js +0 -102
  97. package/node_modules/@humanwhocodes/object-schema/tests/merge-strategy.js +0 -66
  98. package/node_modules/@humanwhocodes/object-schema/tests/object-schema.js +0 -659
  99. package/node_modules/@humanwhocodes/object-schema/tests/validation-strategy.js +0 -186
  100. package/node_modules/@nodelib/fs.scandir/LICENSE +0 -21
  101. package/node_modules/@nodelib/fs.scandir/README.md +0 -171
  102. package/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts +0 -20
  103. package/node_modules/@nodelib/fs.scandir/out/adapters/fs.js +0 -19
  104. package/node_modules/@nodelib/fs.scandir/out/constants.d.ts +0 -4
  105. package/node_modules/@nodelib/fs.scandir/out/constants.js +0 -17
  106. package/node_modules/@nodelib/fs.scandir/out/index.d.ts +0 -12
  107. package/node_modules/@nodelib/fs.scandir/out/index.js +0 -26
  108. package/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts +0 -7
  109. package/node_modules/@nodelib/fs.scandir/out/providers/async.js +0 -104
  110. package/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts +0 -1
  111. package/node_modules/@nodelib/fs.scandir/out/providers/common.js +0 -13
  112. package/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts +0 -5
  113. package/node_modules/@nodelib/fs.scandir/out/providers/sync.js +0 -54
  114. package/node_modules/@nodelib/fs.scandir/out/settings.d.ts +0 -20
  115. package/node_modules/@nodelib/fs.scandir/out/settings.js +0 -24
  116. package/node_modules/@nodelib/fs.scandir/out/types/index.d.ts +0 -20
  117. package/node_modules/@nodelib/fs.scandir/out/types/index.js +0 -2
  118. package/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts +0 -2
  119. package/node_modules/@nodelib/fs.scandir/out/utils/fs.js +0 -19
  120. package/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts +0 -2
  121. package/node_modules/@nodelib/fs.scandir/out/utils/index.js +0 -5
  122. package/node_modules/@nodelib/fs.scandir/package.json +0 -44
  123. package/node_modules/@nodelib/fs.stat/LICENSE +0 -21
  124. package/node_modules/@nodelib/fs.stat/README.md +0 -126
  125. package/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts +0 -13
  126. package/node_modules/@nodelib/fs.stat/out/adapters/fs.js +0 -17
  127. package/node_modules/@nodelib/fs.stat/out/index.d.ts +0 -12
  128. package/node_modules/@nodelib/fs.stat/out/index.js +0 -26
  129. package/node_modules/@nodelib/fs.stat/out/providers/async.d.ts +0 -4
  130. package/node_modules/@nodelib/fs.stat/out/providers/async.js +0 -36
  131. package/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts +0 -3
  132. package/node_modules/@nodelib/fs.stat/out/providers/sync.js +0 -23
  133. package/node_modules/@nodelib/fs.stat/out/settings.d.ts +0 -16
  134. package/node_modules/@nodelib/fs.stat/out/settings.js +0 -16
  135. package/node_modules/@nodelib/fs.stat/out/types/index.d.ts +0 -4
  136. package/node_modules/@nodelib/fs.stat/out/types/index.js +0 -2
  137. package/node_modules/@nodelib/fs.stat/package.json +0 -37
  138. package/node_modules/@nodelib/fs.walk/LICENSE +0 -21
  139. package/node_modules/@nodelib/fs.walk/README.md +0 -215
  140. package/node_modules/@nodelib/fs.walk/out/index.d.ts +0 -14
  141. package/node_modules/@nodelib/fs.walk/out/index.js +0 -34
  142. package/node_modules/@nodelib/fs.walk/out/providers/async.d.ts +0 -12
  143. package/node_modules/@nodelib/fs.walk/out/providers/async.js +0 -30
  144. package/node_modules/@nodelib/fs.walk/out/providers/index.d.ts +0 -4
  145. package/node_modules/@nodelib/fs.walk/out/providers/index.js +0 -9
  146. package/node_modules/@nodelib/fs.walk/out/providers/stream.d.ts +0 -12
  147. package/node_modules/@nodelib/fs.walk/out/providers/stream.js +0 -34
  148. package/node_modules/@nodelib/fs.walk/out/providers/sync.d.ts +0 -10
  149. package/node_modules/@nodelib/fs.walk/out/providers/sync.js +0 -14
  150. package/node_modules/@nodelib/fs.walk/out/readers/async.d.ts +0 -30
  151. package/node_modules/@nodelib/fs.walk/out/readers/async.js +0 -97
  152. package/node_modules/@nodelib/fs.walk/out/readers/common.d.ts +0 -7
  153. package/node_modules/@nodelib/fs.walk/out/readers/common.js +0 -31
  154. package/node_modules/@nodelib/fs.walk/out/readers/reader.d.ts +0 -6
  155. package/node_modules/@nodelib/fs.walk/out/readers/reader.js +0 -11
  156. package/node_modules/@nodelib/fs.walk/out/readers/sync.d.ts +0 -15
  157. package/node_modules/@nodelib/fs.walk/out/readers/sync.js +0 -59
  158. package/node_modules/@nodelib/fs.walk/out/settings.d.ts +0 -30
  159. package/node_modules/@nodelib/fs.walk/out/settings.js +0 -26
  160. package/node_modules/@nodelib/fs.walk/out/types/index.d.ts +0 -8
  161. package/node_modules/@nodelib/fs.walk/out/types/index.js +0 -2
  162. package/node_modules/@nodelib/fs.walk/package.json +0 -44
  163. package/node_modules/@ungap/structured-clone/.github/workflows/node.js.yml +0 -31
  164. package/node_modules/@ungap/structured-clone/LICENSE +0 -15
  165. package/node_modules/@ungap/structured-clone/README.md +0 -95
  166. package/node_modules/@ungap/structured-clone/cjs/deserialize.js +0 -78
  167. package/node_modules/@ungap/structured-clone/cjs/index.js +0 -27
  168. package/node_modules/@ungap/structured-clone/cjs/json.js +0 -24
  169. package/node_modules/@ungap/structured-clone/cjs/package.json +0 -1
  170. package/node_modules/@ungap/structured-clone/cjs/serialize.js +0 -160
  171. package/node_modules/@ungap/structured-clone/cjs/types.js +0 -22
  172. package/node_modules/@ungap/structured-clone/esm/deserialize.js +0 -79
  173. package/node_modules/@ungap/structured-clone/esm/index.js +0 -25
  174. package/node_modules/@ungap/structured-clone/esm/json.js +0 -21
  175. package/node_modules/@ungap/structured-clone/esm/serialize.js +0 -161
  176. package/node_modules/@ungap/structured-clone/esm/types.js +0 -11
  177. package/node_modules/@ungap/structured-clone/package.json +0 -53
  178. package/node_modules/@ungap/structured-clone/structured-json.js +0 -1
@@ -1,21 +0,0 @@
1
- /*! (c) Andrea Giammarchi - ISC */
2
-
3
- import {deserialize} from './deserialize.js';
4
- import {serialize} from './serialize.js';
5
-
6
- const {parse: $parse, stringify: $stringify} = JSON;
7
- const options = {json: true, lossy: true};
8
-
9
- /**
10
- * Revive a previously stringified structured clone.
11
- * @param {string} str previously stringified data as string.
12
- * @returns {any} whatever was previously stringified as clone.
13
- */
14
- export const parse = str => deserialize($parse(str));
15
-
16
- /**
17
- * Represent a structured clone value as string.
18
- * @param {any} any some clone-able value to stringify.
19
- * @returns {string} the value stringified.
20
- */
21
- export const stringify = any => $stringify(serialize(any, options));
@@ -1,161 +0,0 @@
1
- import {
2
- VOID, PRIMITIVE,
3
- ARRAY, OBJECT,
4
- DATE, REGEXP, MAP, SET,
5
- ERROR, BIGINT
6
- } from './types.js';
7
-
8
- const EMPTY = '';
9
-
10
- const {toString} = {};
11
- const {keys} = Object;
12
-
13
- const typeOf = value => {
14
- const type = typeof value;
15
- if (type !== 'object' || !value)
16
- return [PRIMITIVE, type];
17
-
18
- const asString = toString.call(value).slice(8, -1);
19
- switch (asString) {
20
- case 'Array':
21
- return [ARRAY, EMPTY];
22
- case 'Object':
23
- return [OBJECT, EMPTY];
24
- case 'Date':
25
- return [DATE, EMPTY];
26
- case 'RegExp':
27
- return [REGEXP, EMPTY];
28
- case 'Map':
29
- return [MAP, EMPTY];
30
- case 'Set':
31
- return [SET, EMPTY];
32
- }
33
-
34
- if (asString.includes('Array'))
35
- return [ARRAY, asString];
36
-
37
- if (asString.includes('Error'))
38
- return [ERROR, asString];
39
-
40
- return [OBJECT, asString];
41
- };
42
-
43
- const shouldSkip = ([TYPE, type]) => (
44
- TYPE === PRIMITIVE &&
45
- (type === 'function' || type === 'symbol')
46
- );
47
-
48
- const serializer = (strict, json, $, _) => {
49
-
50
- const as = (out, value) => {
51
- const index = _.push(out) - 1;
52
- $.set(value, index);
53
- return index;
54
- };
55
-
56
- const pair = value => {
57
- if ($.has(value))
58
- return $.get(value);
59
-
60
- let [TYPE, type] = typeOf(value);
61
- switch (TYPE) {
62
- case PRIMITIVE: {
63
- let entry = value;
64
- switch (type) {
65
- case 'bigint':
66
- TYPE = BIGINT;
67
- entry = value.toString();
68
- break;
69
- case 'function':
70
- case 'symbol':
71
- if (strict)
72
- throw new TypeError('unable to serialize ' + type);
73
- entry = null;
74
- break;
75
- case 'undefined':
76
- return as([VOID], value);
77
- }
78
- return as([TYPE, entry], value);
79
- }
80
- case ARRAY: {
81
- if (type)
82
- return as([type, [...value]], value);
83
-
84
- const arr = [];
85
- const index = as([TYPE, arr], value);
86
- for (const entry of value)
87
- arr.push(pair(entry));
88
- return index;
89
- }
90
- case OBJECT: {
91
- if (type) {
92
- switch (type) {
93
- case 'BigInt':
94
- return as([type, value.toString()], value);
95
- case 'Boolean':
96
- case 'Number':
97
- case 'String':
98
- return as([type, value.valueOf()], value);
99
- }
100
- }
101
-
102
- if (json && ('toJSON' in value))
103
- return pair(value.toJSON());
104
-
105
- const entries = [];
106
- const index = as([TYPE, entries], value);
107
- for (const key of keys(value)) {
108
- if (strict || !shouldSkip(typeOf(value[key])))
109
- entries.push([pair(key), pair(value[key])]);
110
- }
111
- return index;
112
- }
113
- case DATE:
114
- return as([TYPE, value.toISOString()], value);
115
- case REGEXP: {
116
- const {source, flags} = value;
117
- return as([TYPE, {source, flags}], value);
118
- }
119
- case MAP: {
120
- const entries = [];
121
- const index = as([TYPE, entries], value);
122
- for (const [key, entry] of value) {
123
- if (strict || !(shouldSkip(typeOf(key)) || shouldSkip(typeOf(entry))))
124
- entries.push([pair(key), pair(entry)]);
125
- }
126
- return index;
127
- }
128
- case SET: {
129
- const entries = [];
130
- const index = as([TYPE, entries], value);
131
- for (const entry of value) {
132
- if (strict || !shouldSkip(typeOf(entry)))
133
- entries.push(pair(entry));
134
- }
135
- return index;
136
- }
137
- }
138
-
139
- const {message} = value;
140
- return as([TYPE, {name: type, message}], value);
141
- };
142
-
143
- return pair;
144
- };
145
-
146
- /**
147
- * @typedef {Array<string,any>} Record a type representation
148
- */
149
-
150
- /**
151
- * Returns an array of serialized Records.
152
- * @param {any} value a serializable value.
153
- * @param {{json?: boolean, lossy?: boolean}?} options an object with a `lossy` or `json` property that,
154
- * if `true`, will not throw errors on incompatible types, and behave more
155
- * like JSON stringify would behave. Symbol and Function will be discarded.
156
- * @returns {Record[]}
157
- */
158
- export const serialize = (value, {json, lossy} = {}) => {
159
- const _ = [];
160
- return serializer(!(json || lossy), !!json, new Map, _)(value), _;
161
- };
@@ -1,11 +0,0 @@
1
- export const VOID = -1;
2
- export const PRIMITIVE = 0;
3
- export const ARRAY = 1;
4
- export const OBJECT = 2;
5
- export const DATE = 3;
6
- export const REGEXP = 4;
7
- export const MAP = 5;
8
- export const SET = 6;
9
- export const ERROR = 7;
10
- export const BIGINT = 8;
11
- // export const SYMBOL = 9;
@@ -1,53 +0,0 @@
1
- {
2
- "name": "@ungap/structured-clone",
3
- "version": "1.2.0",
4
- "description": "A structuredClone polyfill",
5
- "main": "./cjs/index.js",
6
- "scripts": {
7
- "build": "npm run cjs && npm run rollup:json && npm run test",
8
- "cjs": "ascjs esm cjs",
9
- "coverage": "c8 report --reporter=text-lcov > ./coverage/lcov.info",
10
- "rollup:json": "rollup --config rollup/json.config.js",
11
- "test": "c8 node test/index.js"
12
- },
13
- "keywords": [
14
- "recursion",
15
- "structured",
16
- "clone",
17
- "algorithm"
18
- ],
19
- "author": "Andrea Giammarchi",
20
- "license": "ISC",
21
- "devDependencies": {
22
- "@rollup/plugin-node-resolve": "^15.0.2",
23
- "@rollup/plugin-terser": "^0.4.1",
24
- "ascjs": "^5.0.1",
25
- "c8": "^7.13.0",
26
- "coveralls": "^3.1.1",
27
- "rollup": "^3.21.4"
28
- },
29
- "module": "./esm/index.js",
30
- "type": "module",
31
- "exports": {
32
- ".": {
33
- "import": "./esm/index.js",
34
- "default": "./cjs/index.js"
35
- },
36
- "./json": {
37
- "import": "./esm/json.js",
38
- "default": "./cjs/json.js"
39
- },
40
- "./package.json": "./package.json"
41
- },
42
- "directories": {
43
- "test": "test"
44
- },
45
- "repository": {
46
- "type": "git",
47
- "url": "git+https://github.com/ungap/structured-clone.git"
48
- },
49
- "bugs": {
50
- "url": "https://github.com/ungap/structured-clone/issues"
51
- },
52
- "homepage": "https://github.com/ungap/structured-clone#readme"
53
- }
@@ -1 +0,0 @@
1
- var StructuredJSON=function(e){"use strict";const r="object"==typeof self?self:globalThis,t=e=>((e,t)=>{const s=(r,t)=>(e.set(t,r),r),n=c=>{if(e.has(c))return e.get(c);const[o,a]=t[c];switch(o){case 0:case-1:return s(a,c);case 1:{const e=s([],c);for(const r of a)e.push(n(r));return e}case 2:{const e=s({},c);for(const[r,t]of a)e[n(r)]=n(t);return e}case 3:return s(new Date(a),c);case 4:{const{source:e,flags:r}=a;return s(new RegExp(e,r),c)}case 5:{const e=s(new Map,c);for(const[r,t]of a)e.set(n(r),n(t));return e}case 6:{const e=s(new Set,c);for(const r of a)e.add(n(r));return e}case 7:{const{name:e,message:t}=a;return s(new r[e](t),c)}case 8:return s(BigInt(a),c);case"BigInt":return s(Object(BigInt(a)),c)}return s(new r[o](a),c)};return n})(new Map,e)(0),s="",{toString:n}={},{keys:c}=Object,o=e=>{const r=typeof e;if("object"!==r||!e)return[0,r];const t=n.call(e).slice(8,-1);switch(t){case"Array":return[1,s];case"Object":return[2,s];case"Date":return[3,s];case"RegExp":return[4,s];case"Map":return[5,s];case"Set":return[6,s]}return t.includes("Array")?[1,t]:t.includes("Error")?[7,t]:[2,t]},a=([e,r])=>0===e&&("function"===r||"symbol"===r),u=(e,{json:r,lossy:t}={})=>{const s=[];return((e,r,t,s)=>{const n=(e,r)=>{const n=s.push(e)-1;return t.set(r,n),n},u=s=>{if(t.has(s))return t.get(s);let[i,f]=o(s);switch(i){case 0:{let r=s;switch(f){case"bigint":i=8,r=s.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+f);r=null;break;case"undefined":return n([-1],s)}return n([i,r],s)}case 1:{if(f)return n([f,[...s]],s);const e=[],r=n([i,e],s);for(const r of s)e.push(u(r));return r}case 2:{if(f)switch(f){case"BigInt":return n([f,s.toString()],s);case"Boolean":case"Number":case"String":return n([f,s.valueOf()],s)}if(r&&"toJSON"in s)return u(s.toJSON());const t=[],l=n([i,t],s);for(const r of c(s))!e&&a(o(s[r]))||t.push([u(r),u(s[r])]);return l}case 3:return n([i,s.toISOString()],s);case 4:{const{source:e,flags:r}=s;return n([i,{source:e,flags:r}],s)}case 5:{const r=[],t=n([i,r],s);for(const[t,n]of s)(e||!a(o(t))&&!a(o(n)))&&r.push([u(t),u(n)]);return t}case 6:{const r=[],t=n([i,r],s);for(const t of s)!e&&a(o(t))||r.push(u(t));return t}}const{message:l}=s;return n([i,{name:f,message:l}],s)};return u})(!(r||t),!!r,new Map,s)(e),s},{parse:i,stringify:f}=JSON,l={json:!0,lossy:!0};return e.parse=e=>t(i(e)),e.stringify=e=>f(u(e,l)),e}({});