import type { Predicate } from "@thi.ng/api" ; import { isPlainObject } from "@thi.ng/checks/is-plain-object" ; import { isSet } from "@thi.ng/checks/is-set" ; import type { CharSet , LitParser } from "../api.js" ; import { satisfy , satisfyD } from "./satisfy.js" ; param opts export const oneOfP = ( opts ) : Predicate < any > => isSet ( opts ) ? ( x ) => opts . has ( x ) : isPlainObject ( opts ) ? ( x ) => ( < any > opts ) [ x ] : ( x ) => opts . indexOf ( x ) >= 0 ; /**
 * Matches single char against given options. Also see  noneOf * for reverse logic.
 *
 *  param opts param id export function oneOf ( opts , id ? ) ; export function oneOf < T > ( opts , id ? ) ; export function oneOf ( opts , id = "oneOf" ) { return satisfy ( oneOfP ( opts ) , id ) ; } /**
 * Like  oneOf , but discards result.
 *
 *  param opts export function oneOfD ( opts ) ; export function oneOfD < T > ( opts ) ; export function oneOfD ( opts ) { return satisfyD ( oneOfP ( opts ) ) ; }