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

response-objects

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

response-objects - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

5

dist/index.d.ts

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

declare const _MARKER: unique symbol;
export { _MARKER as MARKER, _setBodyCreator as setBodyCreator };
declare function R_(code: number, body?: any, headers?: any): ResponseObject;

@@ -15,2 +17,3 @@ export default R_;

toString(): string;
[_MARKER]: boolean;
}

@@ -21,4 +24,2 @@ export interface ErrorResponseObject extends ResponseObject, Error {

declare const _setBodyCreator: (fn: BodyCreator) => void;
declare const _MARKER: symbol;
export { _MARKER as MARKER, _setBodyCreator as setBodyCreator };
export declare type RConstructor = (body?: any, headers?: object) => ResponseObject;

@@ -25,0 +26,0 @@ export declare type RErrorConstructor = (body?: any, headers?: object) => ErrorResponseObject;

4

dist/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const status = require("statuses");
const _MARKER = Symbol.for("@@response-objects/MARKER");
exports.MARKER = _MARKER;
function R_(code, body, headers) {

@@ -14,4 +16,2 @@ return (code >= 400 ?

exports.setBodyCreator = _setBodyCreator;
const _MARKER = Symbol.for("@@response-objects/MARKER");
exports.MARKER = _MARKER;
const proto = { toJSON, toString, body: undefined, status: 0, statusCode: 0, headers: {}, [_MARKER]: true };

@@ -18,0 +18,0 @@ function createResponse(code) {

{
"name": "response-objects",
"version": "1.3.0",
"version": "1.3.1",
"description": "simple value objects representing HTTP responses",

@@ -25,4 +25,5 @@ "main": "dist/index.js",

"expect": "^1.20.2",
"mocha": "^3.1.0"
"mocha": "^3.1.0",
"typescript": "^2.8.3"
}
}
import status = require("statuses");
const _MARKER = Symbol.for("@@response-objects/MARKER");
export { _MARKER as MARKER, _setBodyCreator as setBodyCreator }
function R_ (code: number, body?: any, headers?: any): ResponseObject {

@@ -21,2 +24,3 @@ return (code >= 400 ?

}
export interface ResponseObject extends BaseResponseObject {

@@ -26,2 +30,3 @@ statusCode: number,

toString(): string;
[_MARKER]: boolean;
}

@@ -34,6 +39,2 @@ export interface ErrorResponseObject extends ResponseObject, Error {}

const _MARKER = Symbol.for("@@response-objects/MARKER");
export { _MARKER as MARKER, _setBodyCreator as setBodyCreator }
const proto: ResponseObject = { toJSON, toString, body: undefined, status: 0, statusCode: 0, headers: {}, [_MARKER]: true };

@@ -231,7 +232,7 @@ function createResponse (code: number): RConstructor {

}
function toJSON (this: ResponseObject) {
function toJSON (this: ResponseObject): BaseResponseObject {
return { body: this.body, status: this.status, headers: this.headers };
}
function toString (this: ResponseObject) {
function toString (this: ResponseObject): string {
return `Responses.${getName(this.status)} ${JSON.stringify(this)}`;

@@ -238,0 +239,0 @@ }

Sorry, the diff of this file is not supported yet

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