Skip to content

Commit

Permalink
fix(puterjs): fix settings object check
Browse files Browse the repository at this point in the history
  • Loading branch information
KernelDeimos committed Aug 23, 2024
1 parent 7f9d1e9 commit 5a616f6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/puter-js/src/modules/AI.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,13 @@ class AI{
}

// if any of the args is an object, assume it's the settings object
const is_object = v => {
return typeof v === 'object' &&
!Array.isArray(v) &&
v !== null;
};
for (let i = 0; i < args.length; i++) {
if (typeof args[i] === 'object') {
if (is_object(args[i])) {
settings = args[i];
break;
}
Expand Down

0 comments on commit 5a616f6

Please sign in to comment.