Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion website/docs/patches.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ expect(state).toEqual({
})
```

The generated patches are similar (but not the same) to the [RFC-6902 JSON patch standard](https://datatracker.ietf.org/doc/html/rfc6902/#section-4.1), except that the `path` property is an array, rather than a string. This makes processing patches easier. If you want to normalize to the official specification, `patch.path = patch.path.join("/")` should do the trick. Anyway, this is what a bunch of patches and their inverse could look like:
The generated patches are similar (but not the same) to the [RFC-6902 JSON patch standard](https://datatracker.ietf.org/doc/html/rfc6902/#section-4.1), except that the `path` property is an array, rather than a string. This makes processing patches easier. If you want to normalize to the official specification, use `patch.path = "/" + patch.path.join("/")` so the result is a JSON Pointer with a leading `/` (and escape `~` / `/` in path tokens per [RFC-6901](https://datatracker.ietf.org/doc/html/rfc6901) when needed). Anyway, this is what a bunch of patches and their inverse could look like:

```json
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ expect(state).toEqual({
})
```

生成的 patches 与 [RFC-6902 JSON patch standard](https://datatracker.ietf.org/doc/html/rfc6902/#section-4.1) 类似(但并不相同),除了 path 属性是一个数组,而不是一个字符串。这使得处理 patches 更加容易。如果你想规范化到官方格式,`patch.path = patch.path.join("/")`应该可以解决这个问题。无论如何,下面就是一堆 patches 和它们回溯的样子。
生成的 patches 与 [RFC-6902 JSON patch standard](https://datatracker.ietf.org/doc/html/rfc6902/#section-4.1) 类似(但并不相同),除了 path 属性是一个数组,而不是一个字符串。这使得处理 patches 更加容易。如果你想规范化到官方格式,请使用 `patch.path = "/" + patch.path.join("/")`,这样会得到带前导 `/` 的 JSON Pointer(如有需要,请按 [RFC-6901](https://datatracker.ietf.org/doc/html/rfc6901) 转义路径段中的 `~` / `/`)。无论如何,下面就是一堆 patches 和它们回溯的样子。

```json
[
Expand Down