# all files / lib/ index.js

100% Statements 13/13
90% Branches 9/10
100% Functions 2/2
100% Lines 12/12

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31

    1

    1

    1

    1

    2

    1

    1
    10

    10
    2

    8

    8
     'use strict';

    var _lowercaseKeys = require('lowercase-keys');

    var _lowercaseKeys2 = _interopRequireDefault(_lowercaseKeys);

    var _protoProps = require('proto-props');

    var _protoProps2 = _interopRequireDefault(_protoProps);

    function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

    var lowerProtoProps = (0, _lowercaseKeys2.default)(_protoProps2.default);

    /**
     * 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
     */
    module.exports = function (type, property) {
      var lowerType = undefined;

      if (typeof type !== 'string' || typeof property !== 'string') {
        throw new TypeError('Expected a string');
      }

      lowerType = type.toLowerCase();

      return !!lowerProtoProps[lowerType] && lowerProtoProps[lowerType].indexOf(property) > -1;
    };