couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Candler <B.Cand...@pobox.com>
Subject Re: view syntax for retrieving object without a field
Date Mon, 25 Jan 2010 21:22:28 GMT
On Mon, Jan 25, 2010 at 11:51:05AM -0500, eric casteleijn wrote:
> >function (doc)
> >{
> >   var fields = new Array("name", "country");
> >
> >   for (idx in fields)
> >   {
> >     if (typeof eval("doc." + fields[idx]) == "undefined")

I must be missing a Javascript subtlety here. What's wrong with

   if (typeof(doc[fields[idx]]) === 'undefined')

?

Mime
View raw message