Comparing version 0.3.0-rc.8 to 0.3.0
@@ -1,1 +0,1 @@ | ||
import{Type as e}from"@sinclair/typebox";import{TypeSystem as t}from"@sinclair/typebox/system";let i=e=>{if("string"==typeof e)switch(e.slice(-1)){case"k":return 1024*+e.slice(0,e.length-1);case"m":return 1048576*+e.slice(0,e.length-1);default:return+e}return e},r=(e,t)=>{if(!(t instanceof Blob)||e.minSize&&t.size<i(e.minSize)||e.maxSize&&t.size>i(e.maxSize))return!1;if(e.extension){if("string"==typeof e.extension){if(!t.type.startsWith(e.extension))return!1}else{for(let i=0;i<e.extension.length;i++)if(t.type.startsWith(e.extension[i]))return!0;return!1}}return!0};export const ElysiaType={File:t.CreateType("File",r),Files:t.CreateType("Files",(e,t)=>{if(!Array.isArray(t)||e.minItems&&t.length<e.minItems||e.maxItems&&t.length>e.maxItems)return!1;for(let i=0;i<t.length;i++)if(!r(e,t[i]))return!1;return!0})};e.File=e=>ElysiaType.File({default:"File",...e,extension:e?.type,type:"string",format:"binary"}),e.Files=e=>ElysiaType.Files({...e,default:"Files",extension:e?.type,type:"array",items:{...e,default:"Files",type:"string",format:"binary"}});export{e as t}; | ||
import{Type as e}from"@sinclair/typebox";import{TypeSystem as t}from"@sinclair/typebox/system";try{t.CreateFormat("email",e=>/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test(e)),t.CreateFormat("uuid",e=>/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)),t.CreateFormat("date",e=>!Number.isNaN(new Date(e).getTime())),t.CreateFormat("date-time",e=>!Number.isNaN(new Date(e).getTime()))}catch(e){}let i=e=>{if("string"==typeof e)switch(e.slice(-1)){case"k":return 1024*+e.slice(0,e.length-1);case"m":return 1048576*+e.slice(0,e.length-1);default:return+e}return e},r=(e,t)=>{if(!(t instanceof Blob)||e.minSize&&t.size<i(e.minSize)||e.maxSize&&t.size>i(e.maxSize))return!1;if(e.extension){if("string"==typeof e.extension){if(!t.type.startsWith(e.extension))return!1}else{for(let i=0;i<e.extension.length;i++)if(t.type.startsWith(e.extension[i]))return!0;return!1}}return!0};export const ElysiaType={File:t.CreateType("File",r),Files:t.CreateType("Files",(e,t)=>{if(!Array.isArray(t)||e.minItems&&t.length<e.minItems||e.maxItems&&t.length>e.maxItems)return!1;for(let i=0;i<t.length;i++)if(!r(e,t[i]))return!1;return!0})};e.File=e=>ElysiaType.File({default:"File",...e,extension:e?.type,type:"string",format:"binary"}),e.Files=e=>ElysiaType.Files({...e,default:"Files",extension:e?.type,type:"array",items:{...e,default:"Files",type:"string",format:"binary"}});export{e as t}; |
{ | ||
"name": "elysia", | ||
"description": "Fast, and friendly Bun web framework", | ||
"version": "0.3.0-rc.8", | ||
"version": "0.3.0", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "saltyAom", |
import { Type, type SchemaOptions } from '@sinclair/typebox' | ||
import { TypeSystem } from '@sinclair/typebox/system' | ||
try { | ||
TypeSystem.CreateFormat('email', (value) => | ||
/^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test( | ||
value | ||
) | ||
) | ||
TypeSystem.CreateFormat('uuid', (value) => | ||
/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test( | ||
value | ||
) | ||
) | ||
TypeSystem.CreateFormat( | ||
'date', | ||
(value) => !Number.isNaN(new Date(value).getTime()) | ||
) | ||
TypeSystem.CreateFormat( | ||
'date-time', | ||
(value) => !Number.isNaN(new Date(value).getTime()) | ||
) | ||
} catch (error) { | ||
// Not empty | ||
} | ||
type MaybeArray<T> = T | T[] | ||
@@ -5,0 +31,0 @@ |
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
167448
4416