remove bootstraop and drop alias for dump

This commit is contained in:
Matt Hill
2024-06-03 23:25:46 -06:00
parent 88a804f56f
commit 875c6dbc84
3 changed files with 21 additions and 38 deletions

View File

@@ -1,4 +1,4 @@
import { DBCache, PatchOp } from './types'
import { Dump, PatchOp } from './types'
export interface BaseOperation {
path: string
@@ -37,10 +37,10 @@ export function getValueByPointer<T extends Record<string, T>>(
}
export function applyOperation<T>(
doc: DBCache<Record<string, any>>,
doc: Dump<Record<string, any>>,
{ path, op, value }: Operation<T> & { value?: T },
) {
doc.data = recursiveApply(doc.data, arrayFromPath(path), op, value)
doc.value = recursiveApply(doc.value, arrayFromPath(path), op, value)
}
export function arrayFromPath(path: string): string[] {
@@ -61,7 +61,7 @@ export function pathFromArray(args: Array<string | number>): string {
args
.map(a =>
String(a)
// do not change order, "~" needs to be replaced first
// do not change order, "~" needs to be replaced first
.replace(new RegExp('~', 'g'), '~0')
.replace(new RegExp('/', 'g'), '~1'),
)