There exist nice lib for Erlang-style pattern-matching in JS – matches.js (
https://github.com/natefaubion/matches.js).

I‘ve prepared gist http://bit.ly/1QqQy4w, that contains bit extended and
modified matches.js, see comment under the gist.

In short: now ready for ddocs (knows about CouchDB require) and supports
recursive syntax. See comment under the gist and original matches.js docs.

Note, that compilation of matcher is not lazy, but it‘s nearly
indistinguishable comparing to other penalties of typical JS-backed request
in CouchDB.

Good for new js rewrites (routing) and for (validate_doc_)update update
functions (type check).

ermouth

Reply via email to