@ganuz/is-prototype-of
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

@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.

Package Sidebar

Install

npm i @ganuz/is-prototype-of

Weekly Downloads

2

Version

0.1.1

License

MIT

Unpacked Size

90 kB

Total Files

27

Last publish

Collaborators

  • yisraelx