UNPKG

fentastic

Version:

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

13 lines (12 loc) 454 B
export 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; } } export class ParseErrors { constructor(errors) { this.errors = errors; } }