fast-json-stringify 4.1.0 → 5.0.1

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/README.md CHANGED
@@ -679,8 +679,8 @@ console.log(stringify({ firstName: 'Foo', surname: 'bar' })) // '{"firstName":"F
679
679
  ### Standalone Mode
680
680
 
681
681
  The standalone mode is used to compile the code that can be directly run by `node`
682
- itself. You need to install `fast-json-stringify`, `ajv`, `fast-uri` and `ajv-formats`
683
- in order to let the standalone code works.
682
+ itself. You need to install `ajv`, `fast-uri` and `ajv-formats` for
683
+ the standalone code to work.
684
684
 
685
685
  ```js
686
686
  const fs = require('fs')
package/ajv.js CHANGED
@@ -7,7 +7,7 @@ const ajvFormats = require('ajv-formats')
7
7
  module.exports = buildAjv
8
8
 
9
9
  function buildAjv (options) {
10
- const ajvInstance = new Ajv({ ...options, strictSchema: false, uriResolver: fastUri })
10
+ const ajvInstance = new Ajv({ ...options, strictSchema: false, validateSchema: false, uriResolver: fastUri })
11
11
  ajvFormats(ajvInstance)
12
12
 
13
13
  const validateDateTimeFormat = ajvFormats.get('date-time').validate
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Options as AjvOptions } from "ajv"
1
+ import Ajv, { Options as AjvOptions } from "ajv"
2
2
  declare namespace build {
3
3
  interface BaseSchema {
4
4
  /**
@@ -157,14 +157,38 @@ declare namespace build {
157
157
  * Optionally configure how the integer will be rounded
158
158
  */
159
159
  rounding?: 'ceil' | 'floor' | 'round'
160
+ /**
161
+ * @deprecated
162
+ * Enable debug mode. Please use `mode: "debug"` instead
163
+ */
164
+ debugMode?: boolean
165
+ /**
166
+ * Running mode of fast-json-stringify
167
+ */
168
+ mode?: 'debug' | 'standalone'
160
169
  }
161
170
  }
162
171
 
172
+ interface DebugOption extends build.Options {
173
+ mode: 'debug'
174
+ }
175
+
176
+ interface DeprecateDebugOption extends build.Options {
177
+ debugMode: true
178
+ }
179
+
180
+ interface StandaloneOption extends build.Options {
181
+ mode: 'standalone'
182
+ }
183
+
163
184
  /**
164
185
  * Build a stringify function using a schema of the documents that should be stringified
165
186
  * @param schema The schema used to stringify values
166
187
  * @param options The options to use (optional)
167
188
  */
189
+ declare function build(schema: build.AnySchema, options: DebugOption): { code: string, ajv: Ajv };
190
+ declare function build(schema: build.AnySchema, options: DeprecateDebugOption): { code: string, ajv: Ajv };
191
+ declare function build(schema: build.AnySchema, options: StandaloneOption): string;
168
192
  declare function build(schema: build.AnySchema, options?: build.Options): (doc: any) => any;
169
193
  declare function build(schema: build.StringSchema, options?: build.Options): (doc: string) => string;
170
194
  declare function build(schema: build.IntegerSchema | build.NumberSchema, options?: build.Options): (doc: number) => string;