Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "alien-bind", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "An implementation of bind that does not use Function.prototype.bind.", | ||
@@ -5,0 +5,0 @@ "main": "alien-bind.js", |
@@ -8,3 +8,3 @@ /* global describe, it, expect, beforeEach, afterEach */ | ||
beforeEach(function () { | ||
sinon.spy(Function.prototype, 'bind') | ||
createOrStub(Function.prototype, 'bind') | ||
bind = require('./alien-bind') | ||
@@ -30,3 +30,3 @@ }) | ||
expect(internals.this).to.be(context) | ||
expect(internals.context).to.be(context) | ||
expect(internals.args.length).to.be(0) | ||
@@ -41,3 +41,3 @@ }) | ||
expect(internals.this).to.be(context) | ||
expect(internals.context).to.be(context) | ||
expect(internals.args.length).to.be(1) | ||
@@ -54,3 +54,3 @@ expect(internals.args[0]).to.be(arg0) | ||
expect(internals.this).to.be(context) | ||
expect(internals.context).to.be(context) | ||
expect(internals.args.length).to.be(2) | ||
@@ -69,3 +69,3 @@ expect(internals.args[0]).to.be(arg0) | ||
expect(internals.this).to.be(context) | ||
expect(internals.context).to.be(context) | ||
expect(internals.args.length).to.be(3) | ||
@@ -78,5 +78,16 @@ expect(internals.args[0]).to.be(arg0) | ||
function createOrStub (parent, methodName) { | ||
if (parent[methodName] !== undefined) { | ||
return sinon.stub(parent, methodName) | ||
} | ||
parent[methodName] = sinon.stub() | ||
parent[methodName].restore = function () { | ||
delete parent[methodName] | ||
} | ||
return parent[methodName] | ||
} | ||
function introspection () { | ||
return { | ||
this: this, | ||
context: this, | ||
args: arguments | ||
@@ -83,0 +94,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5199
111