Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

util-ex

Package Overview
Dependencies
Maintainers
1
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

util-ex - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

lib/_create-function.d.ts

4

lib/injectMethod.js

@@ -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);
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc