0.1.1 • Published 6 years ago

@ganuz/is-prototype-of v0.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

@ganuz/is-prototype-of

Source Code Version MIT License Bundle Size TypeScript

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.