You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
380 B
JavaScript

"use strict";
const unpackExpression = require("./unpack-expression");
const template = require("@babel/template").default;
// Like `@babel/template`, but eliminates the wrapping ExpressionStatement
module.exports = function templateExpression(... args) {
let tmpl = template(... args);
return function (... callArgs) {
return unpackExpression(tmpl(... callArgs));
};
};