You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/guide/getting-started.md
+4-4
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ See [Contributing](../CONTRIBUTING.md) on how to run the tests locally
25
25
## Basic data validation
26
26
27
27
Ajv takes a schema for your JSON data and converts it into a very efficient JavaScript code
28
-
that validates your data according to the schema. To create schema you can use either
28
+
that validates your data according to the schema. To create a schema you can use either
29
29
[JSON Schema](../json-schema) or [JSON Type Definition](../json-type-definition) - check out [Choosing schema language](./schema-language), they have
30
30
different advantages and disadvantages.
31
31
@@ -87,7 +87,7 @@ if (!valid) console.log(validate.errors)
87
87
</code-block>
88
88
</code-group>
89
89
90
-
Ajv compiles schemas to functions and caches them in all cases (using schema itself as a key for Map), so that the next time the same schema object is used it won't be compiled again.
90
+
Ajv compiles schemas to functions and caches them in all cases (using the schema itself as a key in a Map), so that the next time the same schema object is used it won't be compiled again.
91
91
92
92
::: tip Best performance: compile and getSchema methods
93
93
The best performance is achieved when using compiled functions returned by `compile` or `getSchema` methods.
Every time a validation function (or `ajv.validate`) is called `errors` property is overwritten. You need to copy `errors` array reference to another variable if you want to use it later (e.g., in the callback). See [Validation errors](../api.md#validation-errors)
101
+
Every time a validation function (or `ajv.validate`) is called the `errors` property is overwritten. You need to copy the `errors` array reference to another variable if you want to use it later (e.g. in the callback). See [Validation errors](../api.md#validation-errors).
102
102
:::
103
103
104
104
## Parsing and serializing JSON <Badgetext="New" />
@@ -107,7 +107,7 @@ Ajv can compile efficient parsers and serializers from [JSON Type Definition](..
107
107
108
108
Serializing the data with a function specialized to your data shape can be more than 10x compared with `JSON.stringify`.
109
109
110
-
Parsing the data replaces the need for a separate validation after generic parsing with `JSON.parse` (although validation itself is usually much faster than parsing). In case your JSON string is validspecialized parsing is approximately as fast as JSON.parse, but in case your JSON is invalid, specialized parsing would fail much faster - so it can be very efficient in some scenarios.
110
+
Parsing the data replaces the need for separate validation after generic parsing with `JSON.parse` (although validation itself is usually much faster than parsing). In case your JSON string is valid, the specialized parsing is approximately as fast as JSON.parse, but in case your JSON is invalid, the specialized parsing would fail much faster - so it can be very efficient in some scenarios.
111
111
112
112
For the same data structure, you can compile parser and serializer in this way:
0 commit comments