// >>> PUBLIC <<<

module.exports = (moduleName) => (type, val) => {
  const tag = Object.prototype.toString.call(val);
  if (`[object ${type}]` !== tag) {
    throw new TypeError(`${moduleName}: expected [${type}] but got ${tag}]`);
  }
};

// >>> PUBLIC <<<

module.exports = (moduleName) => (type, val) => {
  const tag = Object.prototype.toString.call(val);
  // Match both [object Function] and [object AsyncFunction]
  const throwError = type === 'Function'
    ? typeof val !== 'function'
    : `[object ${type}]` !== tag;

  if (throwError) {
    throw new TypeError(`${moduleName}: expected [${type}] but got ${tag}]`);
  }
};

Update assert type to handle both Function and async function
Update assert type to handle both Function and async function
