var Hash = function(object) { if (object) { for(var k in object) { if (!(typeof this[k]=='function')) { this[k] = object[k] } } } }; Hash.convert = function(object) { for( var k in Hash.prototype ) { object[k] = Hash.prototype[k] }; return object; }; Hash.prototype = { each: function( fn ) { for( var k in this ) { if (! ( typeof this[k] == 'function' )) { fn({0:k, 1: this[k], key: k, value: this[k]}) } } return this; }, merge: function( hash ) { var self = this; new Hash(hash).each( function(item) { self[item.key] = item.value }); return this; } }; Array.convert = function(object) { if (object instanceof Array ) { return object } else if (object.toArray) { return object.toArray() } else { var rval = []; for(var i = 0; i