Last active
March 20, 2018 10:55
-
-
Save ademilter/d464b7c378b61cc38b8d3872f6a33b3f to your computer and use it in GitHub Desktop.
JS Bin// source http://jsbin.com/wacibirore
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
| var Categories = {}; | |
| fetch('http://api.bigchefs.protelworks.com/menu/items/').then(function (response) { | |
| return response.json(); | |
| }).then(function (data) { | |
| console.log(data); | |
| data.menu_items.forEach(function (obj) { | |
| if (!_.has(Categories, obj.categories)) { | |
| _.set(Categories, obj.categories.join(".") + '.items', []); | |
| } | |
| var items = _.get(Categories, obj.categories.join(".") + '.items'); | |
| items.push(obj); | |
| }); | |
| console.log(Categories); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment