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

babel-generator

Package Overview
Dependencies
Maintainers
6
Versions
94
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-generator - npm Package Compare versions

Comparing version 6.14.0 to 6.16.0

8

lib/generators/classes.js

@@ -64,3 +64,9 @@ "use strict";

}
this.print(node.key, node);
if (node.computed) {
this.token("[");
this.print(node.key, node);
this.token("]");
} else {
this.print(node.key, node);
}
this.print(node.typeAnnotation, node);

@@ -67,0 +73,0 @@ if (node.value) {

@@ -302,3 +302,8 @@ "use strict";

this.token("{");
if (node.exact) {
this.token("{|");
} else {
this.token("{");
}
var props = node.properties.concat(node.callProperties, node.indexers);

@@ -323,3 +328,7 @@

this.token("}");
if (node.exact) {
this.token("|}");
} else {
this.token("}");
}
}

@@ -326,0 +335,0 @@

10

lib/generators/methods.js

@@ -94,4 +94,6 @@ "use strict";

if (node.params.length === 1 && t.isIdentifier(node.params[0])) {
this.print(node.params[0], node);
var firstParam = node.params[0];
if (node.params.length === 1 && t.isIdentifier(firstParam) && !hasTypes(node, firstParam)) {
this.print(firstParam, node);
} else {

@@ -106,2 +108,6 @@ this._params(node);

this.print(node.body, node);
}
function hasTypes(node, param) {
return node.typeParameters || node.returnType || param.typeAnnotation || param.optional || param.trailingComments;
}
"use strict";
exports.__esModule = true;
exports.ThrowStatement = exports.BreakStatement = exports.ReturnStatement = exports.ContinueStatement = exports.ForOfStatement = exports.ForInStatement = undefined;
exports.ThrowStatement = exports.BreakStatement = exports.ReturnStatement = exports.ContinueStatement = exports.ForAwaitStatement = exports.ForOfStatement = exports.ForInStatement = undefined;

@@ -115,3 +115,9 @@ var _getIterator2 = require("babel-runtime/core-js/get-iterator");

this.space();
if (op === "await") {
this.word("await");
this.space();
op = "of";
}
this.token("(");
this.print(node.left, node);

@@ -129,2 +135,3 @@ this.space();

var ForOfStatement = exports.ForOfStatement = buildForXStatement("of");
var ForAwaitStatement = exports.ForAwaitStatement = buildForXStatement("await");

@@ -131,0 +138,0 @@ function DoWhileStatement(node) {

@@ -5,7 +5,2 @@ "use strict";

exports.ArrayPattern = exports.ObjectPattern = exports.RestProperty = exports.SpreadProperty = exports.SpreadElement = undefined;
var _stringify = require("babel-runtime/core-js/json/stringify");
var _stringify2 = _interopRequireDefault(_stringify);
exports.Identifier = Identifier;

@@ -27,6 +22,10 @@ exports.RestElement = RestElement;

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
var _jsesc = require("jsesc");
var _jsesc2 = _interopRequireDefault(_jsesc);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function Identifier(node) {

@@ -145,19 +144,8 @@ if (node.variance) {

var val = (0, _stringify2.default)(node.value);
val = val.replace(/[\u000A\u000D\u2028\u2029]/g, function (c) {
return "\\u" + ("0000" + c.charCodeAt(0).toString(16)).slice(-4);
var val = (0, _jsesc2.default)(node.value, {
quotes: t.isJSX(parent) ? "double" : this.format.quotes,
wrap: true
});
if (this.format.quotes === "single" && !t.isJSX(parent)) {
val = val.slice(1, -1);
val = val.replace(/\\"/g, '"');
val = val.replace(/'/g, "\\'");
val = "'" + val + "'";
}
return this.token(val);
}

@@ -120,2 +120,7 @@ "use strict";

function findCommonStringDelimiter(code, tokens) {
var DEFAULT_STRING_DELIMITER = "double";
if (!code) {
return DEFAULT_STRING_DELIMITER;
}
var occurences = {

@@ -122,0 +127,0 @@ single: 0,

{
"name": "babel-generator",
"version": "6.14.0",
"version": "6.16.0",
"description": "Turns an AST into code.",

@@ -16,4 +16,5 @@ "author": "Sebastian McKenzie <sebmck@gmail.com>",

"babel-runtime": "^6.9.0",
"babel-types": "^6.14.0",
"babel-types": "^6.16.0",
"detect-indent": "^3.0.1",
"jsesc": "^1.3.0",
"lodash": "^4.2.0",

@@ -24,4 +25,4 @@ "source-map": "^0.5.0"

"babel-helper-fixtures": "^6.9.0",
"babylon": "^6.9.0"
"babylon": "^6.11.0"
}
}
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