This repository has been archived on 2026-03-06. You can view files and clone it, but cannot push or open issues or pull requests.
todo/client/node_modules/underscore/amd/bind.js
2025-06-13 14:04:40 +08:00

16 lines
544 B
JavaScript

define(['./isFunction', './_executeBound', './restArguments'], function (isFunction, _executeBound, restArguments) {
// Create a function bound to a given object (assigning `this`, and arguments,
// optionally).
var bind = restArguments(function(func, context, args) {
if (!isFunction(func)) throw new TypeError('Bind must be called on a function');
var bound = restArguments(function(callArgs) {
return _executeBound(func, bound, context, this, args.concat(callArgs));
});
return bound;
});
return bind;
});