Skip to content

Instantly share code, notes, and snippets.

@Zyber17
Last active December 21, 2015 02:19
Show Gist options
  • Save Zyber17/6234595 to your computer and use it in GitHub Desktop.
Save Zyber17/6234595 to your computer and use it in GitHub Desktop.
Finally got it to work
collect = (args...,callback) ->
ret = {}
len = args.length
for i in [0...len]
for own k,v of args[i]
ret[k] = v
callback(ret)
###
In normal JS
###
###
var collect,
__slice = [].slice,
__hasProp = {}.hasOwnProperty;
collect = function() {
var args, callback, i, k, len, ret, v, _i, _j, _ref;
args = 2 <= arguments.length ? __slice.call(arguments, 0, _i = arguments.length - 1) : (_i = 0, []), callback = arguments[_i++];
ret = {};
len = args.length;
for (i = _j = 0; 0 <= len ? _j < len : _j > len; i = 0 <= len ? ++_j : --_j) {
_ref = args[i];
for (k in _ref) {
if (!__hasProp.call(_ref, k)) continue;
v = _ref[k];
ret[k] = v;
}
}
return callback(ret);
};
###
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment