trampoline-ts
Version:
A type-safe way to emulate tail-call optimization with trampolines
12 lines • 391 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.THUNK_SYMBOL = Symbol('thunk');
exports.isThunk = (value) => {
return typeof value === 'function' && value.__THUNK__ === exports.THUNK_SYMBOL;
};
exports.toThunk = (fn) => {
const thunk = () => fn();
thunk.__THUNK__ = exports.THUNK_SYMBOL;
return thunk;
};
//# sourceMappingURL=thunk.js.map