fast-json-stringify 6.4.0 → 7.0.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.
package/index.js CHANGED
@@ -222,10 +222,6 @@ function build (schema, options) {
222
222
  }
223
223
  }
224
224
 
225
- if (options.debugMode) {
226
- options.mode = 'debug'
227
- }
228
-
229
225
  if (options.mode === 'debug') {
230
226
  return {
231
227
  validator,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fast-json-stringify",
3
- "version": "6.4.0",
3
+ "version": "7.0.0",
4
4
  "description": "Stringify your JSON at max speed",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
@@ -22,7 +22,7 @@ function build (opts) {
22
22
 
23
23
  test('activate debug mode', t => {
24
24
  t.plan(5)
25
- const debugMode = build({ debugMode: true })
25
+ const debugMode = build({ mode: 'debug' })
26
26
 
27
27
  t.assert.ok(typeof debugMode === 'object')
28
28
  t.assert.ok(debugMode.ajv instanceof Ajv)
@@ -31,21 +31,9 @@ test('activate debug mode', t => {
31
31
  t.assert.ok(typeof debugMode.code === 'string')
32
32
  })
33
33
 
34
- test('activate debug mode truthy', t => {
35
- t.plan(5)
36
-
37
- const debugMode = build({ debugMode: 'yes' })
38
-
39
- t.assert.ok(typeof debugMode === 'object')
40
- t.assert.ok(typeof debugMode.code === 'string')
41
- t.assert.ok(debugMode.ajv instanceof Ajv)
42
- t.assert.ok(debugMode.validator instanceof Validator)
43
- t.assert.ok(debugMode.serializer instanceof Serializer)
44
- })
45
-
46
34
  test('to string auto-consistent', t => {
47
35
  t.plan(6)
48
- const debugMode = build({ debugMode: 1 })
36
+ const debugMode = build({ mode: 'debug' })
49
37
 
50
38
  t.assert.ok(typeof debugMode === 'object')
51
39
  t.assert.ok(typeof debugMode.code === 'string')
@@ -73,7 +61,7 @@ test('to string auto-consistent with ajv', t => {
73
61
  }]
74
62
  }
75
63
  }
76
- }, { debugMode: 1 })
64
+ }, { mode: 'debug' })
77
65
 
78
66
  t.assert.ok(typeof debugMode === 'object')
79
67
  t.assert.ok(typeof debugMode.code === 'string')
@@ -102,7 +90,7 @@ test('to string auto-consistent with ajv-formats', t => {
102
90
  }]
103
91
  }
104
92
  }
105
- }, { debugMode: 1 })
93
+ }, { mode: 'debug' })
106
94
 
107
95
  t.assert.ok(typeof debugMode === 'object')
108
96
 
@@ -115,7 +103,7 @@ test('to string auto-consistent with ajv-formats', t => {
115
103
  test('debug should restore the same serializer instance', t => {
116
104
  t.plan(1)
117
105
 
118
- const debugMode = fjs({ type: 'integer' }, { debugMode: 1, rounding: 'ceil' })
106
+ const debugMode = fjs({ type: 'integer' }, { mode: 'debug', rounding: 'ceil' })
119
107
  const compiled = fjs.restore(debugMode)
120
108
  t.assert.equal(compiled(3.95), 4)
121
109
  })
package/types/index.d.ts CHANGED
@@ -162,16 +162,10 @@ declare namespace build {
162
162
  * @default 'trunc'
163
163
  */
164
164
  rounding?: 'ceil' | 'floor' | 'round' | 'trunc'
165
- /**
166
- * @deprecated
167
- * Enable debug mode. Please use `mode: "debug"` instead
168
- */
169
- debugMode?: boolean
170
165
  /**
171
166
  * Running mode of fast-json-stringify
172
167
  */
173
168
  mode?: 'debug' | 'standalone'
174
-
175
169
  /**
176
170
  * Large arrays are defined as arrays containing, by default, `20000`
177
171
  * elements or more. That value can be adjusted via the option parameter
@@ -180,7 +174,6 @@ declare namespace build {
180
174
  * @default 20000
181
175
  */
182
176
  largeArraySize?: number | string | BigInt
183
-
184
177
  /**
185
178
  * Specify the function on how large Arrays should be stringified.
186
179
  *
@@ -200,10 +193,6 @@ interface DebugOption extends build.Options {
200
193
  mode: 'debug'
201
194
  }
202
195
 
203
- interface DeprecateDebugOption extends build.Options {
204
- debugMode: true
205
- }
206
-
207
196
  interface StandaloneOption extends build.Options {
208
197
  mode: 'standalone'
209
198
  }
@@ -217,7 +206,6 @@ type IntegerCoercible = number | BigInt
217
206
  * @param options The options to use (optional)
218
207
  */
219
208
  declare function build (schema: build.AnySchema, options: DebugOption): { code: string, ajv: Ajv }
220
- declare function build (schema: build.AnySchema, options: DeprecateDebugOption): { code: string, ajv: Ajv }
221
209
  declare function build (schema: build.AnySchema, options: StandaloneOption): string
222
210
  declare function build (schema: build.AnySchema, options?: build.Options): <TDoc = any>(doc: TDoc) => any
223
211
  declare function build (schema: build.StringSchema, options?: build.Options): <TDoc extends StringCoercible = StringCoercible>(doc: TDoc) => string