UNPKG

844 BMarkdownView Raw
1# Polyfill for `Object.setPrototypeOf`
2
3[![NPM Version](https://img.shields.io/npm/v/setprototypeof.svg)](https://npmjs.org/package/setprototypeof)
4[![NPM Downloads](https://img.shields.io/npm/dm/setprototypeof.svg)](https://npmjs.org/package/setprototypeof)
5[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/standard/standard)
6
7A simple cross platform implementation to set the prototype of an instianted object. Supports all modern browsers and at least back to IE8.
8
9## Usage:
10
11```
12$ npm install --save setprototypeof
13```
14
15```javascript
16var setPrototypeOf = require('setprototypeof')
17
18var obj = {}
19setPrototypeOf(obj, {
20 foo: function () {
21 return 'bar'
22 }
23})
24obj.foo() // bar
25```
26
27TypeScript is also supported:
28
29```typescript
30import setPrototypeOf from 'setprototypeof'
31```