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

zoom

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zoom - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

index.js

@@ -0,1 +1,3 @@

'use strict';
function Zoom(data, statusCode) {

@@ -2,0 +4,0 @@ this.data = data;

2

package.json
{
"name": "zoom",
"version": "0.0.1",
"version": "0.0.2",
"description": "Like hapijs boom but for non-error return data",

@@ -5,0 +5,0 @@ "main": "index.js",

# Zoom
Provides a consitent interface that mirrors Boom
```js
// 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
```js
function handler(request, reply) {

@@ -9,3 +26,3 @@ doAsync(function(err, result) {

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

@@ -16,2 +33,17 @@ 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",
}
```
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