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

better-curry

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

better-curry - npm Package Compare versions

Comparing version 1.4.0 to 1.5.0

2

bower.json
{
"name": "better-curry",
"main": "index.js",
"version": "1.4.0",
"version": "1.5.0",
"authors": [

@@ -6,0 +6,0 @@ "Paulo Cesar <email@pocesar.e4ward.com>"

@@ -348,2 +348,33 @@ (function (root, factory){

/**
* Delegate all functions, setters, getters and methods, from the original proto
*
* @param {Array} skip
*
* @returns {Delegate}
*/
Delegate.prototype.all = function(skip){
var base = this.proto[this.target], k;
if (skip && skip.length) {
for (k in base) {
if (skip.indexOf(k) === -1) {
if (typeof base[k] === 'function') {
this.method(k);
} else {
this.access(k);
}
}
}
} else {
for (k in base) {
if (typeof base[k] === 'function') {
this.method(k);
} else {
this.access(k);
}
}
}
};
/**
* Setup a setter

@@ -350,0 +381,0 @@ *

{
"name": "better-curry",
"version": "1.4.0",
"version": "1.5.0",
"description": "Forget Function.bind and func.apply(context, arguments), performance matters! For a better curry!",

@@ -31,5 +31,6 @@ "main": "index.js",

"browsers": [
"ie/6..latest",
"chrome/22..latest",
"firefox/16..latest",
"ie/8..latest",
"chrome/latest",
"firefox/3.5",
"firefox/latest",
"safari/latest",

@@ -36,0 +37,0 @@ "opera/11.0..latest",

@@ -402,2 +402,47 @@ /*jshint evil:true */

});
it('should delegate all setters, getters, methods automatically', function(){
function getObj(){
var obj = {};
obj.request = {
tumble: function(){
return 'tumble';
},
tremble: function(){
return this.generate;
},
set generate(val) {
var g = val;
return g;
},
get generate() {
return true;
},
value: 1,
ok: {
isTrue: true,
sub: function(){
}
}
};
return obj;
}
var obj = getObj();
var delegated = BetterCurry.delegate(obj, 'request');
delegated.all();
expect(obj.tumble()).to.be('tumble');
expect(obj.tremble()).to.be(true);
expect(obj.generate).to.be(true);
expect(obj.value).to.be(1);
expect(obj.ok).to.eql(obj.request.ok);
obj = getObj();
delegated = BetterCurry.delegate(obj, 'request');
delegated.all(['tumble']);
expect(obj.tumble).to.be.an('undefined');
expect(obj.tremble()).to.be(true);
});
});

@@ -411,6 +456,6 @@ });

}
expect(stuff(1,2,3, [1,2,3])).to.eql([1,2,[3],'a',1,2,3,[1,2,3]]);
});
});
});

Sorry, the diff of this file is not supported yet

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