UNPKG

@thi.ng/parse

Version:

Purely functional parser combinators & AST generation for generic inputs

16 lines (15 loc) 471 B
import { isPlainObject } from "@thi.ng/checks/is-plain-object"; import { isSet } from "@thi.ng/checks/is-set"; import { satisfy, satisfyD } from "./satisfy.js"; const noneOfP = (opts) => isSet(opts) ? (x) => !opts.has(x) : isPlainObject(opts) ? (x) => !opts[x] : (x) => !opts.includes(x); function noneOf(opts, id = "noneOf") { return satisfy(noneOfP(opts), id); } function noneOfD(opts) { return satisfyD(noneOfP(opts)); } export { noneOf, noneOfD, noneOfP };