From e971e1a4deab4a3bb607a2785f5aec15b1eda1c4 Mon Sep 17 00:00:00 2001 From: Charles Pascoe Date: Wed, 10 Jan 2018 13:11:46 +0000 Subject: [PATCH] refactor(lib/validate-interface): Rename SuccessResult.result to value --- lib/index.ts | 4 ++-- lib/validation-result.ts | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/index.ts b/lib/index.ts index 82f9808..54d4363 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -83,7 +83,7 @@ export function conformsTo(validator: Validator, optionsOrNext?: IValidati return errors.concat(result.addPathNode(new KeyPathNode(key)).errors); } - partiallyValidated[key] = result.result; + partiallyValidated[key] = result.value; return errors; }, [] as ValidationError[]); @@ -261,7 +261,7 @@ export function eachItem(assertion: (arg: any) => ValidationResult, next?: ); } - const mapped = (results as SuccessResult[]).map(result => result.result); + const mapped = (results as SuccessResult[]).map(result => result.value); return next ? next(mapped) : success(mapped); }; diff --git a/lib/validation-result.ts b/lib/validation-result.ts index 970d8cb..da767c4 100644 --- a/lib/validation-result.ts +++ b/lib/validation-result.ts @@ -86,7 +86,7 @@ export class ErrorResult { export interface SuccessResult { readonly success: true; - readonly result: T; + readonly value: T; } @@ -100,6 +100,6 @@ export function errorFromException(err: any): ErrorResult { } -export function success(result: T): SuccessResult { - return {success: true, result}; +export function success(value: T): SuccessResult { + return {success: true, value}; }