You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm looking for where to start on changing the serialize behavior so that blank keys are not included in the object that Syphon returns. would changing the default key extractor be the right place to make this adjustment?
Right now I do this outside of Syphon, but I would like to implement it as an option for this library.
getVals: ->
formData = Syphon.serialize @el
# remove field names for blank values
for field, val of formData
delete formData[field] unless val
formData
The text was updated successfully, but these errors were encountered:
It's been a long time since I thought about it. I think this applies to any form that the user might fill in partially, depending on needs. So like a profile screen or similar. If Syphon let me just ignore blank fields instead of including blank values it'd be a better/smaller JSON package.
If they're included, then when the caller performs a model.set they're potentially going to wipe out some other fields that they're wanting to hold onto. However perhaps that's the desired behaviour.
My thought here is to expand the serialize API to allow for conditional blank key inclusion.
Hi Derick!
I'm looking for where to start on changing the serialize behavior so that blank keys are not included in the object that Syphon returns. would changing the
default key extractor
be the right place to make this adjustment?Right now I do this outside of Syphon, but I would like to implement it as an option for this library.
The text was updated successfully, but these errors were encountered: