UNPKG

nba

Version:

JavaScript client for the NBA's stats API

22 lines (15 loc) 429 B
#!/usr/bin/env node var fs = require("fs"); var path = require("path"); var updateTeams = require("../src").updateTeams; updateTeams(function (err, teams) { var filePath = path.join(__dirname, "../data/teams.json"); var str; try { str = JSON.stringify(teams, null, 2); JSON.parse(str); } catch (e) { throw new Error("Unable to parse JSON response: " + teams); } fs.writeFileSync(filePath, str); });