MCPcopy Index your code
hub / github.com/Starcounter-Jack/JSON-Patch / generate

Function generate

module/duplex.mjs:96–111  ·  view source on GitHub ↗
(observer, invertible)

Source from the content-addressed store, hash-verified

94 * Generate an array of patches from an observer
95 */
96export function generate(observer, invertible) {
97 if (invertible === void 0) { invertible = false; }
98 var mirror = beforeDict.get(observer.object);
99 _generate(mirror.value, observer.object, observer.patches, "", invertible);
100 if (observer.patches.length) {
101 applyPatch(mirror.value, observer.patches);
102 }
103 var temp = observer.patches;
104 if (temp.length > 0) {
105 observer.patches = [];
106 if (observer.callback) {
107 observer.callback(temp);
108 }
109 }
110 return temp;
111}
112// Dirty check if obj is different from mirror, generate patches and update mirror
113function _generate(mirror, obj, patches, path, invertible) {
114 if (obj === mirror) {

Callers 2

dirtyCheckFunction · 0.70
observeFunction · 0.70

Calls 2

applyPatchFunction · 0.90
_generateFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…