File tree Expand file tree Collapse file tree 3 files changed +32
-2
lines changed
Expand file tree Collapse file tree 3 files changed +32
-2
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " @ferflores507/object-builder" ,
3- "version" : " 9.4 .0" ,
3+ "version" : " 9.5 .0" ,
44 "main" : " index.js" ,
55 "scripts" : {
66 "test" : " vitest"
Original file line number Diff line number Diff line change @@ -7,9 +7,17 @@ export class PropiedadesBuilder {
77 const allEntries = Object . entries ( propiedades )
88 const { entries = [ ] , computedEntries = [ ] } = this . groupByComputed ( allEntries )
99
10- this . entries = entries
10+ this . entries = entries . filter ( ( [ key ] ) => key !== "$bind" )
1111 this . result = assignAll ( { } , ...this . getGetters ( computedEntries ) )
1212 this . builder = builder . with ( { siblings : this . result } )
13+
14+ const bindEntry = entries . find ( ( [ key ] ) => key === "$bind" )
15+
16+ if ( bindEntry ) {
17+ const [ key , val ] = bindEntry
18+
19+ Object . assign ( this . result , this . builder . with ( { schema : val } ) . build ( ) )
20+ }
1321 }
1422
1523 private readonly result : Record < string , any >
Original file line number Diff line number Diff line change @@ -9,6 +9,28 @@ import { Queue } from '../../src/helpers/Queue'
99import { TaskBuilder } from '../../src/builders/TaskBuilder'
1010import { Propiedades } from '../../src/models'
1111
12+ test ( "propiedades $bind" , async ( ) => {
13+ await expectToEqualAsync ( {
14+ store : {
15+ details : {
16+ id : 1 ,
17+ en : "one"
18+ }
19+ } ,
20+ schema : {
21+ propiedades : {
22+ $bind : {
23+ path : "details"
24+ }
25+ }
26+ } ,
27+ expected : {
28+ id : 1 ,
29+ en : "one"
30+ }
31+ } )
32+ } )
33+
1234test ( "map object" , async ( ) => {
1335 await expectToEqualAsync ( {
1436 store : {
You can’t perform that action at this time.
0 commit comments