UNPKG

kitten-cloud-function

Version:

用于编程猫源码云功能(云变量、云列表等)的客户端工具

51 lines (50 loc) 1.55 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.KittenCloudDataUpdateCommandGroup = void 0; const revocable_command_group_1 = require("../../../../utils/command/revocable-command-group"); const other_1 = require("../../../../utils/other"); class KittenCloudDataUpdateCommandGroup extends revocable_command_group_1.RevocableCommandGroup { removeFrontIneffective() { let count = 0; let firstCommand; while ((firstCommand = this.first()) != other_1.None) { if (firstCommand.isEffective()) { break; } else { firstCommand.finish(); this.shift(); count++; } } return count; } removeBackIneffective() { let count = 0; let lastCommand; while ((lastCommand = this.last()) != other_1.None) { if (lastCommand.isEffective()) { break; } else { lastCommand.finish(); this.pop(); count++; } } return count; } toCloudJSON() { const result = []; for (const command of this.commandArray) { if (command.isLegal()) { result.push(command.toCloudJSON()); } } return result; } toCloudString() { return JSON.stringify(this.toCloudJSON()); } } exports.KittenCloudDataUpdateCommandGroup = KittenCloudDataUpdateCommandGroup;