src/query-helpers.js
function makeSingleQuery(allQuery, getMultipleError) {
  return (container, ...args) => {
    const els = allQuery(container, ...args)
    if (els.length > 1) {
      throw getMultipleElementsFoundError(
        getMultipleError(container, ...args),
        container,
      )
    }
    return els[0] || null
  }
}
function makeSingleQuery(allQuery, getMultipleError) {
  return (container, ...args) => {
    const els = allQuery(container, ...args)
    if (els.length > 1) {
      throw getMultipleElementsFoundError(
        getMultipleError(container, ...args),
        container,
      )
    }
    return els[0] || null
  }
}
function makeSingleQuery ( allQuery , getMultipleError ) { return ( container , ... args ) => { const els = allQuery ( container , ... args ) if ( els . length > 1 ) { throw getMultipleElementsFoundError ( getMultipleError ( container , ... args ) , container , ) } return els [ 0 ] || null } }
this accepts a query function and returns a function which throws an error if more than one elements is returned, otherwise it returns the first element or null
this accepts a query function and returns a function which throws an error if more than one elements is returned otherwise it returns the first element or null