| 12345678910111213141516171819202122 |
- /** 语句:while 循环(解析在此,执行在 sequence-runner);仅 body,不用 ture */
- const { assertStrictKeys } = require('../action-schema.js')
- const types = ['while']
- function parse (action, parseContext) {
- const path = parseContext.actionPath || 'while'
- assertStrictKeys(action, ['type', 'condition', 'body'], path)
- if (!Array.isArray(action.body)) {
- throw new Error(`${path}: while 须包含数组 body`)
- }
- return {
- type: 'while',
- condition: action.condition,
- body: parseContext.parseActions(action.body, 'body'),
- }
- }
- async function execute() {
- return { success: true }
- }
- module.exports = { types, parse, execute }
|