UNPKG

@voiceflow/base-types

Version:

Voiceflow base project types

16 lines (15 loc) 1 kB
import { isBaseEvent } from './event.js'; // BUILT IN COMMANDS export var CommandType; (function (CommandType) { CommandType["JUMP"] = "jump"; CommandType["PUSH"] = "push"; })(CommandType || (CommandType = {})); export const isWithJump = (command) => command.type === CommandType.JUMP; export const isWithPush = (command) => command.type === CommandType.PUSH; export const isWithEventMatching = (command) => 'event' in command && isBaseEvent(command.event); export const isWithOnMatching = (command) => 'on' in command && typeof command.on === 'object' && command.on !== null; export const isJumpEventMatchedCommand = (command) => isWithJump(command) && isWithEventMatching(command); export const isPushEventMatchedCommand = (command) => isWithPush(command) && isWithEventMatching(command); export const isJumpOnMatchedCommand = (command) => isWithJump(command) && isWithOnMatching(command); export const isPushOnMatchedCommand = (command) => isWithPush(command) && isWithOnMatching(command);