Skip to content

Commit

Permalink
Merge branch 'shiftspace'
Browse files Browse the repository at this point in the history
  • Loading branch information
swannodette committed Nov 26, 2009
2 parents bc4f698 + 28a4ef4 commit 503a00e
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions FuncTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ Function.implement({
fn = (fn) ? fn : this;
return function() {
return !fn.apply(this, arguments);
}
};
},

/*
Expand All @@ -212,7 +212,7 @@ Function.implement({
eq: function(a) {
return function(b) {
return a == b;
}
};
},

/*
Expand Down Expand Up @@ -290,7 +290,7 @@ Function.implement({
var args = $A(arguments), result = ($callable(self)) ? self.apply(this, args) : null, fn;
while(fn = temp.shift()) result = fn.apply(null, (result && [result]) || args);
return result;
}
};
},

/*
Expand Down Expand Up @@ -433,7 +433,7 @@ Function.implement({
}
}
}
}
};
},

/*
Expand Down Expand Up @@ -537,7 +537,7 @@ Function.implement({
return function () {
var args = $A(arguments).filter($notnull);
return dispatch[args.length].apply(this, args);
}
};
},

/*
Expand Down Expand Up @@ -709,7 +709,7 @@ Array.implement({
Returns:
An array.
*/
head: function(n) { return this.slice(0, (n || this.length)) },
head: function(n) { return this.slice(0, (n || this.length)); },

/*
Function: Array.partition
Expand Down Expand Up @@ -755,7 +755,24 @@ Array.implement({
var self = this;
return function (idx) {
return self[idx];
}
};
},

/*
Function: hash
Takes an array (whose contents should be [[k0, v0], [k1, v1], ..., [kn, vn]])
and returns a Hash object.
Returns:
A Hash object.
*/
hash: function()
{
var result = $H();
this.each(function(kv) {
result[kv[0]] = kv[1];
});
return result;
}
});

Expand Down

0 comments on commit 503a00e

Please sign in to comment.