setprototypeof
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

Polyfill for Object.setPrototypeOf

NPM Version NPM Downloads js-standard-style

A simple cross platform implementation to set the prototype of an instianted object. Supports all modern browsers and at least back to IE8.

Usage:

$ npm install --save setprototypeof
var setPrototypeOf = require('setprototypeof')
 
var obj = {}
setPrototypeOf(obj, {
  foo: function () {
    return 'bar'
  }
})
obj.foo() // bar

TypeScript is also supported:

import setPrototypeOf from 'setprototypeof'

Package Sidebar

Install

npm i setprototypeof

Weekly Downloads

44,797,879

Version

1.2.0

License

ISC

Unpacked Size

4.03 kB

Total Files

6

Last publish

Collaborators

  • wesleytodd