Created
May 24, 2016 03:39
-
-
Save KoryNunn/c1637826abbf7c32059f4e5af8fd2872 to your computer and use it in GitHub Desktop.
get distinct keys in N objects
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
| function uniqueKeys(objects){ | |
| return Object.keys(objects.reduce(function(result, object){ | |
| for(var key in object){ | |
| result[key] = true; | |
| } | |
| return result; | |
| }, {})); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment