Skip to content

Instantly share code, notes, and snippets.

@ArturoRodriguezRomero
Created January 31, 2018 10:53
Show Gist options
  • Select an option

  • Save ArturoRodriguezRomero/00c5468abb9209c81c10d0bebf494baa to your computer and use it in GitHub Desktop.

Select an option

Save ArturoRodriguezRomero/00c5468abb9209c81c10d0bebf494baa to your computer and use it in GitHub Desktop.

Revisions

  1. ArturoRodriguezRomero created this gist Jan 31, 2018.
    11 changes: 11 additions & 0 deletions snapshot-to-array.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    function snapshotToArray(snapshot) {
    let returnArr = [];

    snapshot.forEach(childSnapshot => {
    let item = childSnapshot.val();
    item.key = childSnapshot.key;
    returnArr.push(item);
    });

    return returnArr;
    };