import type { NumOrString , Predicate } from "@thi.ng/api" ; import type { LitParser } from "../api.js" ; import { satisfy , satisfyD } from "./satisfy.js" ; param min param max export const rangeP = < T extends NumOrString > ( min , max ) : Predicate < T > => ( x ) => x >= min && x <= max ; param min param max export const utf16RangeP = ( min , max ) : Predicate < string > => ( x ) => { const c = x . charCodeAt ( 0 ) ! ; return c >= min && c <= max ; } ; export function range ( min , max , id ? ) ; export function range ( min , max , id ? ) ; export function range ( min , max , id = "lit" ) { return satisfy ( rangeP ( min , max ) , id ) ; } export function rangeD ( min , max ) ; export function rangeD ( min , max ) ; export function rangeD ( min , max ) { return satisfyD ( rangeP ( min , max ) ) ; } param min param max param id export const utf16Range = ( min , max , id = "utfLit" ) => satisfy ( utf16RangeP ( min , max ) , id ) ; param min param max param id export const utf16RangeD = ( min , max ) => satisfyD ( utf16RangeP ( min , max ) ) ;