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

0.1.1 • Public • Published

@ganuz/set-prototype-of

Source Code Version MIT License Bundle Size TypeScript

Set Prototype Of is package from Ganuz library

Install

$ yarn add @ganuz/set-prototype-of

Or

$ npm install --save @ganuz/set-prototype-of

Use

Module

import {
  default as setPrototypeOf
} from '@ganuz/set-prototype-of';

Browser

<script src="https://unpkg.com/@ganuz/set-prototype-of/bundle.umd.min.js"></script>
let {
  setPrototypeOf
} = G;

Examples

 setPrototypeOf(null, {}); // throw TypeError
 setPrototypeOf({}, 78); // throw TypeError
 setPrototypeOf({}, null); // => true
 setPrototypeOf({}, []); // => true
 setPrototypeOf(Object('foo'), Number.prototype); // => true
 setPrototypeOf(Object.freeze(Object.create(null)), null); // => true
 setPrototypeOf(Object.freeze({}), Object.prototype); // => true
 setPrototypeOf(Object.freeze({}), {}); // => false
 setPrototypeOf(Object.freeze({}), null); // => false
 setPrototypeOf(Object.freeze(Object.create(null)), Object.prototype); // => false
 let a = {};
 let b = {};

 setPrototypeOf(a, null);
 setPrototypeOf(b, a);

 getPrototypeOf(a); // => null
 getPrototypeOf(b); // => a

Note: this method compatibility >= IE9

@ganuz/set-prototype-of/polyfill

Module

  import '@ganuz/set-prototype-of/polyfill';

Browser

<script src="https://unpkg.com/@ganuz/set-prototype-of/polyfill/bundle.umd.min.js"></script>

License

Copyright © Yisrael Eliev, Licensed under the MIT license.

Package Sidebar

Install

npm i @ganuz/set-prototype-of

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

245 kB

Total Files

27

Last publish

Collaborators

  • yisraelx