node-result
Advanced tools
Comparing version 11.0.0 to 12.0.0
@@ -1,8 +0,5 @@ | ||
export { ResultError, resultError } from 'node-result-error'; | ||
export declare namespace types { | ||
type Result<DataType, ErrorType> = ResultOK<DataType> | ResultFAIL<ErrorType>; | ||
type ResultAsync<DataType, ErrorType> = Promise<Result<DataType, ErrorType>>; | ||
} | ||
export declare type ErrorProcessing<DataType, ErrorType> = (error: ErrorType) => DataType; | ||
export declare type ErrorProcessingAsync<DataType, ErrorType> = (error: ErrorType) => Promise<DataType>; | ||
export declare type TResult<DataType, ErrorType> = ResultOK<DataType> | ResultFAIL<ErrorType>; | ||
export declare type TResultAsync<DataType, ErrorType> = Promise<TResult<DataType, ErrorType>>; | ||
export declare type TErrorProcessing<DataType, ErrorType> = (error: ErrorType) => DataType; | ||
export declare type TErrorProcessingAsync<DataType, ErrorType> = (error: ErrorType) => Promise<DataType>; | ||
export declare class Result<DataType, ErrorType> { | ||
@@ -19,4 +16,4 @@ protected readonly data: DataType; | ||
isFail(): boolean; | ||
onError(func: ErrorProcessing<DataType, never>): DataType; | ||
onErrorAsync(func: ErrorProcessingAsync<DataType, never>): Promise<DataType>; | ||
onError(func: TErrorProcessing<DataType, never>): DataType; | ||
onErrorAsync(func: TErrorProcessingAsync<DataType, never>): Promise<DataType>; | ||
} | ||
@@ -29,8 +26,8 @@ export declare class ResultFAIL<ErrorType> extends Result<undefined, ErrorType> { | ||
isFail(): boolean; | ||
onError<DataType>(func: ErrorProcessing<never, ErrorType>): DataType; | ||
onErrorAsync<DataType>(func: ErrorProcessingAsync<never, ErrorType>): Promise<DataType>; | ||
onError<DataType>(func: TErrorProcessing<never, ErrorType>): DataType; | ||
onErrorAsync<DataType>(func: TErrorProcessingAsync<never, ErrorType>): Promise<DataType>; | ||
} | ||
export declare const ok: <DataType>(data: DataType) => ResultOK<DataType>; | ||
export declare const fail: <ErrorType>(error: ErrorType) => ResultFAIL<ErrorType>; | ||
export declare function tryCatch<C, D, E>(target: C, property: string, descriptor: TypedPropertyDescriptor<(...args: never[]) => D | ResultFAIL<E>>): TypedPropertyDescriptor<(...args: never[]) => D | ResultFAIL<E>>; | ||
export declare function tryCatchAsync<C, D, E>(target: C, property: string, descriptor: TypedPropertyDescriptor<(...args: never[]) => Promise<D | ResultFAIL<E>>>): TypedPropertyDescriptor<(...args: never[]) => Promise<D | ResultFAIL<E>>>; | ||
export declare function tryCatch<TargetType, DataType, ErrorType>(target: TargetType, property: string, descriptor: TypedPropertyDescriptor<(...args: never[]) => DataType | ResultFAIL<ErrorType>>): TypedPropertyDescriptor<(...args: never[]) => DataType | ResultFAIL<ErrorType>>; | ||
export declare function tryCatchAsync<TargetType, DataType, ErrorType>(target: TargetType, property: string, descriptor: TypedPropertyDescriptor<(...args: never[]) => Promise<DataType | ResultFAIL<ErrorType>>>): TypedPropertyDescriptor<(...args: never[]) => Promise<DataType | ResultFAIL<ErrorType>>>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.tryCatchAsync = exports.tryCatch = exports.fail = exports.ok = exports.ResultFAIL = exports.ResultOK = exports.Result = exports.resultError = exports.ResultError = void 0; | ||
var node_result_error_1 = require("node-result-error"); | ||
Object.defineProperty(exports, "ResultError", { enumerable: true, get: function () { return node_result_error_1.ResultError; } }); | ||
Object.defineProperty(exports, "resultError", { enumerable: true, get: function () { return node_result_error_1.resultError; } }); | ||
exports.tryCatchAsync = exports.tryCatch = exports.fail = exports.ok = exports.ResultFAIL = exports.ResultOK = exports.Result = void 0; | ||
class Result { | ||
@@ -8,0 +5,0 @@ constructor(data, error) { |
{ | ||
"name": "node-result", | ||
"version": "11.0.0", | ||
"version": "12.0.0", | ||
"description": "result", | ||
@@ -30,5 +30,3 @@ "keywords": [ | ||
}, | ||
"dependencies": { | ||
"node-result-error": "^1.2.0" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
@@ -35,0 +33,0 @@ "@types/jest": "^26.0.20", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
0
7732
133
- Removednode-result-error@^1.2.0
- Removednode-result-error@1.3.0(transitive)