javascript - 编写导出函数的更好方法是什么?
问题描述
问题是veracode安全扫描它在代码中创建缺陷所以在编译后它被转换为JS并且因为“使用严格”检查它不喜欢导出为全局变量我相信有没有办法更好地编写这个函数避免安全扫描问题?
main.ts
import * as Store from "../common/store";
export function authenticate(req: Request, res: Response) {
const app = Store.getInstance('sp');
app.Profile.authenticate(req.body, function(result) {
res.send(result);
});
}
main.js 编译后
function authenticate(req, res) {
const app = Store.getInstance('sp');
app.Profile.authenticate(req.body, function (result) {
res.send(result);
});
}
exports.authenticate = authenticate;
解决方案
推荐阅读
- java - 列表
RecyclerView 适配器中的数据设置 - javascript - 在 JS 中使用 fullcalendar 在鼠标悬停/输入事件时添加带有事件详细信息的弹出窗口
- java - WebElement 在运行时变为空
- wordpress - 如何在嵌入式报告中从 Google Data Studio 中删除页脚/水印?
- c - 我可以更改 pthread_create 以映射不在堆栈中的新线程吗?
- php - 使用 WordPress "wp_insert_post" 将查询中的请求变量添加到旋转钩
- c# - 如何将调整大小的图像保存到 ASP.NET Core 应用程序中的 Azure Blob 存储?
- json - AWS Glue Crawler 将 JSON 数组键注册为结构
- swift - 从更改的 GraphQL 文件生成 Swift 代码而不将更改推送到云端
- r - 通过单击 ggplot/plotly 散点图播放音频