model-state-validation
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -1,2 +0,2 @@ | ||
import { IModelStateError } from "./IModelStateError"; | ||
import { IModelStateError } from './IModelStateError'; | ||
export declare class Errors { | ||
@@ -3,0 +3,0 @@ [property: string]: any; |
@@ -8,3 +8,3 @@ export class Errors { | ||
containsField(fieldName) { | ||
return typeof this[fieldName] !== "undefined"; | ||
return typeof this[fieldName] !== 'undefined'; | ||
} | ||
@@ -11,0 +11,0 @@ addField(fieldName, value) { |
@@ -1,3 +0,3 @@ | ||
import { ModelStateError } from "./ModelStateError"; | ||
import { Errors } from "./Errors"; | ||
import { ModelStateError } from './ModelStateError'; | ||
import { Errors } from './Errors'; | ||
export interface IModelState { | ||
@@ -4,0 +4,0 @@ commonError?: ModelStateError; |
@@ -1,8 +0,8 @@ | ||
export * from "./Errors"; | ||
export * from "./IModelState"; | ||
export * from "./IModelStateError"; | ||
export * from "./IValidator"; | ||
export * from "./IValidatorAsync"; | ||
export * from "./ModelState"; | ||
export * from "./ModelStateError"; | ||
export * from "./typeGuards"; | ||
export * from './Errors'; | ||
export * from './IModelState'; | ||
export * from './IModelStateError'; | ||
export * from './IValidator'; | ||
export * from './IValidatorAsync'; | ||
export * from './ModelState'; | ||
export * from './ModelStateError'; | ||
export * from './typeGuards'; |
@@ -1,9 +0,9 @@ | ||
export * from "./Errors"; | ||
export * from "./IModelState"; | ||
export * from "./IModelStateError"; | ||
export * from "./IValidator"; | ||
export * from "./IValidatorAsync"; | ||
export * from "./ModelState"; | ||
export * from "./ModelStateError"; | ||
export * from "./typeGuards"; | ||
export * from './Errors'; | ||
export * from './IModelState'; | ||
export * from './IModelStateError'; | ||
export * from './IValidator'; | ||
export * from './IValidatorAsync'; | ||
export * from './ModelState'; | ||
export * from './ModelStateError'; | ||
export * from './typeGuards'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,4 +0,4 @@ | ||
import { ModelState } from "./ModelState"; | ||
import { ModelState } from './ModelState'; | ||
export interface IValidator<TModel> { | ||
validate: (model: TModel) => ModelState; | ||
} |
@@ -1,4 +0,4 @@ | ||
import { ModelState } from "./ModelState"; | ||
import { ModelState } from './ModelState'; | ||
export interface IValidatorAsync<TModel> { | ||
validateAsync: (model: TModel) => Promise<ModelState>; | ||
} |
@@ -1,7 +0,7 @@ | ||
import { ModelStateError } from "./ModelStateError"; | ||
import { Errors } from "./Errors"; | ||
import { IModelState } from "./IModelState"; | ||
import { ModelStateError } from './ModelStateError'; | ||
import { Errors } from './Errors'; | ||
import { IModelState } from './IModelState'; | ||
export declare class ModelState implements IModelState { | ||
commonError?: ModelStateError; | ||
private modelStateErrors; | ||
commonError?: ModelStateError; | ||
addError(propertyName: string, errorMessage: string): void; | ||
@@ -8,0 +8,0 @@ addModelState(modelState: ModelState): this; |
@@ -1,2 +0,2 @@ | ||
import { Errors } from "./Errors"; | ||
import { Errors } from './Errors'; | ||
export class ModelState { | ||
@@ -3,0 +3,0 @@ constructor() { |
@@ -1,2 +0,2 @@ | ||
import { IModelStateError } from "./IModelStateError"; | ||
import { IModelStateError } from './IModelStateError'; | ||
export declare class ModelStateError implements IModelStateError { | ||
@@ -3,0 +3,0 @@ readonly name: string; |
export class ModelStateError { | ||
constructor(error = "") { | ||
this.name = "common-error"; | ||
constructor(error = '') { | ||
this.name = 'common-error'; | ||
this.error = error; | ||
@@ -5,0 +5,0 @@ } |
@@ -1,4 +0,4 @@ | ||
import { IValidator } from "./IValidator"; | ||
import { IValidatorAsync } from "./IValidatorAsync"; | ||
import { IValidator } from './IValidator'; | ||
import { IValidatorAsync } from './IValidatorAsync'; | ||
export declare function isValidator(validator: any): validator is IValidator<any>; | ||
export declare function isValidatorAsync(validator: any): validator is IValidatorAsync<any>; |
export function isValidator(validator) { | ||
return validator && typeof validator.validate === "function"; | ||
return validator && typeof validator.validate === 'function'; | ||
} | ||
export function isValidatorAsync(validator) { | ||
return validator && typeof validator.validateAsync === "function"; | ||
return validator && typeof validator.validateAsync === 'function'; | ||
} | ||
//# sourceMappingURL=typeGuards.js.map |
{ | ||
"name": "model-state-validation", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "", | ||
@@ -25,6 +25,6 @@ "contributors": [ | ||
"devDependencies": { | ||
"tslint": "6.1.2", | ||
"tslint": "6.1.3", | ||
"tslint-config-prettier": "1.18.0", | ||
"tslint-eslint-rules": "5.4.0", | ||
"typescript": "3.9.7" | ||
"typescript": "4.2.4" | ||
}, | ||
@@ -31,0 +31,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
10620