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

eslint-plugin-prefer-arrow-functions

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-prefer-arrow-functions - npm Package Compare versions

Comparing version 3.3.0 to 3.3.1

20

dist/prefer-arrow-functions.js

@@ -141,15 +141,13 @@ "use strict";

var writeArrowFunction = function (node) {
var _a = getFunctionDescriptor(node), body = _a.body, isAsync = _a.isAsync, isGeneric = _a.isGeneric, generic = _a.generic, params = _a.params, returnType = _a.returnType;
return 'ASYNC<GENERIC>(PARAMS)RETURN_TYPE => BODY'
.replace('ASYNC', isAsync ? 'async ' : '')
.replace('<GENERIC>', isGeneric ? generic : '')
.replace('BODY', body)
.replace('RETURN_TYPE', returnType ? returnType : '')
.replace('PARAMS', params.join(', '));
var fn = getFunctionDescriptor(node);
var ASYNC = fn.isAsync ? 'async ' : '';
var GENERIC = fn.isGeneric ? fn.generic : '';
var BODY = fn.body;
var RETURN_TYPE = fn.returnType ? fn.returnType : '';
var PARAMS = fn.params.join(', ');
return "" + ASYNC + GENERIC + "(" + PARAMS + ")" + RETURN_TYPE + " => " + BODY;
};
var writeArrowConstant = function (node) {
var name = getFunctionDescriptor(node).name;
return 'const NAME = ARROW_FUNCTION'
.replace('NAME', name)
.replace('ARROW_FUNCTION', writeArrowFunction(node));
var fn = getFunctionDescriptor(node);
return "const " + fn.name + " = " + writeArrowFunction(node);
};

@@ -156,0 +154,0 @@ var getFunctionDescriptor = function (node) {

{
"name": "eslint-plugin-prefer-arrow-functions",
"description": "Convert functions to arrow functions",
"version": "3.3.0",
"version": "3.3.1",
"author": "Jamie Mason (https://github.com/JamieMason)",

@@ -12,3 +12,5 @@ "bugs": "https://github.com/JamieMason/eslint-plugin-prefer-arrow-functions/issues",

"Michael Gallagher (https://github.com/mikeapr4)",
"Mitchell Merry (https://github.com/mitchell-merry)",
"Pablo Enrici (https://github.com/pablen)",
"Renato Böhler (https://github.com/renato-bohler)",
"Triston Jones (https://github.com/TristonJ)"

@@ -23,3 +25,3 @@ ],

"auto-changelog": "2.4.0",
"eslint": "8.2.0",
"eslint": "8.57.0",
"jest": "27.3.1",

@@ -26,0 +28,0 @@ "prettier": "2.4.1",

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