UNPKG

fentastic

Version:

Validate and parse Forsyth-Edwards Notation (FEN) used to describe a chess game board position.

21 lines (20 loc) 610 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.validateInputFen = exports.InputError = void 0; class InputError { constructor(message, argument) { this.message = message; this.argument = argument; } } exports.InputError = InputError; const validateInputFen = (fen) => { if (typeof fen !== 'string') { throw new InputError('FEN input must be of type \'string\'', 1); } if (!fen.length) { throw new InputError('FEN input string must not be empty', 1); } return fen; }; exports.validateInputFen = validateInputFen;