'use strict'

const normalizeURL = require('./normalizeURL')

module.exports = async function(url) {

	let nextState

	const endpoint = `${ normalizeURL(url) }.json`
	const response = await fetch(endpoint)

	if (response.ok===false) throw new Error('Failed to request components data')

	try { nextState = await response.json() }
	catch (err) { throw new Error('Failed to parse components data') }

	return nextState

}
@@ -99,24 +99,8 @@
  %7B%0A%0A
-%09let nextState%0A%0A
 %09con
@@ -275,25 +275,14 @@
 y %7B 
-nextState = await
+return
  res
@@ -369,24 +369,5 @@
  %7D%0A%0A
-%09return nextState%0A%0A
 %7D

Simplified return statement