Hi Damien,JChris,JanL et al, As a js newbie I recently hit the WTF? wall when I discovered typeof([1,2,3]) = object rather than the expected array.
Doug Crockford suggests a custom typeOf function (note the Cap O) in his remedial javascript http://javascript.crockford.com/remedial.html function typeOf(value) { var s = typeof value; if (s === 'object') { if (value) { if (typeof value.length === 'number' && !(value.propertyIsEnumerable('length')) && typeof value.splice === 'function') { s = 'array'; } } else { s = 'null'; } } return s; } Given that we may want to deal with arrays and hashes differently in map fucntions, is it possible to add this typeOf fucntion to the standard couch js libs? This would allow this very useful functionality to be accessed in map functions and lucene index functions without having to add these inline or via couchapp. Nitin 37% of all statistics are made up on the spot ------------------------------------------------------------------------------------- Nitin Borwankar [email protected]
