All files index.js

100% Statements 20/20
100% Branches 6/6
100% Functions 1/1
100% Lines 20/20

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 211x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 11x 2x 2x 9x 9x 9x 11x 11x  
import lowercaseKeys from 'lowercase-keys'
import protoProps from 'prototype-properties'
 
const lowerProtoProps = lowercaseKeys(protoProps)
 
/**
 * Determine if a property belongs to a type's prototype
 * @param {String} type - JS type
 * @param {String} property - name of property
 * @return {Boolean} - type has property on its prototype
 */
export default (type, property) => {
  if (typeof type !== 'string' || typeof property !== 'string') {
    throw new TypeError('Expected a string')
  }
 
  const lowerType = type.toLowerCase()
 
  return !!lowerProtoProps[lowerType] && lowerProtoProps[lowerType].indexOf(property) > -1
}