Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-prototype-prop-define

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-prototype-prop-define

Transform assignments to properties on built-in prototypes to Object.defineProperty calls

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-75%
Maintainers
1
Weekly downloads
 
Created
Source
  • babel-plugin-prototype-prop-define

babel-plugin-prototype-prop-define

A babel plugin for working around javascript's "override mistake" when dealing with frozen Primordials (built-ins).

background

If your primordials are frozen, such as in SES, assigning keys that are found on the prototype will throw an error.

Object.freeze(Object.prototype)

const x = {}
x.toString = () => 'hello'
// => TypeError: Cannot assign to read only property 'toString' of object '#<Object>'

Since this is a common, this plugin is provided to transform code into a safe form using Object.defineProperty:

Object.freeze(Object.prototype)

const x = {}
Object.defineProperty(x, 'toString', {
  value: () => 'hello',
  writable: true,
  enumerable: true,
  configurable: true,
})
x.toString()
// => 'hello'

Keywords

FAQs

Package last updated on 14 Aug 2019

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