Last active
December 21, 2015 02:19
-
-
Save Zyber17/6234595 to your computer and use it in GitHub Desktop.
Finally got it to work
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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