fix(puterjs): fix settings object check

This commit is contained in:
KernelDeimos 2024-08-23 16:39:30 -04:00
parent 7f9d1e90b1
commit 5a616f67dd

View File

@ -209,8 +209,13 @@ class AI{
} }
// if any of the args is an object, assume it's the settings object // 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++) { for (let i = 0; i < args.length; i++) {
if (typeof args[i] === 'object') { if (is_object(args[i])) {
settings = args[i]; settings = args[i];
break; break;
} }