UNPKG

@thi.ng/shader-ast

Version:

DSL to define shader code in TypeScript and cross-compile to GLSL, JS and other targets

14 lines (13 loc) 306 B
import { DEFAULT, defmulti } from "@thi.ng/defmulti/defmulti"; import { unsupported } from "@thi.ng/errors/unsupported"; const defTarget = (impls) => defmulti( (x) => x.tag, {}, { [DEFAULT]: (t) => unsupported(`no impl for AST node type: '${t.tag}'`), ...impls } ); export { defTarget };