@ganuz/is-prototype-of
v0.1.1
Published
Is Prototype Of is package from Ganuz library
Downloads
7
Maintainers
Readme
@ganuz/is-prototype-of
Is Prototype Of is package from Ganuz library
Install
$ yarn add @ganuz/is-prototype-of
Or
$ npm install --save @ganuz/is-prototype-of
Use
Module
import {
default as isPrototypeOf
} from '@ganuz/is-prototype-of';
Browser
<script src="https://unpkg.com/@ganuz/is-prototype-of/bundle.umd.min.js"></script>
let {
isPrototypeOf
} = G;
Examples
isPrototypeOf(Object.create(null), null); // throw TypeError
isPrototypeOf('foo', String.prototype); // => false
isPrototypeOf(Object(true), Boolean.prototype); // => true
isPrototypeOf({}, Object.prototype); // => true
class A{}
class B extends A{}
isPrototypeOf(B, A); // => true
isPrototypeOf(new B, A.prototype); // => true
isPrototypeOf(Object(1), Object.prototype); // => true
isPrototypeOf(Object.create(null), Object.prototype); // => false
let iframe = document.createElement('iframe');
document.body.appendChild(iframe);
let {contentWindow: {Array: IFrameArray}} = iframe;
isPrototypeOf([], IFrameArray.prototype); // => false
@ganuz/is-prototype-of/assert
Module
import {
default as assertPrototypeOf
} from '@ganuz/is-prototype-of/assert';
Browser
<script src="https://unpkg.com/@ganuz/is-prototype-of/assert/bundle.umd.min.js"></script>
let {
assertPrototypeOf
} = G;
Examples
assertPrototypeOf({}, String.prototype); // throw TypeError
assertPrototypeOf({foo: 'bar'}, Object.prototype); // => {foo: 'bar'}
License
Copyright © Yisrael Eliev, Licensed under the MIT license.