@@ -12,7 +12,7 @@ import {
12
12
StructError ,
13
13
} from '@metamask/superstruct' ;
14
14
import type { PendingJsonRpcResponse , JsonRpcRequest } from '@metamask/utils' ;
15
- import { assert , JsonStruct , isPlainObject , type Json } from '@metamask/utils' ;
15
+ import { isObject , assert , JsonStruct , type Json } from '@metamask/utils' ;
16
16
17
17
import { manageStateBuilder } from '../restricted/manageState' ;
18
18
import type { MethodHooksObject } from '../utils' ;
@@ -129,7 +129,7 @@ async function setStateImplementation(
129
129
await getUnlockPromise ( true ) ;
130
130
}
131
131
132
- if ( key === undefined && ! isPlainObject ( value ) ) {
132
+ if ( key === undefined && ! isObject ( value ) ) {
133
133
return end (
134
134
rpcErrors . invalidParams (
135
135
'Invalid params: Value must be an object if key is not provided.' ,
@@ -189,7 +189,7 @@ async function getNewState(
189
189
getSnapState : SetStateHooks [ 'getSnapState' ] ,
190
190
) {
191
191
if ( key === undefined ) {
192
- assert ( isPlainObject ( value ) ) ;
192
+ assert ( isObject ( value ) ) ;
193
193
return value ;
194
194
}
195
195
@@ -218,7 +218,7 @@ export function set(
218
218
value : Json ,
219
219
) : JsonObject {
220
220
if ( key === undefined ) {
221
- assert ( isPlainObject ( value ) ) ;
221
+ assert ( isObject ( value ) ) ;
222
222
return value ;
223
223
}
224
224
@@ -239,7 +239,7 @@ export function set(
239
239
return requiredObject ;
240
240
}
241
241
242
- currentObject [ currentKey ] = isPlainObject ( currentObject [ currentKey ] )
242
+ currentObject [ currentKey ] = isObject ( currentObject [ currentKey ] )
243
243
? currentObject [ currentKey ]
244
244
: { } ;
245
245
0 commit comments