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

node-result

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-result - npm Package Compare versions

Comparing version 5.5.0 to 5.6.0

4

lib/index.d.ts

@@ -23,3 +23,3 @@ export { ResultError } from 'node-result-error';

export declare const ResultFail: <Error_1>(error: Error_1) => ResultFAIL<Error_1>;
export declare function tryCatchWrapper(target: object, property: string, descriptor: TypedPropertyDescriptor<(...args: any[]) => any>): TypedPropertyDescriptor<(...args: any[]) => any>;
export declare function tryCatchWrapperAsync(target: object, property: string, descriptor: TypedPropertyDescriptor<(...args: any[]) => Promise<any>>): TypedPropertyDescriptor<(...args: any[]) => Promise<any>>;
export declare function tryCatchWrapper(target: Record<any, any>, property: string, descriptor: TypedPropertyDescriptor<(...args: any[]) => any>): TypedPropertyDescriptor<(...args: any[]) => ResultOK<any> | ResultFAIL<Error>>;
export declare function tryCatchWrapperAsync(target: Record<any, any>, property: string, descriptor: TypedPropertyDescriptor<(...args: any[]) => Promise<any>>): TypedPropertyDescriptor<(...args: any[]) => Promise<ResultOK<any> | ResultFAIL<Error>>>;
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.tryCatchWrapperAsync = exports.tryCatchWrapper = exports.ResultFail = exports.ResultOk = exports.ResultFAIL = exports.ResultOK = exports.Result = void 0;
exports.tryCatchWrapperAsync = exports.tryCatchWrapper = exports.ResultFail = exports.ResultOk = exports.ResultFAIL = exports.ResultOK = exports.Result = exports.ResultError = void 0;
var node_result_error_1 = require("node-result-error");

@@ -38,9 +29,7 @@ Object.defineProperty(exports, "ResultError", { enumerable: true, get: function () { return node_result_error_1.ResultError; } });

}
onErrorAsync(func) {
return __awaiter(this, void 0, void 0, function* () {
if (this.error !== null) {
return func(this.error);
}
return Promise.resolve(this.data);
});
async onErrorAsync(func) {
if (this.error !== null) {
return func(this.error);
}
return Promise.resolve(this.data);
}

@@ -67,4 +56,6 @@ isOk() {

exports.ResultFAIL = ResultFAIL;
exports.ResultOk = (data) => new ResultOK(data);
exports.ResultFail = (error) => new ResultFAIL(error);
const ResultOk = (data) => new ResultOK(data);
exports.ResultOk = ResultOk;
const ResultFail = (error) => new ResultFAIL(error);
exports.ResultFail = ResultFail;
function tryCatchWrapper(target, property, descriptor) {

@@ -74,3 +65,3 @@ const self = descriptor.value;

try {
return self.call(this, ...args);
return self?.call(this, ...args);
}

@@ -86,11 +77,9 @@ catch (error) {

const self = descriptor.value;
descriptor.value = function (...args) {
return __awaiter(this, void 0, void 0, function* () {
try {
return yield self.call(this, ...args);
}
catch (error) {
return exports.ResultFail(error);
}
});
descriptor.value = async function (...args) {
try {
return await self?.call(this, ...args);
}
catch (error) {
return exports.ResultFail(error);
}
};

@@ -97,0 +86,0 @@ return descriptor;

{
"name": "node-result",
"version": "5.5.0",
"version": "5.6.0",
"description": "result",

@@ -17,9 +17,6 @@ "keywords": [

"scripts": {
"formatter": "npx prettier --write \"src/**/*.ts\"",
"linter": "npx tslint -p tsconfig.json \"src/**/*.ts\"",
"preversion": "npm run build",
"version": "npm run build",
"prepublishOnly": "npm run build",
"prepare": "npm run build",
"build": "npm run formatter && npm run linter && npx tsc"
"fmt": "npx prettier --write \"src/**/*.ts\"",
"lint": "eslint --ext=ts src",
"prepare": "npm run lint && npm run build",
"build": "npx tsc"
},

@@ -33,6 +30,9 @@ "files": [

"devDependencies": {
"tslint": "^6.1.2",
"tslint-config-prettier": "^1.18.0",
"typescript": "^3.9.5"
"@typescript-eslint/eslint-plugin": "^4.12.0",
"@typescript-eslint/parser": "^4.12.0",
"eslint": "^7.17.0",
"husky": "^5.0.6",
"prettier": "^2.2.1",
"typescript": "^4.1.3"
}
}
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