@babel/plugin-transform-duplicate-keys
Advanced tools
Comparing version 7.0.0-beta.42 to 7.0.0-beta.43
"use strict"; | ||
exports.__esModule = true; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = void 0; | ||
var _helperPluginUtils = require("@babel/helper-plugin-utils"); | ||
function _helperPluginUtils() { | ||
const data = require("@babel/helper-plugin-utils"); | ||
var _core = require("@babel/core"); | ||
_helperPluginUtils = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function _core() { | ||
const data = require("@babel/core"); | ||
_core = function () { | ||
return data; | ||
}; | ||
return data; | ||
} | ||
function getName(key) { | ||
if (_core.types.isIdentifier(key)) { | ||
if (_core().types.isIdentifier(key)) { | ||
return key.name; | ||
@@ -18,32 +36,20 @@ } | ||
var _default = (0, _helperPluginUtils.declare)(function (api) { | ||
var _default = (0, _helperPluginUtils().declare)(api => { | ||
api.assertVersion(7); | ||
return { | ||
visitor: { | ||
ObjectExpression: function ObjectExpression(path) { | ||
var node = path.node; | ||
var plainProps = node.properties.filter(function (prop) { | ||
return !_core.types.isSpreadElement(prop) && !prop.computed; | ||
}); | ||
var alreadySeenData = Object.create(null); | ||
var alreadySeenGetters = Object.create(null); | ||
var alreadySeenSetters = Object.create(null); | ||
ObjectExpression(path) { | ||
const { | ||
node | ||
} = path; | ||
const plainProps = node.properties.filter(prop => !_core().types.isSpreadElement(prop) && !prop.computed); | ||
const alreadySeenData = Object.create(null); | ||
const alreadySeenGetters = Object.create(null); | ||
const alreadySeenSetters = Object.create(null); | ||
for (var _iterator = plainProps, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { | ||
var _ref; | ||
for (const prop of plainProps) { | ||
const name = getName(prop.key); | ||
let isDuplicate = false; | ||
if (_isArray) { | ||
if (_i >= _iterator.length) break; | ||
_ref = _iterator[_i++]; | ||
} else { | ||
_i = _iterator.next(); | ||
if (_i.done) break; | ||
_ref = _i.value; | ||
} | ||
var _prop = _ref; | ||
var name = getName(_prop.key); | ||
var isDuplicate = false; | ||
switch (_prop.kind) { | ||
switch (prop.kind) { | ||
case "get": | ||
@@ -74,7 +80,8 @@ if (alreadySeenData[name] || alreadySeenGetters[name]) { | ||
if (isDuplicate) { | ||
_prop.computed = true; | ||
_prop.key = _core.types.stringLiteral(name); | ||
prop.computed = true; | ||
prop.key = _core().types.stringLiteral(name); | ||
} | ||
} | ||
} | ||
} | ||
@@ -81,0 +88,0 @@ }; |
{ | ||
"name": "@babel/plugin-transform-duplicate-keys", | ||
"version": "7.0.0-beta.42", | ||
"version": "7.0.0-beta.43", | ||
"description": "Compile objects with duplicate keys to valid strict ES5", | ||
@@ -12,11 +12,11 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-duplicate-keys", | ||
"dependencies": { | ||
"@babel/helper-plugin-utils": "7.0.0-beta.42" | ||
"@babel/helper-plugin-utils": "7.0.0-beta.43" | ||
}, | ||
"peerDependencies": { | ||
"@babel/core": "7.0.0-beta.42" | ||
"@babel/core": "7.0.0-beta.43" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.0.0-beta.42", | ||
"@babel/helper-plugin-test-runner": "7.0.0-beta.42" | ||
"@babel/core": "7.0.0-beta.43", | ||
"@babel/helper-plugin-test-runner": "7.0.0-beta.43" | ||
} | ||
} |
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
68
3690
+ Added@babel/code-frame@7.0.0-beta.43(transitive)
+ Added@babel/core@7.0.0-beta.43(transitive)
+ Added@babel/generator@7.0.0-beta.43(transitive)
+ Added@babel/helper-function-name@7.0.0-beta.43(transitive)
+ Added@babel/helper-get-function-arity@7.0.0-beta.43(transitive)
+ Added@babel/helper-plugin-utils@7.0.0-beta.43(transitive)
+ Added@babel/helper-split-export-declaration@7.0.0-beta.43(transitive)
+ Added@babel/helpers@7.0.0-beta.43(transitive)
+ Added@babel/highlight@7.0.0-beta.43(transitive)
+ Added@babel/template@7.0.0-beta.43(transitive)
+ Added@babel/traverse@7.0.0-beta.43(transitive)
+ Added@babel/types@7.0.0-beta.43(transitive)
+ Addedbabylon@7.0.0-beta.43(transitive)
- Removed@babel/code-frame@7.0.0-beta.42(transitive)
- Removed@babel/core@7.0.0-beta.42(transitive)
- Removed@babel/generator@7.0.0-beta.42(transitive)
- Removed@babel/helper-function-name@7.0.0-beta.42(transitive)
- Removed@babel/helper-get-function-arity@7.0.0-beta.42(transitive)
- Removed@babel/helper-plugin-utils@7.0.0-beta.42(transitive)
- Removed@babel/helper-split-export-declaration@7.0.0-beta.42(transitive)
- Removed@babel/helpers@7.0.0-beta.42(transitive)
- Removed@babel/highlight@7.0.0-beta.42(transitive)
- Removed@babel/template@7.0.0-beta.42(transitive)
- Removed@babel/traverse@7.0.0-beta.42(transitive)
- Removed@babel/types@7.0.0-beta.42(transitive)
- Removedbabylon@7.0.0-beta.42(transitive)