UNPKG

@kayahr/text-encoding

Version:
34 lines (33 loc) 1.28 kB
/** * Checks if given value is an ASCII character. An ASCII character is a numeric value in the range * 0x00 to 0x7F, inclusive. * * @param value - The value to test. * @returns True if value is an ASCII character, false if not. */ export declare function isASCII(value: number): boolean; /** * Converts a UTF16 code unit to bytes. * * @param codeUnit - The code unit to convert * @param bigEndian - True if big endian, false if little endian. * @returns The converted bytes. */ export declare function convertCodeUnitToBytes(codeUnit: number, bigEndian: boolean): [number, number]; /** * Checks if given value is within the given range. * * @param value - The value to test. * @param min - The minimum value in the range, inclusive. * @param max - The maximum value in the range, inclusive. * @returns True if value >= min and value <= max. */ export declare function inRange(value: number, min: number, max: number): boolean; /** * Returns the index of the given value within the given array. Returns null if value was not found. * * @param array - The array to search in. * @param value - The value to search for. * @returns The found index or null if value was not found. */ export declare function indexOf<T>(array: T[], value: T): number | null;