Skip to content

Commit

Permalink
Fix: Changes from arrow functions to function declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelbr committed Sep 27, 2017
1 parent b938890 commit f44cd64
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions codemods/to-arrow.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function transform(file, api, options) {
const printOptions = options.printOptions || { quote: 'single' };
const root = j(file.source);

const getBodyStatement = fn => {
function getBodyStatement(fn) {
// 79 characters fit on a line of length 80
const maxWidth = options['max-width'] ? options['max-width'] - 1 : undefined;

Expand All @@ -42,13 +42,13 @@ function transform(file, api, options) {
}
}
return fn.body;
};
}

const createArrowFunctionExpression = fn => {
function createArrowFunctionExpression(fn) {
const arrowFunction = j.arrowFunctionExpression(fn.params, getBodyStatement(fn), false);
arrowFunction.comments = fn.comments;
return arrowFunction;
};
}

const replacedBoundFunctions =
root
Expand Down

0 comments on commit f44cd64

Please sign in to comment.