unpkg/server/NPMAPI.js
MICHAEL JACKSON 1173f91091 Require packages to be downloaded >= 100x/day
This should make it more difficult for people who are publishing
malicious packages to npm to get them on the CDN.
2017-08-16 23:04:59 -07:00

18 lines
307 B
JavaScript

require('isomorphic-fetch')
const NPMAPIURL = 'https://api.npmjs.org'
function getJSON(path) {
return fetch(`${NPMAPIURL}${path}`, {
headers: {
Accept: 'application/json'
}
}).then(function (res) {
return res.status === 404 ? null : res.json()
})
}
module.exports = {
getJSON
}