From f93b9df8bf4295c3addc123087efabebb59293a8 Mon Sep 17 00:00:00 2001 From: Nebz <28622481+NebzHB@users.noreply.github.com> Date: Sun, 28 Jan 2024 12:30:10 +0100 Subject: [PATCH] Update index.js --- index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 13130bc..ce89511 100755 --- a/index.js +++ b/index.js @@ -6604,5 +6604,12 @@ function RGBtoHSV(r, g, b) { // -- id : id to find // -- Return : Object found function findMyID(obj, id) { - return Object.values(obj).find((item) => item && item.id == id) || -1; + //return Object.values(obj).find((item) => item && item.id == id) || -1; + for(const o in obj) { + // if( obj.hasOwnProperty( o ) && obj[o] && obj[o].id && parseInt(obj[o].id) && parseInt(id) && parseInt(obj[o].id)==parseInt(id)) { + if( obj.hasOwnProperty( o ) && obj[o] && obj[o].id && obj[o].id==id) { + return obj[o]; + } + } + return -1; }