Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

estree-to-babel

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

estree-to-babel - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

43

lib/estree-to-babel.js

@@ -6,3 +6,4 @@ 'use strict';

isObjectExpression,
isLiteral
isLiteral,
classMethod,
} = require('@babel/types');

@@ -15,2 +16,4 @@

const {assign} = Object;
module.exports = (node) => {

@@ -41,3 +44,6 @@ const {

if (type === 'Property')
return setProperty(node);
return setObjectProperty(node);
if (type === 'MethodDefinition')
return setClassMethod(path);
},

@@ -49,3 +55,34 @@ });

function setProperty(node) {
function setClassMethod(path) {
const {node} = path;
const {
key,
kind,
computed,
} = node;
const {
body,
params,
expression,
generator,
} = node.value;
path.replaceWith(classMethod(
kind,
key,
params,
body,
computed,
node.static,
)
);
assign(path.node, {
expression,
generator,
});
}
function setObjectProperty(node) {
node.type = 'ObjectProperty';

@@ -52,0 +89,0 @@ }

5

package.json
{
"name": "estree-to-babel",
"version": "1.2.0",
"version": "1.3.0",
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",

@@ -18,2 +18,4 @@ "description": "convert estree ast to babel",

"lint": "eslint lib test --ignore-pattern test/fixture",
"putout:fix": "redrun putout -- --fix",
"putout": "putout lib test",
"coverage": "nyc npm test",

@@ -41,2 +43,3 @@ "report": "nyc report --reporter=text-lcov | coveralls"

"nyc": "^13.0.1",
"putout": "^3.0.0",
"redrun": "^7.0.2",

@@ -43,0 +46,0 @@ "tape": "^4.8.0",

@@ -30,3 +30,4 @@ # Estree-to-babel [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]

- `File` node;
- `StringLiteral`, `NumericLiteral` instead of `Literal`
- `StringLiteral`, `NumericLiteral` instead of `Literal`;
- `ClassMethod` instead of `MethodDefinition`;
- etc...

@@ -33,0 +34,0 @@

Sorry, the diff of this file is not supported yet

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