Sha256: 96c44e53842bda51179857d66f715fdbeeaaeff7a985ce94dde5617ca5bab0ca

Contents?: true

Size: 750 Bytes

Versions: 8

Compression:

Stored size: 750 Bytes

Contents

if (!Function.prototype.bind) {
  Function.prototype.bind = function (oThis) {
    if (typeof this !== "function") {
      // closest thing possible to the ECMAScript 5
      // internal IsCallable 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(this instanceof fNOP && oThis
                 ? this
                 : oThis,
                 aArgs.concat(Array.prototype.slice.call(arguments)));
        };

    fNOP.prototype = this.prototype;
    fBound.prototype = new fNOP();

    return fBound;
  };
}

Version data entries

8 entries across 4 versions & 1 rubygems

Version Path
sprockets-traceur-0.0.4 spec/rails4/app/assets/javascripts/bind_polyfill.js
sprockets-traceur-0.0.4 spec/sinatra/js/bind_polyfill.js
sprockets-traceur-0.0.3 spec/rails4/app/assets/javascripts/bind_polyfill.js
sprockets-traceur-0.0.3 spec/sinatra/js/bind_polyfill.js
sprockets-traceur-0.0.2 spec/rails4/app/assets/javascripts/bind_polyfill.js
sprockets-traceur-0.0.2 spec/sinatra/js/bind_polyfill.js
sprockets-traceur-0.0.1 spec/rails4/app/assets/javascripts/bind_polyfill.js
sprockets-traceur-0.0.1 spec/sinatra/js/bind_polyfill.js