Comparing version 1.0.0 to 1.0.1
@@ -41,5 +41,3 @@ | ||
var that = { | ||
super: function() { | ||
return inherited.apply(this.self, arguments); | ||
}, | ||
super: inherited.bind(this), | ||
self: this | ||
@@ -46,0 +44,0 @@ }; |
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://github.com/snowyu/util-ex.js", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": { | ||
@@ -11,3 +11,2 @@ "name": "Riceball LEE", | ||
}, | ||
"types": "./types", | ||
"files": [ | ||
@@ -50,3 +49,3 @@ "README.md", | ||
"build": "npm run build.ts && mkdir -p lib && cp -r src/* lib/", | ||
"build.ts": "tsc", | ||
"build.ts": "tsc --declaration --emitDeclarationOnly --outDir lib", | ||
"clean": "rm -fr web docs types lib", | ||
@@ -53,0 +52,0 @@ "clean.doc": "rm -fr web docs", |
@@ -41,5 +41,3 @@ | ||
var that = { | ||
super: function() { | ||
return inherited.apply(this.self, arguments); | ||
}, | ||
super: inherited.bind(this), | ||
self: this | ||
@@ -46,0 +44,0 @@ }; |
@@ -104,2 +104,29 @@ // Generated by CoffeeScript 2.7.0 | ||
}); | ||
it("should inject old method to an object", function () { | ||
var t | ||
function Test() { | ||
t = this | ||
this.initialize.apply(this, arguments); | ||
} | ||
var orgExec = sinon.spy(function () { | ||
should.exist(this); | ||
this.should.be.equal(t); | ||
}); | ||
Test.prototype.initialize = orgExec | ||
var newExec = sinon.spy(function () { | ||
should.exist(this.super); | ||
should.exist(this.self); | ||
should.exist(this.initialize); | ||
this.self.should.be.equal(t); | ||
this.super.call(null, 1, 2); | ||
this.initialize.call(this.self, 6, 6); | ||
}); | ||
injectMethod(Test.prototype, 'initialize', newExec).should.be.true; | ||
t = new Test(4,5) | ||
newExec.should.have.been.calledOnce; | ||
newExec.should.have.been.calledWith(4, 5); | ||
orgExec.should.have.been.calledTwice; | ||
orgExec.should.have.been.calledWith(1, 2); | ||
orgExec.should.have.been.calledWith(6, 6); | ||
}); | ||
}); |
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
181799
5104