@babel/plugin-transform-proto-to-assign
Advanced tools
Comparing version 7.0.0-beta.46 to 7.0.0-beta.47
@@ -9,3 +9,3 @@ "use strict"; | ||
function _helperPluginUtils() { | ||
var data = require("@babel/helper-plugin-utils"); | ||
const data = require("@babel/helper-plugin-utils"); | ||
@@ -20,3 +20,3 @@ _helperPluginUtils = function _helperPluginUtils() { | ||
function _pull() { | ||
var data = _interopRequireDefault(require("lodash/pull")); | ||
const data = _interopRequireDefault(require("lodash/pull")); | ||
@@ -31,3 +31,3 @@ _pull = function _pull() { | ||
function _core() { | ||
var data = require("@babel/core"); | ||
const data = require("@babel/core"); | ||
@@ -43,3 +43,3 @@ _core = function _core() { | ||
var _default = (0, _helperPluginUtils().declare)(function (api) { | ||
var _default = (0, _helperPluginUtils().declare)(api => { | ||
api.assertVersion(7); | ||
@@ -54,3 +54,3 @@ | ||
function isProtoAssignmentExpression(node) { | ||
var left = node.left; | ||
const left = node.left; | ||
return _core().types.isMemberExpression(left) && _core().types.isLiteral(_core().types.toComputedKey(left, left.property), { | ||
@@ -67,7 +67,7 @@ value: "__proto__" | ||
visitor: { | ||
AssignmentExpression: function AssignmentExpression(path, file) { | ||
AssignmentExpression(path, file) { | ||
if (!isProtoAssignmentExpression(path.node)) return; | ||
var nodes = []; | ||
var left = path.node.left.object; | ||
var temp = path.scope.maybeGenerateMemoised(left); | ||
const nodes = []; | ||
const left = path.node.left.object; | ||
const temp = path.scope.maybeGenerateMemoised(left); | ||
@@ -82,4 +82,5 @@ if (temp) { | ||
}, | ||
ExpressionStatement: function ExpressionStatement(path, file) { | ||
var expr = path.node.expression; | ||
ExpressionStatement(path, file) { | ||
const expr = path.node.expression; | ||
if (!_core().types.isAssignmentExpression(expr, { | ||
@@ -93,9 +94,10 @@ operator: "=" | ||
}, | ||
ObjectExpression: function ObjectExpression(path, file) { | ||
var proto; | ||
var node = path.node; | ||
ObjectExpression(path, file) { | ||
let proto; | ||
const node = path.node; | ||
var _arr = node.properties; | ||
for (var _i = 0; _i < _arr.length; _i++) { | ||
var prop = _arr[_i]; | ||
const prop = _arr[_i]; | ||
@@ -109,3 +111,3 @@ if (isProtoKey(prop)) { | ||
if (proto) { | ||
var args = [_core().types.objectExpression([]), proto]; | ||
const args = [_core().types.objectExpression([]), proto]; | ||
if (node.properties.length) args.push(node); | ||
@@ -115,2 +117,3 @@ path.replaceWith(_core().types.callExpression(file.addHelper("extends"), args)); | ||
} | ||
} | ||
@@ -117,0 +120,0 @@ }; |
{ | ||
"name": "@babel/plugin-transform-proto-to-assign", | ||
"version": "7.0.0-beta.46", | ||
"version": "7.0.0-beta.47", | ||
"description": "Babel plugin for turning __proto__ into a shallow property clone", | ||
@@ -12,11 +12,11 @@ "repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-proto-to-assign", | ||
"dependencies": { | ||
"@babel/helper-plugin-utils": "7.0.0-beta.46" | ||
"@babel/helper-plugin-utils": "7.0.0-beta.47" | ||
}, | ||
"peerDependencies": { | ||
"@babel/core": "7.0.0-beta.46" | ||
"@babel/core": "7.0.0-beta.47" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "7.0.0-beta.46", | ||
"@babel/helper-plugin-test-runner": "7.0.0-beta.46" | ||
"@babel/core": "7.0.0-beta.47", | ||
"@babel/helper-plugin-test-runner": "7.0.0-beta.47" | ||
} | ||
} |
@@ -41,3 +41,3 @@ # @babel/plugin-transform-proto-to-assign | ||
```javascript | ||
var _defaults = ...; | ||
function _defaults(obj, defaults) { ... } | ||
@@ -78,1 +78,5 @@ _defaults(bar, foo); | ||
``` | ||
## References | ||
* [MDN: Object.prototype.\_\_proto\_\_](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/proto) |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
4960
81
0
+ Added@babel/code-frame@7.0.0-beta.47(transitive)
+ Added@babel/core@7.0.0-beta.47(transitive)
+ Added@babel/generator@7.0.0-beta.47(transitive)
+ Added@babel/helper-function-name@7.0.0-beta.47(transitive)
+ Added@babel/helper-get-function-arity@7.0.0-beta.47(transitive)
+ Added@babel/helper-plugin-utils@7.0.0-beta.47(transitive)
+ Added@babel/helper-split-export-declaration@7.0.0-beta.47(transitive)
+ Added@babel/helpers@7.0.0-beta.47(transitive)
+ Added@babel/highlight@7.0.0-beta.47(transitive)
+ Added@babel/template@7.0.0-beta.47(transitive)
+ Added@babel/traverse@7.0.0-beta.47(transitive)
+ Added@babel/types@7.0.0-beta.47(transitive)
+ Addedbabylon@7.0.0-beta.47(transitive)
- Removed@babel/code-frame@7.0.0-beta.46(transitive)
- Removed@babel/core@7.0.0-beta.46(transitive)
- Removed@babel/generator@7.0.0-beta.46(transitive)
- Removed@babel/helper-function-name@7.0.0-beta.46(transitive)
- Removed@babel/helper-get-function-arity@7.0.0-beta.46(transitive)
- Removed@babel/helper-plugin-utils@7.0.0-beta.46(transitive)
- Removed@babel/helper-split-export-declaration@7.0.0-beta.46(transitive)
- Removed@babel/helpers@7.0.0-beta.46(transitive)
- Removed@babel/highlight@7.0.0-beta.46(transitive)
- Removed@babel/template@7.0.0-beta.46(transitive)
- Removed@babel/traverse@7.0.0-beta.46(transitive)
- Removed@babel/types@7.0.0-beta.46(transitive)
- Removedbabylon@7.0.0-beta.46(transitive)