@dabble/patches 0.7.13 → 0.7.14
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/dist/fractionalIndex.js +4 -2
- package/dist/json-patch/pathProxy.js +2 -1
- package/dist/json-patch/utils/escapePathComponent.d.ts +7 -0
- package/dist/json-patch/utils/escapePathComponent.js +7 -0
- package/dist/json-patch/utils/index.d.ts +1 -0
- package/dist/json-patch/utils/index.js +1 -0
- package/package.json +1 -1
package/dist/fractionalIndex.js
CHANGED
|
@@ -202,9 +202,11 @@ function createOrderGetter(orderField) {
|
|
|
202
202
|
function sortByOrder(items, orderField = "order") {
|
|
203
203
|
const getOrder = createOrderGetter(orderField);
|
|
204
204
|
return Object.entries(items).sort((a, b) => {
|
|
205
|
-
const
|
|
205
|
+
const orderA = getOrder(a[1]);
|
|
206
|
+
const orderB = getOrder(b[1]);
|
|
207
|
+
const orderCmp = orderA < orderB ? -1 : orderA > orderB ? 1 : 0;
|
|
206
208
|
if (orderCmp !== 0) return orderCmp;
|
|
207
|
-
return a[0]
|
|
209
|
+
return a[0] < b[0] ? -1 : a[0] > b[0] ? 1 : 0;
|
|
208
210
|
});
|
|
209
211
|
}
|
|
210
212
|
function healDuplicateOrders(items, orderField = "order") {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "../chunk-IZ2YBCUP.js";
|
|
2
|
+
import { escapePathComponent } from "./utils/escapePathComponent.js";
|
|
2
3
|
const proxyFodder = {};
|
|
3
4
|
const createPathProxy = pathProxy;
|
|
4
5
|
function pathProxy(path = "") {
|
|
@@ -9,7 +10,7 @@ function pathProxy(path = "") {
|
|
|
9
10
|
return path;
|
|
10
11
|
};
|
|
11
12
|
}
|
|
12
|
-
return pathProxy(`${path}/${prop}`);
|
|
13
|
+
return pathProxy(`${path}/${escapePathComponent(prop)}`);
|
|
13
14
|
},
|
|
14
15
|
set(_, prop) {
|
|
15
16
|
throw new Error(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dabble/patches",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.14",
|
|
4
4
|
"description": "Immutable JSON Patch implementation based on RFC 6902 supporting operational transformation and last-writer-wins",
|
|
5
5
|
"author": "Jacob Wright <jacwright@gmail.com>",
|
|
6
6
|
"bugs": {
|