From 5a616f67dd22a0dcbb8a380bbbd2347a0029ce31 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Fri, 23 Aug 2024 16:39:30 -0400 Subject: [PATCH] fix(puterjs): fix settings object check --- src/puter-js/src/modules/AI.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/puter-js/src/modules/AI.js b/src/puter-js/src/modules/AI.js index a04a79d9..f6ee7f3d 100644 --- a/src/puter-js/src/modules/AI.js +++ b/src/puter-js/src/modules/AI.js @@ -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; }