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
2
2
Improvement:
3
3
- improve array operation
4
4
Original file line number Diff line number Diff line change 1
1
import { t } from 'elysia'
2
2
import { createAccelerator } from '../src/index'
3
3
4
- const shape = t . Object ( {
5
- name : t . String ( {
6
- // trusted: true
4
+ const shape = t . Array (
5
+ t . Object ( {
6
+ name : t . String ( )
7
7
} )
8
- } )
8
+ )
9
9
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
15
18
16
19
const mirror = createAccelerator ( shape )
17
20
18
- console . log ( JSON . parse ( mirror ( value ) ) )
21
+ console . log ( ( mirror ( value ) ) )
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " json-accelerator" ,
3
- "version" : " 0.1.6 " ,
3
+ "version" : " 0.1.7 " ,
4
4
"description" : " Speed up JSON stringification by providing OpenAPI/TypeBox model" ,
5
5
"license" : " MIT" ,
6
6
"scripts" : {
Original file line number Diff line number Diff line change @@ -355,8 +355,7 @@ const accelerate = (
355
355
const name = joinProperty ( property , key )
356
356
const hasShortName =
357
357
schema . properties [ key ] . type === 'object' &&
358
- ! name . startsWith ( 'ar' ) &&
359
- Object . keys ( schema . properties ) . length > 5
358
+ ! name . startsWith ( 'ar' )
360
359
361
360
const i = instruction . properties . length
362
361
if ( hasShortName ) instruction . properties . push ( name )
@@ -529,6 +528,8 @@ export const createAccelerator = <T extends TAnySchema>(
529
528
definitions
530
529
} )
531
530
531
+ console . log ( f )
532
+
532
533
return Function ( 'v' , f ) as any
533
534
}
534
535
You can’t perform that action at this time.
0 commit comments