All files / adapters npm.js

100% Statements 6/6
100% Branches 2/2
100% Functions 1/1
100% Lines 6/6
1 2 3 4 5 6 7 8 9 10 11 12 13 14      4x   4x 2x 2x 2x     2x    
import fetch from 'node-fetch';
 
export default async (registry, name) => {
  const response = await fetch(`${registry}${name}`);
 
  if (!response.ok) {
    const error = new Error(`Could Not Get Package: ${registry}${name}`);
    error.status = response.status;
    throw error;
  }
 
  return response.json();
};