couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Anderson" <jch...@gmail.com>
Subject Re: Adding functions to the JavaScript global object for use in views
Date Sat, 10 Jan 2009 18:15:37 GMT
On Fri, Jan 9, 2009 at 2:03 PM, Dave <dave@myheartisagapinghole.com> wrote:
> Hi,
>
> I was wondering if there was a standard way to add helper functions or
> augment the built-in data types (Array, Date, etc.) in the JavaScript
> global object used by couch db for map/reduce functions. My motivation
> here is to add some code for parsing ISO8601 date strings into
> JavaScript Date objects for the purpose of view collation in multiple
> views.
>

The preferred way to do this is to add the library code itself to your
function. I use a script designed to push filesystem contents to
design documents. It has an ability to inline additional JavaScript
into your functions.

I'm in the middle of extracting it to its own project, so the install
will be getting easier, but the Ruby code is available here:

http://github.com/jchris/couchapp/tree/master

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

Mime
View raw message