Skip to main content

Class: JSONPatch

Defined in: src/patch/patch.ts:362

Constructors

new JSONPatch()

new JSONPatch(ops?): JSONPatch

Defined in: src/patch/patch.ts:369

Parameters

ops?

OpObject[]

Returns

JSONPatch

Methods

[iterator]()

[iterator](): Iterator<OpObject>

Defined in: src/patch/patch.ts:378

Returns

Iterator<OpObject>

an iterator over ops in this patch.


add()

add(path, value): this

Defined in: src/patch/patch.ts:390

Parameters

path

string | JSONPointer

value

JSONValue

Returns

this


apply()

apply(value): JSONValue

Defined in: src/patch/patch.ts:472

Parameters

value

JSONValue

Returns

JSONValue


build()

protected build(ops): void

Defined in: src/patch/patch.ts:496

Parameters

ops

OpObject[]

Returns

void


copy()

copy(from, path): this

Defined in: src/patch/patch.ts:445

Parameters

from

string | JSONPointer

path

string | JSONPointer

Returns

this


ensurePointer()

protected ensurePointer(p, op, index): JSONPointer

Defined in: src/patch/patch.ts:582

Parameters

p

string | JSONPointer

op

string

index

number

Returns

JSONPointer


move()

move(from, path): this

Defined in: src/patch/patch.ts:430

Parameters

from

string | JSONPointer

path

string | JSONPointer

Returns

this


opPointer()

protected opPointer(opObj, key, op, index): JSONPointer

Defined in: src/patch/patch.ts:541

Parameters

opObj

OpObject

key

keyof OpObject

op

string

index

number

Returns

JSONPointer


opValue()

protected opValue(opObj, key, op, index): JSONValue

Defined in: src/patch/patch.ts:569

Parameters

opObj

OpObject

key

keyof OpObject

op

string

index

number

Returns

JSONValue


remove()

remove(path): this

Defined in: src/patch/patch.ts:401

Parameters

path

string | JSONPointer

Returns

this


replace()

replace(path, value): this

Defined in: src/patch/patch.ts:414

Parameters

path

string | JSONPointer

value

JSONValue

Returns

this


test()

test(path, value): this

Defined in: src/patch/patch.ts:461

Parameters

path

string | JSONPointer

value

JSONValue

Returns

this


toArray()

toArray(): OpObject[]

Defined in: src/patch/patch.ts:492

Returns

OpObject[]