meteor-space / base

Foundation for Modular Application Architecture in Meteor.
MIT License
75 stars 5 forks source link

makes fields api of Space.Struct more flexible #15

Closed DominikGuzei closed 8 years ago

DominikGuzei commented 8 years ago

This is a simple and backward-compatible improvement to the Space.Struct fields api. Now you can define a fields method on the prototype that returns the EJSON / Match structure required for the struct. The cool thing is, that this now supports inheritance, so you can use whatever the super class returns for it's prototype method and extend that.

It stays backward-compatible because Space.Struct::fields returns the statically defined fields property on the current class by default (which was the previous api contract).

rhyslbw commented 8 years ago

:+1: