Nodejs Function Bind bind(bind)

Here you can find the source of bind(bind)

Method Source Code

Function.prototype.bind = function (bind) {
    var self = this;
    return function () {
        var args = Array.prototype.slice.call(arguments);
        return self.apply(bind || null, args);
    };/*from w ww  .j a v a2 s .  c o  m*/
};

Related

  1. bind(scope)
    Function.prototype.bind = function(scope) {
      var _function = this;
      return function() {
        return _function.apply(scope, arguments);
    
  2. bindbind(self)
    Function.prototype.bind = function bind(self) {
      var callable = this;
      return function binding() { return callable.apply(self, arguments.toArray()); };
    
  3. bind(oThis)
    Function.prototype.bind = Function.prototype.bind || function (oThis) {
      if( typeof this !== "function" ) {
        throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
      var aArgs = Array.prototype.slice.call(arguments, 1),
        fToBind = this,
        fNOP = function () {},
        fBound = function () {
          return fToBind.apply(
    ...
    
  4. bind(scope)
    Function.prototype.bind = function(scope) {
        var func = this;
        return function() {
            return func.apply(scope, arguments);
        };
    };
    
  5. bind( obj )
    Function.prototype.bind = function( obj ) {
      var slice = [].slice,
        args = slice.call(arguments, 1), 
        self = this, 
        nop = function () {}, 
        bound = function () {
          return self.apply( this instanceof nop ? this : ( obj || {} ), 
                    args.concat( slice.call(arguments) ) );  
        };
    ...
    
  6. rebind(n)
    Function.prototype.rebind = function (n) {
        var me = this;
        return function () {
            var res = me.apply();
            var f = res && res[n];
            if(typeof f !== 'function') throw 'routed property was not a function.';
            f.apply(null, arguments);
        };
    };
    ...
    
  7. bind(scope)
    Function.prototype.bind = function(scope) {
      var _function = this;
      return function() {
        return _function.apply(scope, arguments);
    };
    
  8. pass(args, bind)
    Function.prototype.pass = function(args, bind){
      var self = this;
      if (args != null) args = Array.from(args);
      return function(){
        return self.apply(bind, args || arguments);
      };
    };
    Element.prototype.hasClass = function(className){
      return this.className.indexOf(className) != -1;
    ...
    
  9. createDelegate(obj, args, appendArgs)
    Function.prototype.createDelegate = function(obj, args, appendArgs){
        var method = this;
        return function() {
            var callArgs = args || arguments;
            if(appendArgs === true){
                callArgs = Array.prototype.slice.call(arguments, 0);
                callArgs = callArgs.concat(args);
            }else if(typeof appendArgs == 'number'){
                callArgs = Array.prototype.slice.call(arguments, 0); 
    ...