fast-json-stringify 5.2.0 → 5.4.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/.github/workflows/ci.yml +1 -0
- package/.taprc +7 -1
- package/{build-schema-validator.js → build/build-schema-validator.js} +1 -1
- package/{example.js → examples/example.js} +1 -1
- package/{server.js → examples/server.js} +1 -1
- package/index.d.ts +9 -8
- package/index.js +316 -375
- package/lib/location.js +55 -0
- package/{ref-resolver.js → lib/ref-resolver.js} +0 -0
- package/{schema-validator.js → lib/schema-validator.js} +0 -0
- package/{serializer.js → lib/serializer.js} +0 -36
- package/{standalone.js → lib/standalone.js} +12 -11
- package/{validator.js → lib/validator.js} +0 -0
- package/package.json +10 -6
- package/test/allof.test.js +45 -0
- package/test/anyof.test.js +20 -0
- package/test/array.test.js +43 -0
- package/test/date.test.js +19 -0
- package/test/debug-mode.test.js +18 -5
- package/test/if-then-else.test.js +50 -0
- package/test/ref.test.js +24 -0
- package/test/types/schema-inference.test-d.ts +48 -0
package/.github/workflows/ci.yml
CHANGED
package/.taprc
CHANGED
|
@@ -23,4 +23,4 @@ const validationCode = standaloneCode(ajv, validate)
|
|
|
23
23
|
|
|
24
24
|
const moduleCode = `/* CODE GENERATED BY '${path.basename(__filename)}' DO NOT EDIT! */\n${validationCode}`
|
|
25
25
|
|
|
26
|
-
fs.writeFileSync(path.join(__dirname, 'schema-validator.js'), moduleCode)
|
|
26
|
+
fs.writeFileSync(path.join(__dirname, '../lib/schema-validator.js'), moduleCode)
|
package/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Ajv, { Options as AjvOptions } from "ajv"
|
|
2
|
+
|
|
2
3
|
declare namespace build {
|
|
3
4
|
interface BaseSchema {
|
|
4
5
|
/**
|
|
@@ -189,13 +190,13 @@ interface StandaloneOption extends build.Options {
|
|
|
189
190
|
declare function build(schema: build.AnySchema, options: DebugOption): { code: string, ajv: Ajv };
|
|
190
191
|
declare function build(schema: build.AnySchema, options: DeprecateDebugOption): { code: string, ajv: Ajv };
|
|
191
192
|
declare function build(schema: build.AnySchema, options: StandaloneOption): string;
|
|
192
|
-
declare function build(schema: build.AnySchema, options?: build.Options): (doc:
|
|
193
|
-
declare function build(schema: build.StringSchema, options?: build.Options): (doc:
|
|
194
|
-
declare function build(schema: build.IntegerSchema | build.NumberSchema, options?: build.Options): (doc:
|
|
195
|
-
declare function build(schema: build.NullSchema, options?: build.Options): (doc:
|
|
196
|
-
declare function build(schema: build.BooleanSchema, options?: build.Options): (doc:
|
|
197
|
-
declare function build(schema: build.ArraySchema | build.TupleSchema, options?: build.Options): (doc:
|
|
198
|
-
declare function build(schema: build.ObjectSchema, options?: build.Options): (doc:
|
|
199
|
-
declare function build(schema: build.Schema, options?: build.Options):
|
|
193
|
+
declare function build(schema: build.AnySchema, options?: build.Options): <TDoc = any>(doc: TDoc) => any;
|
|
194
|
+
declare function build(schema: build.StringSchema, options?: build.Options): <TDoc extends string = string>(doc: TDoc) => string;
|
|
195
|
+
declare function build(schema: build.IntegerSchema | build.NumberSchema, options?: build.Options): <TDoc extends number = number>(doc: TDoc) => string;
|
|
196
|
+
declare function build(schema: build.NullSchema, options?: build.Options): <TDoc extends null = null>(doc: TDoc) => "null";
|
|
197
|
+
declare function build(schema: build.BooleanSchema, options?: build.Options): <TDoc extends boolean = boolean>(doc: TDoc) => string;
|
|
198
|
+
declare function build(schema: build.ArraySchema | build.TupleSchema, options?: build.Options): <TDoc extends any[]= any[]>(doc: TDoc) => string;
|
|
199
|
+
declare function build(schema: build.ObjectSchema, options?: build.Options): <TDoc extends object = object>(doc: TDoc) => string;
|
|
200
|
+
declare function build(schema: build.Schema, options?: build.Options): <TDoc = object | any[] | string | number | boolean | null> (doc: TDoc) => string;
|
|
200
201
|
|
|
201
202
|
export = build;
|