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

righto

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

righto - npm Package Compare versions

Comparing version 2.2.4 to 2.3.0

6

index.js

@@ -499,2 +499,8 @@ var abbott = require('abbott');

righto.fail = function(error){
return righto(function(error, done){
done(error);
}, error);
};
righto.isRighto = isRighto;

@@ -501,0 +507,0 @@ righto.isThenable = isThenable;

2

package.json
{
"name": "righto",
"version": "2.2.4",
"version": "2.3.0",
"main": "index.js",

@@ -5,0 +5,0 @@ "directories": {

@@ -480,2 +480,18 @@ # Righto

## Fail
A shorthand way to provide a failed result.
This is handy for rejecting in .get methods.
```
var something = someRighto.get(function(value){
if(!value){
return righto.fail('was falsey');
}
return value;
});
```
## Proxy support

@@ -482,0 +498,0 @@

@@ -1313,2 +1313,28 @@ var test = require('tape'),

t.notOk(righto.isResolvable(null), 'null is not a resolvable');
});
test('righto.fail', function(t){
t.plan(1);
var falure = righto.fail('reasons');
falure(function(error){
t.equal(error, 'reasons');
});
});
test('righto.fail resolvable', function(t){
t.plan(1);
var eventualFailData = righto(function(done){
setTimeout(function(){
done(null, 'reasons'); // Return the error in the result, not the rejection.
}, 100);
});
var falure = righto.fail(eventualFailData);
falure(function(error){
t.equal(error, 'reasons');
});
});
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