Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 8x 211x 139x 8x 208x 208x 208x 139x 211x 211x | import type {Path} from '@jsonjoy.com/json-pointer';
const comparePathComponent = (a: string | number, b: string | number): number => {
if (a === b) return 0;
return a > b ? -1 : 1;
};
export const comparePath = (a: Path, b: Path): number => {
const aLen = a.length;
const bLen = b.length;
if (aLen !== bLen) return bLen - aLen;
for (let i = 0; i < aLen; i++) {
const c = comparePathComponent(a[i], b[i]);
if (c !== 0) return c;
}
return 0;
};
|