Lyra
LOELeague of Extraordinary FoundryVTT Developers
•Created by Lyra on 12/29/2023 in #package-development
Minimise Document using Prototype
Quick question, I've got no idea what I'm doing so please excuse my ineptitude.
Say I have a document, e.g. a wall:
But I want to minimise it down to only the changed data from the defaults.
I can check the defaults in
WallDocument.prototype.constructor._schema.fields
There I see that light
always has an initial value of 20
so we can remove that.
We also bin off the _id
as we know we'll get a new one.
A simplified object for this example would then be:
Is there a trivial/simple way to use the wall prototype to reduce full data to just the non-default fields?4 replies