-
-
Save sgimeno/4b09a1ad7c993351e9a6 to your computer and use it in GitHub Desktop.
This file contains 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
_.merge = wrapFunct(_.merge); | |
_.union = wrapFunct(_.union); | |
_.merge(AJAX.get('foo'), [ 'en' ], AJAX.get('bar')); |
This file contains 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
// $q comes from angular | |
function wrapFunct(fn) { | |
return function() { | |
var context = this; | |
var args = [].slice.call(arguments); | |
var resolved = $q.all(args.map($q.when)); | |
return resolved.then(function(values) { | |
return fn.apply(context, values); | |
}); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment