Add node modules and compiled JavaScript from main (#172)

Co-authored-by: Oliver King <oking3@uncc.edu>
This commit is contained in:
github-actions[bot]
2022-02-09 17:16:49 -05:00
committed by GitHub
parent ee3c5aed75
commit 08d466b6ab
8070 changed files with 1753185 additions and 2 deletions
+26
View File
@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = optimiseCallExpression;
var t = require("@babel/types");
function optimiseCallExpression(callee, thisNode, args, optional) {
if (args.length === 1 && t.isSpreadElement(args[0]) && t.isIdentifier(args[0].argument, {
name: "arguments"
})) {
if (optional) {
return t.optionalCallExpression(t.optionalMemberExpression(callee, t.identifier("apply"), false, true), [thisNode, args[0].argument], false);
}
return t.callExpression(t.memberExpression(callee, t.identifier("apply")), [thisNode, args[0].argument]);
} else {
if (optional) {
return t.optionalCallExpression(t.optionalMemberExpression(callee, t.identifier("call"), false, true), [thisNode, ...args], false);
}
return t.callExpression(t.memberExpression(callee, t.identifier("call")), [thisNode, ...args]);
}
}