Skip to content

Commit 5a616f6

Browse files
committed
fix(puterjs): fix settings object check
1 parent 7f9d1e9 commit 5a616f6

File tree

1 file changed

+6
-1
lines changed
  • src/puter-js/src/modules

1 file changed

+6
-1
lines changed

src/puter-js/src/modules/AI.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,13 @@ class AI{
209209
}
210210

211211
// if any of the args is an object, assume it's the settings object
212+
const is_object = v => {
213+
return typeof v === 'object' &&
214+
!Array.isArray(v) &&
215+
v !== null;
216+
};
212217
for (let i = 0; i < args.length; i++) {
213-
if (typeof args[i] === 'object') {
218+
if (is_object(args[i])) {
214219
settings = args[i];
215220
break;
216221
}

0 commit comments

Comments
 (0)