UNPKG

pip-services4-expressions-node

Version:

Tokenizers, parsers and expression calculators in Node.js / ES2017

29 lines (24 loc) 801 B
/** @module tokenizers */ /** * Validates characters that are processed by Tokenizers. */ export class CharValidator { public static readonly Eof: number = 0xffff; public static readonly Zero: number = '0'.charCodeAt(0); public static readonly Nine: number = '9'.charCodeAt(0); /** * Default contructor to prevent creation of a class instance. */ private constructor() { // } public static isEof(value: number): boolean { return value == CharValidator.Eof || value == -1; } public static isEol(value: number): boolean { return value == 10 || value == 13; } public static isDigit(value: number): boolean { return value >= CharValidator.Zero && value <= CharValidator.Nine; } }