dsp-collection
Version:
A collection of JavaScript modules for digital signal processing (written in TypeScript)
21 lines • 459 B
JavaScript
export function assert(cond) {
if (!cond) {
throw new Error("Assertion failed.");
}
}
export function createMapBackedFunction(f) {
const map = new Map();
return function (x) {
let y = map.get(x);
if (y !== undefined) {
return y;
}
y = f(x);
if (y === undefined) {
return y;
}
map.set(x, y);
return y;
};
}
//# sourceMappingURL=MiscUtils.js.map