0.1.1 • Published 7 years ago
@ganuz/set-prototype-of v0.1.1
@ganuz/set-prototype-of
Set Prototype Of is package from Ganuz library
Install
$ yarn add @ganuz/set-prototype-ofOr
$ npm install --save @ganuz/set-prototype-ofUse
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); // => aNote: 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.