File tree Expand file tree Collapse file tree 4 files changed +18
-14
lines changed Expand file tree Collapse file tree 4 files changed +18
-14
lines changed Original file line number Diff line number Diff line change 1- # 0.1.7
1+ # 0.1.7 - 25 Apr 2025
22Improvement:
33- improve array operation
44
Original file line number Diff line number Diff line change 11import { t } from 'elysia'
22import { createAccelerator } from '../src/index'
33
4- const shape = t . Object ( {
5- name : t . String ( {
6- // trusted: true
4+ const shape = t . Array (
5+ t . Object ( {
6+ name : t . String ( )
77 } )
8- } )
8+ )
99
10- const string = `hi awd`
11-
12- const value = {
13- name : string
14- } satisfies typeof shape . static
10+ const value = [
11+ {
12+ name : 'a'
13+ } ,
14+ {
15+ name : 'b'
16+ }
17+ ] satisfies typeof shape . static
1518
1619const mirror = createAccelerator ( shape )
1720
18- console . log ( JSON . parse ( mirror ( value ) ) )
21+ console . log ( ( mirror ( value ) ) )
Original file line number Diff line number Diff line change 11{
22 "name" : " json-accelerator" ,
3- "version" : " 0.1.6 " ,
3+ "version" : " 0.1.7 " ,
44 "description" : " Speed up JSON stringification by providing OpenAPI/TypeBox model" ,
55 "license" : " MIT" ,
66 "scripts" : {
Original file line number Diff line number Diff line change @@ -355,8 +355,7 @@ const accelerate = (
355355 const name = joinProperty ( property , key )
356356 const hasShortName =
357357 schema . properties [ key ] . type === 'object' &&
358- ! name . startsWith ( 'ar' ) &&
359- Object . keys ( schema . properties ) . length > 5
358+ ! name . startsWith ( 'ar' )
360359
361360 const i = instruction . properties . length
362361 if ( hasShortName ) instruction . properties . push ( name )
@@ -529,6 +528,8 @@ export const createAccelerator = <T extends TAnySchema>(
529528 definitions
530529 } )
531530
531+ console . log ( f )
532+
532533 return Function ( 'v' , f ) as any
533534}
534535
You can’t perform that action at this time.
0 commit comments