Socket
Socket
Sign inDemoInstall

set-prototype-of

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

set-prototype-of

Object.setPrototypeOf Polyfill


Version published
Weekly downloads
25K
increased by10.48%
Maintainers
1
Weekly downloads
 
Created
Source

Object.setPrototypeOf Polyfill (set-prototype-of)

Example

require('set-prototype-of'); // Object.setPrototypeOf Polyfill
Object.setPrototypeOf(obj, proto);
Syntax
Object.setPrototypeOf(obj, prototype);
Parameters
  • obj - The object which is to have its prototype set.
  • prototype - The object's new prototype (an object or null).

Description

Throws a TypeError exception if the object whose [[Prototype]] is to be modified is non-extensible according to Object.isExtensible(). Does nothing if the prototype parameter isn't an object or null (i.e., number, string, boolean, or undefined). Otherwise, this method changes the [[Prototype]] of obj to the new value.

Object.setPrototypeOf() is in the latest ECMAScript 6 standard draft. It is generally considered the proper way to set the prototype of an object, vs. the more controversial Object.prototype.__proto__ property.

License

MIT

Keywords

FAQs

Package last updated on 10 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc