code: function xhr (url, options, callback) {
    if (typeof options === 'function') {
      callback = options
      options = null
    }
    const o = options || {}
    const req = new XMLHttpRequest()
    const method = o.method || 'get'
    const params = o.data || null
  
    req.queryString = params
    req.open(method, url, true)
    req.setRequestHeader('X-Requested-With', 'XMLHttpRequest')
  
    if (method.toLowerCase() === 'post') {
      req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
    }
  
    for (let key in o.headers) {
      if (o.headers.hasOwnProperty(key)) {
        req.setRequestHeader(key, o.headers[key])
      }
    }
  
    function stateChange () {
      if (req.readyState === 4) {
        if ((/^[20]/).test(req.status)) {
          callback(null, req.responseText)
        } else if ((/^[45]/).test(req.status)) {
          callback(new Error(req.status))
        }
      }
    }
  
    req.onreadystatechange = stateChange
  
    try {
      req.send(params)
    } catch (e) {
      // eslint-disable-next-line no-console
      console.log('Error: Resolving URL ' + url)
      callback(e)
    }
  }
docs: /*
  XHR Request
  adapted code from <https://github.com/xui/xui/blob/master/src/js/xhr.js>
  @credits Brian LeRoux, Brock Whitten, Rob Ellis