Skip to content

Commit

Permalink
Readme updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ciak committed Feb 20, 2019
1 parent 17c108c commit 7d3de3e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export declare class JResponse {
static errors(res: any, errors?: any, status?: number): any;
static build(success: boolean, data?: any, errors?: any): any;
send(success: boolean, data?: any, error?: any): any;
sendSuccess(data?: any): any;
sendSuccess(data?: any, status?: number): any;
sendErrors(errors?: any, status?: number): any;
appendError(error?: any, status?: number): void;
appendData(data?: any, status?: number): void;
Expand Down
4 changes: 3 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ var JResponse = /** @class */ (function () {
}
return this.res.status(this.status).json(this.response);
};
JResponse.prototype.sendSuccess = function (data) {
JResponse.prototype.sendSuccess = function (data, status) {
if (data === void 0) { data = null; }
if (status === void 0) { status = 200; }
this.status = status;
if (data !== null) {
Array.isArray(data) ? this.response.data = this.response.data.concat(data) : this.response.data.push(data);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ export class JResponse {
return this.res.status(this.status).json(this.response);
}

sendSuccess(data: any = null) {
sendSuccess(data: any = null, status = 200) {
this.status = status;
if (data !== null) {
Array.isArray(data) ? this.response.data = this.response.data.concat(data) : this.response.data.push(data);
}
Expand Down

0 comments on commit 7d3de3e

Please sign in to comment.