Comparing version 2.5.0 to 2.5.1
@@ -190,2 +190,3 @@ "use strict"; | ||
} | ||
value = this.sanitizeValue(value); | ||
const results = []; | ||
@@ -210,2 +211,6 @@ let typeRule = this.rules.shift(); | ||
}; | ||
this.sanitizeValue = (value) => this.sanitizers.reduce( | ||
(acc, sanitizer2) => sanitizer2(acc), | ||
value | ||
); | ||
this.validateType = (value) => { | ||
@@ -243,5 +248,2 @@ if (this.isArray) { | ||
return false; | ||
for (const sanitizer2 of this.sanitizers) { | ||
value = value.map((innerVal) => sanitizer2(innerVal)); | ||
} | ||
for (const val of value) { | ||
@@ -254,5 +256,2 @@ if (!func(val)) { | ||
} else { | ||
for (const sanitizer2 of this.sanitizers) { | ||
value = sanitizer2(value); | ||
} | ||
if (!func(value)) { | ||
@@ -259,0 +258,0 @@ return false; |
@@ -9,4 +9,4 @@ /// <reference types="@cloudflare/workers-types" /> | ||
export declare type Data = string | ArrayBuffer | ReadableStream; | ||
export declare class Context<P extends string = string, E extends Partial<Environment> = Environment, S extends Partial<Schema> | unknown = Schema> { | ||
req: Request<P, S extends Schema ? SchemaToProp<S> : any>; | ||
export declare class Context<P extends string = string, E extends Partial<Environment> = Environment, S extends Partial<Schema> = Schema> { | ||
req: Request<P, S extends Schema ? SchemaToProp<S> : S>; | ||
env: E['Bindings']; | ||
@@ -13,0 +13,0 @@ finalized: boolean; |
@@ -20,4 +20,4 @@ import type { Context } from './context'; | ||
export interface CustomHandler<P extends string | Partial<Environment> | Schema = string, E = Partial<Environment> | Partial<Schema>, S = Partial<Schema>> { | ||
(c: Context<P extends string ? P : P extends Partial<Environment> ? string : P extends Partial<Schema> ? string : never, P extends Partial<Environment> ? P : P extends Partial<Schema> ? Partial<Environment> : E extends Partial<Environment> ? E extends Partial<Schema> ? Environment : E : E extends Partial<Schema> ? Partial<Environment> : Environment, P extends Partial<Schema> ? P : E extends Partial<Schema> ? P extends Partial<Environment> ? E extends Partial<Environment> ? unknown : E : unknown : S extends Partial<Schema> ? S : never>, next: Next): Response | Promise<Response | undefined | void>; | ||
(c: Context<P extends string ? P : P extends Partial<Environment> ? string : P extends Partial<Schema> ? string : never, P extends Partial<Environment> ? P : P extends Partial<Schema> ? Partial<Environment> : E extends Partial<Environment> ? E extends Partial<Schema> ? Environment : E : E extends Partial<Schema> ? Partial<Environment> : Environment, S extends Schema ? S : P extends Schema ? P : E extends Schema ? E : any>, next: Next): Response | Promise<Response | undefined | void>; | ||
} | ||
export {}; |
@@ -79,2 +79,3 @@ import type { JSONObject, JSONPrimitive, JSONArray } from './../utils/json'; | ||
protected getTypeRuleName(): string; | ||
private sanitizeValue; | ||
private validateRule; | ||
@@ -81,0 +82,0 @@ private validateType; |
@@ -158,2 +158,3 @@ // src/validator/validator.ts | ||
} | ||
value = this.sanitizeValue(value); | ||
const results = []; | ||
@@ -178,2 +179,6 @@ let typeRule = this.rules.shift(); | ||
}; | ||
this.sanitizeValue = (value) => this.sanitizers.reduce( | ||
(acc, sanitizer2) => sanitizer2(acc), | ||
value | ||
); | ||
this.validateType = (value) => { | ||
@@ -211,5 +216,2 @@ if (this.isArray) { | ||
return false; | ||
for (const sanitizer2 of this.sanitizers) { | ||
value = value.map((innerVal) => sanitizer2(innerVal)); | ||
} | ||
for (const val of value) { | ||
@@ -222,5 +224,2 @@ if (!func(val)) { | ||
} else { | ||
for (const sanitizer2 of this.sanitizers) { | ||
value = sanitizer2(value); | ||
} | ||
if (!func(value)) { | ||
@@ -227,0 +226,0 @@ return false; |
{ | ||
"name": "hono", | ||
"version": "2.5.0", | ||
"version": "2.5.1", | ||
"description": "Ultrafast web framework for Cloudflare Workers.", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
286843
8564