dope2/function_registry.js

15 lines
No EOL
354 B
JavaScript

import { DefaultMap } from "./util.js";
const mapping = new DefaultMap(() => new Map());
export const fnType = ({in: inType, out: outType}) => {
const m2 = mapping.getdefault(inType);
if (m2.has(outType)) {
return m2.get(outType);
}
else {
const fnType = {in: inType, out: outType};
m2.set(outType, fnType);
return fnType;
}
}