Set Prototype Of is package from Ganuz library
npm install @ganuz/set-prototype-ofSet Prototype Of is package from Ganuz library
sh
$ yarn add @ganuz/set-prototype-of
`
Or
`sh
$ npm install --save @ganuz/set-prototype-of
`Use
Module
`typescript
import {
default as setPrototypeOf
} from '@ganuz/set-prototype-of';
`Browser
`html
`
`typescript
let {
setPrototypeOf
} = G;
`Examples
`typescript
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
`
`typescript
let a = {};
let b = {}; setPrototypeOf(a, null);
setPrototypeOf(b, a);
getPrototypeOf(a); // => null
getPrototypeOf(b); // => a
`Note: this method compatibility >= IE9
$3
Module
`typescript
import '@ganuz/set-prototype-of/polyfill';
`Browser
`html
``