Socket
Socket
Sign inDemoInstall

oath

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.0 to 0.2.1

10

dist/oath.js

@@ -28,3 +28,3 @@ /*!

*/
exports.version = '0.2.0';
exports.version = '0.2.1';

@@ -89,2 +89,9 @@ /**

}
, node: function (callback) {
this.then(
function (d) { callback(null, d); }
, function (e) { callback(e); }
);
return this;
}
};

@@ -251,3 +258,4 @@ }

return exports;
});

2

dist/oath.min.js

@@ -7,2 +7,2 @@ /*!

!function(a,b){typeof module!="undefined"?module.exports=b():typeof define=="function"&&typeof define.amd=="object"?define(b):this[a]=b()}("oath",function(){function c(a){a=a||{},this._pending={},this._oath={complete:!1,context:a.context||this};var b=this;this.promise={then:function(a,c){return a&&b._register("resolve",a),c&&b._register("reject",c),b._oath.complete&&b._traverse(),this},onprogress:function(a){return b._register("progress",a),this}}}if(!a)var a={};var b=a.exports=c;return b.version="0.2.0",c.prototype.resolve=function(a){this._fulfill("resolve",a)},c.prototype.reject=function(a){this._fulfill("reject",a)},c.prototype.progress=function(a){var b=this._pending.progress;if(!b)return!1;for(var c=0;c<b.length;c++)b[c](a)},c.prototype._register=function(a,b){var c=this._oath.context,d=this._pending[a],e;if(b.length<2)e=function(a){return b.call(c,a)};else if(b.length==2)e=function(a,d){b.call(c,a,d)};else throw new Error("Oath: Invalid function registered - to many parameters.");d?d.push(e):this._pending[a]=[e]},c.prototype._fulfill=function(a,b){if(this._oath.complete)return!1;this._oath.complete={type:a,result:b},this._traverse()},c.prototype._traverse=function(){var a=this,b=this._oath.context,c=this._oath.complete.type;if(!this._pending[c])return!1;var d=function(){var b=a._pending[c].shift(),e=a._oath.complete.result;if(b.length<2){var f=b(e);f&&(a._oath.complete.result=f),a._pending[c].length&&d()}else{var g=function(b){b&&(a._oath.complete.result=b),a._pending[c].length&&d()};b(e,g)}};d()},b})
!function(a,b){typeof module!="undefined"?module.exports=b():typeof define=="function"&&typeof define.amd=="object"?define(b):this[a]=b()}("oath",function(){function c(a){a=a||{},this._pending={},this._oath={complete:!1,context:a.context||this};var b=this;this.promise={then:function(a,c){return a&&b._register("resolve",a),c&&b._register("reject",c),b._oath.complete&&b._traverse(),this},onprogress:function(a){return b._register("progress",a),this},node:function(a){return this.then(function(b){a(null,b)},function(b){a(b)}),this}}}if(!a)var a={};var b=a.exports=c;return b.version="0.2.1",c.prototype.resolve=function(a){this._fulfill("resolve",a)},c.prototype.reject=function(a){this._fulfill("reject",a)},c.prototype.progress=function(a){var b=this._pending.progress;if(!b)return!1;for(var c=0;c<b.length;c++)b[c](a)},c.prototype._register=function(a,b){var c=this._oath.context,d=this._pending[a],e;if(b.length<2)e=function(a){return b.call(c,a)};else if(b.length==2)e=function(a,d){b.call(c,a,d)};else throw new Error("Oath: Invalid function registered - to many parameters.");d?d.push(e):this._pending[a]=[e]},c.prototype._fulfill=function(a,b){if(this._oath.complete)return!1;this._oath.complete={type:a,result:b},this._traverse()},c.prototype._traverse=function(){var a=this,b=this._oath.context,c=this._oath.complete.type;if(!this._pending[c])return!1;var d=function(){var b=a._pending[c].shift(),e=a._oath.complete.result;if(b.length<2){var f=b(e);f&&(a._oath.complete.result=f),a._pending[c].length&&d()}else{var g=function(b){b&&(a._oath.complete.result=b),a._pending[c].length&&d()};b(e,g)}};d()},b})
0.2.1 / 2012-01-23
==================
* tests for node callback helper
* add node callback helper
* vim ignore(s)
0.2.0 / 2011-12-23

@@ -3,0 +10,0 @@ ==================

@@ -13,3 +13,3 @@ /*!

*/
exports.version = '0.2.0';
exports.version = '0.2.1';

@@ -74,2 +74,9 @@ /**

}
, node: function (callback) {
this.then(
function (d) { callback(null, d); }
, function (e) { callback(e); }
);
return this;
}
};

@@ -234,2 +241,2 @@ }

iterate();
};
};

@@ -5,3 +5,3 @@ {

"description": "Tiny library for node and the browser that makes it easy to build and interact with promise/future based APIs.",
"version": "0.2.0",
"version": "0.2.1",
"homepage": "http://alogicalparadox.com/oath",

@@ -8,0 +8,0 @@ "repository": {

@@ -98,2 +98,38 @@ if (!chai)

it('should accept the node callback converter - success', function (done) {
var success = Spy(function (err, data) {
expect(err).to.not.exist;
expect(data).to.eql({ doctor: 'who' });
done();
});
var promise = function (data) {
var o = new oath();
setTimeout(function() {
o.resolve(data);
}, 20);
return o.promise;
};
promise({ doctor: 'who' }).node(success);
});
it('should accept the node callback converter - failure', function (done) {
var failure = Spy(function (err, data) {
expect(err).to.be.instanceof(Error);
expect(data).to.not.exist;
done();
});
var promise = function (data) {
var o = new oath();
setTimeout(function() {
o.reject(new Error('Fake Error'));
}, 20);
return o.promise;
};
promise({ doctore: 'who' }).node(failure);
});
it('should not call the success stack on failure', function (done) {

@@ -221,2 +257,2 @@ var success = Spy(function (data) {

});
});
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc