UNPKG

@voiceflow/base-types

Version:

Voiceflow base project types

27 lines (26 loc) 1.82 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isPushOnMatchedCommand = exports.isJumpOnMatchedCommand = exports.isPushEventMatchedCommand = exports.isJumpEventMatchedCommand = exports.isWithOnMatching = exports.isWithEventMatching = exports.isWithPush = exports.isWithJump = exports.CommandType = void 0; const event_1 = require("./event"); // BUILT IN COMMANDS var CommandType; (function (CommandType) { CommandType["JUMP"] = "jump"; CommandType["PUSH"] = "push"; })(CommandType || (exports.CommandType = CommandType = {})); const isWithJump = (command) => command.type === CommandType.JUMP; exports.isWithJump = isWithJump; const isWithPush = (command) => command.type === CommandType.PUSH; exports.isWithPush = isWithPush; const isWithEventMatching = (command) => 'event' in command && (0, event_1.isBaseEvent)(command.event); exports.isWithEventMatching = isWithEventMatching; const isWithOnMatching = (command) => 'on' in command && typeof command.on === 'object' && command.on !== null; exports.isWithOnMatching = isWithOnMatching; const isJumpEventMatchedCommand = (command) => (0, exports.isWithJump)(command) && (0, exports.isWithEventMatching)(command); exports.isJumpEventMatchedCommand = isJumpEventMatchedCommand; const isPushEventMatchedCommand = (command) => (0, exports.isWithPush)(command) && (0, exports.isWithEventMatching)(command); exports.isPushEventMatchedCommand = isPushEventMatchedCommand; const isJumpOnMatchedCommand = (command) => (0, exports.isWithJump)(command) && (0, exports.isWithOnMatching)(command); exports.isJumpOnMatchedCommand = isJumpOnMatchedCommand; const isPushOnMatchedCommand = (command) => (0, exports.isWithPush)(command) && (0, exports.isWithOnMatching)(command); exports.isPushOnMatchedCommand = isPushOnMatchedCommand;