couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Anderson <jch...@apache.org>
Subject Re: helper functions in reduce
Date Wed, 11 Mar 2009 17:04:58 GMT
On Wed, Mar 11, 2009 at 6:59 AM, Zachary Zolton
<zachary.zolton@gmail.com> wrote:
> I was a bit mislead by the title; this sounds like caching the
> parsed/ready-to-go JavaScript view functions.
>
> However, I am interested in hearing how we can introduce helper code,
> and reusable libraries, into our JavaScript views.
>

Check out the CouchApp script, which has macros for including helper
code automatically in view functions when saving the design documents.
This is really the best way to do it, as the functions as stored in
the design doc can not depend on definitions elsewhere in the code. If
there are a set of helpers you'd like to see as sort of a standard
library for MapReduce, they'd make great candidates for inclusion in
the CouchApp vendor package.

Scan the README for mention of the !code macro:
http://github.com/jchris/couchapp/blob/master/README.md

-- 
Chris Anderson
http://jchris.mfdz.com

Mime
View raw message