Skip to content

Commit

Permalink
fix(core): 优化题库解析器
Browse files Browse the repository at this point in the history
  • Loading branch information
enncy committed Jun 11, 2022
1 parent 480cfa3 commit 67b50a4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/core/src/core/worker/answer.wrapper.handler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import get from 'lodash/get';
import { request } from '../utils';

/** 题目答案 */
Expand Down Expand Up @@ -192,9 +191,8 @@ export async function defaultAnswerWrapperHandler(
if (typeof str === 'string') {
const matches = str.match(/\${(.*?)}/g) || [];
matches.forEach((placeHolder) => {
const value: any =
/** 获取元素属性 */
get(env, placeHolder.replace(/\${(.*)}/, '$1'));
/** 获取占位符的值 */
const value: any = env[placeHolder.replace(/\${(.*)}/, '$1')];
str = str.replace(placeHolder, value);
});
}
Expand Down

0 comments on commit 67b50a4

Please sign in to comment.