Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
exotic / src / types / kind / isTypeEq.ts
Size: Mime:
import { Typeof } from '../../../typings'
import { curry } from '../../deps'

/**
 * @desc typeof x === type
 * @since 5.0.0-beta.6
 * @name isType
 * @alias typeEq
 *
 * @curried 2
 *
 * @param type to match
 * @param x object to match `typeof x === type`
 *
 * {@link https://github.com/facebook/jest/blob/master/packages/jest-get-type/src/index.js jest-get-type}
 * {@link https://github.com/yesvods/sanife/blob/master/src/type.js#L3 sanife-type}
 * @see {@link sanife-type}
 * @see {@link jest-get-type}
 *
 * @example
 *    isType('string')('eh') //=> true
 *
 */
function isType(type: Typeof, x: Typeof) {
  return typeof x === type
}

const isTypeEq = curry(2, isType)

export { isTypeEq, isType }
export default isTypeEq

// const xIsType = flip2(isType)