Closed AdrianRossouw closed 8 years ago
Perfectly valid use-case, and I feel this belongs in a deep-patrun module - let's abide by the spirit of Node and keep this one small and tight.
Hi there, was deep-patrun
ever created? How hard would it be if it did, to plug it instead of patrun in seneca?
Looks like what I wanted was in fact https://github.com/rjrodger/parambulator and https://github.com/senecajs/seneca-parambulator for payload validation (rather than seneca role/cmd pattern matching).
I had a situation where it would have been convenient to match on a pattern that was 2-3 levels deep, and it occurred to me that it might actually be really easy to do this with the current code.
It should be possible to just recursively reduce the objects/patterns into a flat representation, and the existing rules should be sufficient to match on that.
The one question is what to do about arrays tho.