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 6.2.0 to 7.0.0

2

lib/index.d.ts

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

constructor(error: E | null | undefined, data: D);
unwrap(): D;
unwrap(): D | never;
unwrapAsync(): Promise<D | E>;

@@ -12,0 +12,0 @@ onError(func: ErrorProcessing<E, D>): D;

"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 });

@@ -39,8 +30,6 @@ exports.tryCatchWrapperAsync = exports.tryCatchWrapper = exports.ResultFail = exports.ResultOk = exports.ResultFAIL = exports.ResultOK = exports.Result = exports.ResultError = void 0;

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

@@ -72,3 +61,3 @@ isOk() {

unwrap() {
throw this.error;
throw super.error;
}

@@ -99,11 +88,9 @@ unwrapAsync() {

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

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

{
"name": "node-result",
"version": "6.2.0",
"version": "7.0.0",
"description": "result",

@@ -22,7 +22,8 @@ "keywords": [

"fmt": "npx prettier --write \"src/**/*.ts\"",
"lint": "eslint --ext=ts src",
"lint": "npx eslint --ext=ts src",
"test": "npx jest",
"build": "npx tsc",
"_postinstall": "husky install",
"prepublishOnly": "pinst --disable",
"prepare": "npm run lint && npm run build",
"prepare": "npm run lint && npm run build && npm run test",
"postpublish": "pinst --enable"

@@ -34,2 +35,3 @@ },

"devDependencies": {
"@types/jest": "^26.0.20",
"@typescript-eslint/eslint-plugin": "^4.12.0",

@@ -39,6 +41,12 @@ "@typescript-eslint/parser": "^4.12.0",

"husky": "^5.0.6",
"jest": "^26.6.3",
"pinst": "^2.1.1",
"prettier": "^2.2.1",
"ts-jest": "^26.4.4",
"typescript": "^4.1.3"
},
"jest": {
"preset": "ts-jest",
"testEnvironment": "node"
}
}
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