Created
January 13, 2017 13:47
-
-
Save panayotoff/e8ddd15f2c5a901bc08c6a1ee16f35c9 to your computer and use it in GitHub Desktop.
ES6 firebase object to array
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
| /* | |
| * Converts firebase object to Array; | |
| * Each object from the array will contain 'key' property, | |
| * corresponding to the firebase key | |
| * */ | |
| const toArray = function (firebaseObj) { | |
| return Object.keys(firebaseObj).map((key)=> { | |
| return Object.assign(firebaseObj[key], {key}); | |
| }) | |
| }; | |
| export {toArray} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment