@davidcal/fec-raptorq
Version:
Node.js wrapper for RaptorQ forward error correction
14 lines (12 loc) • 436 B
JavaScript
import { callable } from "./callable.js";
/**
* @stability 4 - locked
*
* Binds the `this` value of a function lazily.
*
* Takes in a `lazy_this_value` function that returns the `this` value to be used.
*/
export const lazy_bind = (func, lazy_this_value) => {
// Note: Reflect is used to ensure the safe administration of native behaviour.
return callable(func, (...args) => Reflect.apply(func, lazy_this_value(), args));
};