Last active
December 1, 2015 16:32
-
-
Save corbanbrook/fc5b1196aeec65655955 to your computer and use it in GitHub Desktop.
Find all occurances of lodash functions in a bundle
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
cat file.js | grep "[^_]_\.[[:alpha:]]" | sed "s/.*_\.\([[:alpha:]]*\)[^[:alpha:]].*/\1/g" | sort | uniq | xargs | sed "s/ /,/g" | |
Outputs list like: | |
all,any,camelCase,capitalize,chain,clone,compact,contains,debounce,defaults,detect,difference,each,extend,filter,find,findIndex,findWhere,first,flatten,functions,groupBy,indexOf,inject,isArray,isEmpty,isEqual,isFunction,isString,keys,last,map,memoize,merge,pick,pluck,pull,reduce,reject,remove,sample,select,sortBy,startsWith,throttle,times,toArray,union,uniq,where,zip | |
Which can be sent to lodash-cli to create a custom build | |
lodash include=... | |
Or you can just do it all in one line: | |
cat file.js | grep "[^_]_\.[[:alpha:]]" | sed "s/.*_\.\([[:alpha:]]*\)[^[:alpha:]].*/\1/g" | sort | uniq | xargs | sed "s/ /,/g" | sed "s/^/include=/" | xargs lodash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment