Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var each = require('foreach')
- var fs = require('fs')
- var content = fs.readFileSync('./data/static/teams.json', 'utf-8')
- var ligas = {}
- var equipos = JSON.parse(content)
- each([equipos], function (value, key, array) {
- for (var i = 0; i < value.length; i++) {
- ligas = value.reduce(function (key, item) {
- key[item.liga] = key[item.liga] || []
- key[item.liga].push(item.equipo)
- return key
- }, Object.create(null))
- }
- });
- console.log(ligas)
Add Comment
Please, Sign In to add comment