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

zoom

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zoom

Like hapijs boom but for non-error return data

  • 0.0.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
69
increased by97.14%
Maintainers
0
Weekly downloads
 
Created
Source
THIS PACKAGE IS DEPRECATED

Please see the latest official package @zoom/rivet, thank you!


Zoom

Provides a consitent interface that mirrors Boom

// Here's the code in full
'use strict';

function Zoom(data, statusCode) {
  this.data = data;
  this.statusCode = statusCode || 200;
}
Zoom.create = function(data) {
  return new Zoom(data);
}

module.exports = Zoom;

Usage


function handler(request, reply) {
  doAsync(function(err, result) {

    if (err) {
      return reply(Boom.badImplementation(err, 'Something went wrong'));
    }
    return Zoom.create(result);
  })
}

// This would yield
{
  "statusCode": 200,
  "data": {
    "foo": true,
    "bar": 42
  }
}

// If an error occured, the (Boom) response would look like
{
  "statusCode": 400,
  "error": "whatever",
  "message": "Something went wrong",
}

FAQs

Package last updated on 25 Nov 2024

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