@babel/plugin-transform-duplicate-keys
Advanced tools
Comparing version 7.0.0-beta.49 to 7.0.0-beta.50
{ | ||
"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"] | ||
}); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3049
3
20
+ Added@babel/helper-plugin-utils@7.0.0-beta.50(transitive)
- Removed@babel/helper-plugin-utils@7.0.0-beta.49(transitive)