@@ -83,12 +83,12 @@ export default class Builder {
83
83
}
84
84
85
85
// single entity .select(['age', 'firstname'])
86
- if ( fields [ 0 ] . constructor === String || Array . isArray ( fields [ 0 ] ) ) {
86
+ if ( typeof fields [ 0 ] === 'string' || Array . isArray ( fields [ 0 ] ) ) {
87
87
this . fields [ this . model . resource ( ) ] = fields . join ( ',' )
88
88
}
89
89
90
90
// related entities .select({ posts: ['title', 'content'], user: ['age', 'firstname']} )
91
- if ( fields [ 0 ] . constructor === Object ) {
91
+ if ( typeof fields [ 0 ] === 'object' ) {
92
92
Object . entries ( fields [ 0 ] ) . forEach ( ( [ key , value ] ) => {
93
93
this . fields [ key ] = value . join ( ',' )
94
94
} )
@@ -109,7 +109,7 @@ export default class Builder {
109
109
if ( Array . isArray ( key ) ) {
110
110
const [ _key , _value ] = this . _nestedFilter ( key , value )
111
111
112
- this . filters [ _key ] = _value
112
+ this . filters [ _key ] = { ... this . filters [ _key ] , ... _value }
113
113
} else {
114
114
this . filters [ key ] = value
115
115
}
@@ -125,7 +125,7 @@ export default class Builder {
125
125
if ( Array . isArray ( key ) ) {
126
126
const [ _key , _value ] = this . _nestedFilter ( key , array . join ( ',' ) )
127
127
128
- this . filters [ _key ] = _value
128
+ this . filters [ _key ] = { ... this . filters [ _key ] , ... _value }
129
129
} else {
130
130
this . filters [ key ] = array . join ( ',' )
131
131
}
@@ -161,7 +161,7 @@ export default class Builder {
161
161
}
162
162
163
163
params ( payload ) {
164
- if ( payload === undefined || payload . constructor !== Object ) {
164
+ if ( payload === undefined || typeof payload !== 'object' ) {
165
165
throw new Error ( 'You must pass a payload/object as param.' )
166
166
}
167
167
0 commit comments