main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
844 bytes
|
Line | |
---|
1 | # Polyfill for `Object.setPrototypeOf`
|
---|
2 |
|
---|
3 | [](https://npmjs.org/package/setprototypeof)
|
---|
4 | [](https://npmjs.org/package/setprototypeof)
|
---|
5 | [](https://github.com/standard/standard)
|
---|
6 |
|
---|
7 | A 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
|
---|
16 | var setPrototypeOf = require('setprototypeof')
|
---|
17 |
|
---|
18 | var obj = {}
|
---|
19 | setPrototypeOf(obj, {
|
---|
20 | foo: function () {
|
---|
21 | return 'bar'
|
---|
22 | }
|
---|
23 | })
|
---|
24 | obj.foo() // bar
|
---|
25 | ```
|
---|
26 |
|
---|
27 | TypeScript is also supported:
|
---|
28 |
|
---|
29 | ```typescript
|
---|
30 | import setPrototypeOf from 'setprototypeof'
|
---|
31 | ```
|
---|
Note:
See
TracBrowser
for help on using the repository browser.