import S from './sanitised.js' import type Sid from './sanitised-identifier.js' /** @returns sanitised value as is, otherwise falls back to provided sanitation function. */ export const fallback = (x: T, f: (_: Exclude) => undefined | S): undefined | S => x instanceof S ? x : f(x as Exclude) export default fallback