You are viewing a plain text version of this content. The canonical link for it is here.
Posted to couchapp@couchdb.apache.org by ermouth <er...@gmail.com> on 2015/11/16 20:37:02 UTC
Pattern matching lib for couchapps
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
Re: Pattern matching lib for couchapps
Posted by ermouth <er...@gmail.com>.
See this screenshot for example:
http://jquerymy.com/lj/f554d63c0fa4_7167/201511267.48.14.png
It‘s just a fragment, but it‘s quiet transparent.
ermouth
2016-01-05 9:38 GMT+03:00 Johs. E <jo...@b2w.com>:
> Ermouth,
> could you share a snippet to show how this is used in the new rewrite
> function?
> br
> Johs
>
> ps
> happy new year to all @couchapp
>
> > On 16 Nov 2015, at 20:37, ermouth <er...@gmail.com> wrote:
> >
> > 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
>
>
Re: Pattern matching lib for couchapps
Posted by "Johs. E" <jo...@b2w.com>.
Ermouth,
could you share a snippet to show how this is used in the new rewrite function?
br
Johs
ps
happy new year to all @couchapp
> On 16 Nov 2015, at 20:37, ermouth <er...@gmail.com> wrote:
>
> 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