is-proto-prop

2.0.0 • Public • Published

is-proto-prop

NPM version Build Status Coverage Status

Code Climate Dependencies DevDependencies

Does a JS type's prototype have a property

Uses Sindre Sorhus' proto-props

Install

npm install --save is-proto-prop

Usage

ES2015

import isProtoProp from 'is-proto-prop';
 
isProtoProp('array', 'length');
// => true
 
isProtoProp('Error', 'ignore');
// => false
 
// `is-proto-props` can only verify native JS types
isProtoProp('gulp', 'task');
// => false

ES5

var isProtoProp = require('is-proto-prop');
 
isProtoProp('array', 'length');
// => true
 
isProtoProp('Error', 'ignore');
// => false
 
// `is-proto-props` can only verify native JS types
isProtoProp('gulp', 'task');
// => false

API

isProtoProp(type, propertyName)

Returns a Boolean if propertyName is on type's prototype.

type

type: string

JS type to examine the prototype of. Note: is-proto-prop only looks at native JS types.

propertyName

type: string

Property name to look for on type's prototype. Note: propertyName is case sensitive.

LICENSE

MIT © Dustin Specker

Package Sidebar

Install

npm i is-proto-prop

Weekly Downloads

159,991

Version

2.0.0

License

MIT

Unpacked Size

9.04 kB

Total Files

12

Last publish

Collaborators

  • dustinspecker