Created
June 4, 2014 20:47
-
-
Save chrisnicola/7f25039a868493d13658 to your computer and use it in GitHub Desktop.
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
# Provides angular filters for lodash or underscore functions | |
module = angular.module('_filters', []) | |
_(_).functions().each (name) -> | |
n = name | |
module.filter '_' + n, -> _[n] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Turns all Underscore/Lodash functions into AngularJS filters in 4 lines. The need to locally scope "name" really threw me for a while. Every single filter would return
_.zipObject
. Stupid Javascript.