UNPKG

fentastic

Version:

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

18 lines (17 loc) 636 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ParseErrors = exports.ParseError = void 0; class ParseError { constructor(prefix, found, index, pattern, description = 'one of', subject = 'value') { const expected = typeof pattern === 'string' ? `, expected ${description} "${pattern}"` : ''; this.message = `${prefix}: Unexpected ${subject}, found "${found}"${expected}, at index ${index}`; this.index = index; } } exports.ParseError = ParseError; class ParseErrors { constructor(errors) { this.errors = errors; } } exports.ParseErrors = ParseErrors;