Skip to content

Commit

Permalink
proper isArray function
Browse files Browse the repository at this point in the history
  • Loading branch information
Francisco Treacy committed Jun 8, 2010
1 parent 5f3e82f commit 296d370
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/riak.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,13 @@ Riak.prototype.walk = function(bucket, key, spec, options) {

// map/reduce api

function isArray(o) {
return o && !(o.propertyIsEnumerable('length')) && typeof o === 'object' && typeof o.length === 'number';
}

function makePhases(type, phase) {
if (phase.constructor !== Array) phase = [phase]

if (!isArray(phase)) phase = [phase]

return phase.map(function(p) {
var temp = {}
Expand Down

0 comments on commit 296d370

Please sign in to comment.