Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-property-literals

Package Overview
Dependencies
1
Maintainers
5
Versions
69
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-transform-property-literals


Version published
Maintainers
5
Created

Package description

What is @babel/plugin-transform-property-literals?

The @babel/plugin-transform-property-literals package is a Babel plugin that transforms object properties to use literals when they are valid identifiers. This transformation can help improve code readability and potentially optimize execution by leveraging engine optimizations for property access.

What are @babel/plugin-transform-property-literals's main functionalities?

Transforming Reserved Word Properties

Transforms reserved word properties into literal properties if they are valid identifiers, ensuring compatibility and potentially improving execution speed.

{"var": "value"} // Before transformation
{"var": "value"} // After transformation

Transforming Numeric Properties

Automatically transforms numeric properties into their literal form, enhancing code readability and leveraging engine optimizations.

{"123": "value"} // Before transformation
{123: "value"} // After transformation

Other packages similar to @babel/plugin-transform-property-literals

Readme

Source

@babel/plugin-transform-property-literals

Ensure that reserved words are quoted in object property keys

Example

In

var foo = {
  catch: function () {}
};

Out

var foo = {
  "catch": function () {}
};

Installation

npm install --save-dev @babel/plugin-transform-property-literals

Usage

.babelrc

{
  "plugins": ["@babel/plugin-transform-property-literals"]
}

Via CLI

babel --plugins @babel/plugin-transform-property-literals script.js

Via Node API

require("@babel/core").transform("code", {
  plugins: ["@babel/plugin-transform-property-literals"]
});

Keywords

FAQs

Last updated on 23 Apr 2018

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc