New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mini-tools

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mini-tools

mini tools for express and others

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
38
decreased by-70.77%
Maintainers
1
Weekly downloads
 
Created
Source

mini-tools

mini tools for express and others

extending npm-version downloads linux windows coverage climate dependencies

language: English also available in: Spanish

Install

$ npm install mini-tools

Main goal

Have some mini tools for express and others

API

serveErr(req, res [, next])

Returns a function that sends a error message to de front-end.

app.post('/insert' , function(req,res){
  //...
  if(duplicate){
    serveErr(req,res)(new Error("Duplicate name. Can't insert"));
    return; 
  }
  //...

It is promise friendly

app.use('/tools', function(req,res,next){
  //...
  .then(function(){
    if(not_in_this_middleware){
      throw new Error("next");
    }
    // ...
  }).catch(serveErr(req,res,next)); 

catch expects a function that receive an error. serveErr returns that function.

When err is Error("next") serveErr calls next and does not send any result to de front-end; otherwise it sends a 400 error with the message and stack.

License

MIT

.............................

FAQs

Package last updated on 22 Aug 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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