packages/insomnia-components/dist/index.js
/**
 * Does a generic check to check that the given payload is of a given type.
 * In cases like Number, it will return true for NaN as NaN is a Number (thanks javascript!);
 * It will, however, differentiate between object and null
 *
 * @template T
 * @param {*} payload
 * @param {T} type
 * @throws {TypeError} Will throw type error if type is an invalid type
 * @returns {payload is T}
 */
Does a generic check to check that the given payload is of a given type.
In cases like Number, it will return true for NaN as NaN is a Number (thanks javascript!);
It will, however, differentiate between object and null


Does a generic check to check that the given payload is of a given type . In cases like Number it will return true for NaN as NaN is a Number ( thanks javascript! ) ; It will however differentiate between object and null
function isType(payload, type) {
  if (!(type instanceof Function)) {
    throw new TypeError('Type must be a function');
  }
  if (!type.hasOwnProperty('prototype')) {
    throw new TypeError('Type is not a class');
  } 
  var name = type.name;
  return getType(payload) === name || Boolean(payload && payload.constructor === type);
}
function isType ( payload , type ) { if ( ! ( type instanceof Function ) ) { throw new TypeError ( 'Type must be a function' ) ; } if ( ! type . hasOwnProperty ( 'prototype' ) ) { throw new TypeError ( 'Type is not a class' ) ; } var name = type . name ; return getType ( payload ) === name || Boolean ( payload && payload . constructor === type ) ; }
Does a generic check to check that the given payload is of a given type.
Does a generic check to check that the given payload is of a given type .
// Classes usually have names (as functions usually have names)