Starcounter-Jack / JSON-Patch

Lean and mean Javascript implementation of the JSON-Patch standard (RFC 6902). Update JSON documents using delta patches.
MIT License
1.79k stars 215 forks source link

How do you ignore properties when patching? #265

Open seiyria opened 3 years ago

seiyria commented 3 years ago

Right now I'm doing this:

      this.playerPatchQueue[player.username].patches.push(...patch.patches.filter(p => {

        // ideally, it would not generate these patches, but we take what we can
        return !p.path.includes('_') && !p.path.includes('createdAt') && !p.path.includes('currentTick') && !p.path.includes('fov');
      }));

But it's not ideal. I'd really like to have a way to have FJP not generate patches for these properties elsewhere if possible.