Socket
Socket
Sign inDemoInstall

@babel/plugin-transform-duplicate-keys

Package Overview
Dependencies
Maintainers
5
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@babel/plugin-transform-duplicate-keys - npm Package Compare versions

Comparing version 7.0.0-beta.49 to 7.0.0-beta.50

8

package.json
{
"name": "@babel/plugin-transform-duplicate-keys",
"version": "7.0.0-beta.49",
"version": "7.0.0-beta.50",
"description": "Compile objects with duplicate keys to valid strict ES5",

@@ -12,3 +12,3 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-duplicate-keys",

"dependencies": {
"@babel/helper-plugin-utils": "7.0.0-beta.49"
"@babel/helper-plugin-utils": "7.0.0-beta.50"
},

@@ -19,5 +19,5 @@ "peerDependencies": {

"devDependencies": {
"@babel/core": "7.0.0-beta.49",
"@babel/helper-plugin-test-runner": "7.0.0-beta.49"
"@babel/core": "7.0.0-beta.50",
"@babel/helper-plugin-test-runner": "7.0.0-beta.50"
}
}
# @babel/plugin-transform-duplicate-keys
> Compile objects with duplicate keys to valid strict ES5.
> Compile objects with duplicate keys to valid strict ES5
This plugin actually converts duplicate keys in objects to be computed properties, which then must be handled by the [@babel/plugin-transform-computed-properties](http://babeljs.io/docs/plugins/transform-computed-properties) plugin. The final result won't contain any object literals with duplicate keys.
See our website [@babel/plugin-transform-duplicate-keys](https://new.babeljs.io/docs/en/next/babel-plugin-transform-duplicate-keys.html) for more information.
## Example
## Install
**In**
Using npm:
```javascript
var x = { a: 5, a: 6 };
var y = {
get a() {},
set a(x) {},
a: 3
};
```
**Out**
```javascript
var x = { a: 5, ["a"]: 6 };
var y = {
get a() {},
set a(x) {},
["a"]: 3
};
```
## Installation
```sh
npm install --save-dev @babel/plugin-transform-duplicate-keys
npm install --save @babel/plugin-transform-duplicate-keys
```
## Usage
or using yarn:
### Via `.babelrc` (Recommended)
**.babelrc**
```json
{
"plugins": ["@babel/plugin-transform-duplicate-keys"]
}
```
### Via CLI
```sh
babel --plugins @babel/plugin-transform-duplicate-keys script.js
yarn add --save @babel/plugin-transform-duplicate-keys
```
### Via Node API
```javascript
require("@babel/core").transform("code", {
plugins: ["@babel/plugin-transform-duplicate-keys"]
});
```
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