estree-to-babel
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -6,13 +6,12 @@ 'use strict'; | ||
isObjectExpression, | ||
isLiteral, | ||
classMethod, | ||
isLiteral | ||
} = require('@babel/types'); | ||
const traverseObjectExpression = require('./traverse-object-expression'); | ||
const setClassMethod = require('./set-class-method'); | ||
const isString = (a) => typeof a === 'string'; | ||
const isNumber = (a) => typeof a === 'number'; | ||
const isNull = (a) => a === null; | ||
const {assign} = Object; | ||
module.exports = (node) => { | ||
@@ -53,33 +52,2 @@ const { | ||
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) { | ||
@@ -101,3 +69,8 @@ node.type = 'ObjectProperty'; | ||
} | ||
if (isNull(value)) { | ||
node.type = 'NullLiteral'; | ||
return; | ||
} | ||
} | ||
{ | ||
"name": "estree-to-babel", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", | ||
@@ -5,0 +5,0 @@ "description": "convert estree ast to babel", |
@@ -30,3 +30,3 @@ # 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`, `NullLiteral` instead of `Literal`; | ||
- `ClassMethod` instead of `MethodDefinition`; | ||
@@ -33,0 +33,0 @@ - etc... |
Sorry, the diff of this file is not supported yet
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
7954
7
111