project-booster-vue 9.29.1 → 9.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "project-booster-vue",
3
- "version": "9.29.1",
3
+ "version": "9.30.0",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vue-cli-service serve",
@@ -1,4 +1,5 @@
1
1
  import { ScenarioStepAnswer } from '@/types/pb/Scenario';
2
+ import objectPath from 'object-path';
2
3
 
3
4
  const Condition = (
4
5
  condition: string,
@@ -17,6 +18,10 @@ const Condition = (
17
18
  }) > -1
18
19
  );
19
20
  };
21
+ const isAnswerValue = (questionCode: string, path: string, value: any) => {
22
+ const questionAnswers = answers.get(questionCode)!;
23
+ return questionAnswers ? objectPath.get(questionAnswers[0], path) === value : false;
24
+ };
20
25
  const hasAnswers = (questionCode: string) => {
21
26
  const questionAnswers = answers.get(questionCode)!;
22
27
  return questionAnswers.length > 0;
@@ -24,11 +29,12 @@ const Condition = (
24
29
  const isValid: boolean = new Function(
25
30
  'isAnswerMatching',
26
31
  'isAnswerContaining',
32
+ 'isAnswerValue',
27
33
  'hasAnswers',
28
34
  'answers',
29
35
  'runtimeOptions',
30
36
  `return ${condition}`,
31
- ).call(this, isAnswerMatching, isAnswerContaining, hasAnswers, answers, runtimeOptions);
37
+ ).call(this, isAnswerMatching, isAnswerContaining, isAnswerValue, hasAnswers, answers, runtimeOptions);
32
38
  return { isValid };
33
39
  };
34
40