UNPKG

@gamepark/rules-api

Version:

API to implement the rules of a board game

24 lines 907 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isCustomMoveType = exports.isCustomMove = void 0; var MoveKind_1 = require("./MoveKind"); /** * Type guard for {@link CustomMove} * @param {MaterialMove} move The move to test * @returns true if the move is a {@link CustomMove} */ var isCustomMove = function (move) { return move.kind === MoveKind_1.MoveKind.CustomMove; }; exports.isCustomMove = isCustomMove; /** * Function that returns a type guard for a {@link CustomMove} of a specific type * @param type The type of custom move to test * @returns A type guard function * * @example * `if (isCustomMoveType(CustomMoveType.Pass)(move)) ...` */ function isCustomMoveType(type) { return function (move) { return (0, exports.isCustomMove)(move) && move.type === type; }; } exports.isCustomMoveType = isCustomMoveType; //# sourceMappingURL=CustomMove.js.map