Run prettier
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import syntaxFunctionBind from "babel-plugin-syntax-function-bind";
|
||||
|
||||
export default function ({ types: t }) {
|
||||
export default function({ types: t }) {
|
||||
function getTempId(scope) {
|
||||
let id = scope.path.getData("functionBind");
|
||||
if (id) return id;
|
||||
@@ -25,7 +25,11 @@ export default function ({ types: t }) {
|
||||
bind.callee,
|
||||
]);
|
||||
} else {
|
||||
bind.callee.object = t.assignmentExpression("=", tempId, bind.callee.object);
|
||||
bind.callee.object = t.assignmentExpression(
|
||||
"=",
|
||||
tempId,
|
||||
bind.callee.object,
|
||||
);
|
||||
}
|
||||
return tempId;
|
||||
}
|
||||
@@ -46,7 +50,12 @@ export default function ({ types: t }) {
|
||||
BindExpression(path) {
|
||||
const { node, scope } = path;
|
||||
const context = inferBindContext(node, scope);
|
||||
path.replaceWith(t.callExpression(t.memberExpression(node.callee, t.identifier("bind")), [context]));
|
||||
path.replaceWith(
|
||||
t.callExpression(
|
||||
t.memberExpression(node.callee, t.identifier("bind")),
|
||||
[context],
|
||||
),
|
||||
);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user