{"ScriptPreparationCode":"function getByPathCustom(obj, path) {\r\n if (!obj || typeof obj !== \u0027object\u0027 || path == null) return null;\r\n if (obj?.hasOwnProperty?.(path) || typeof path === \u0027number\u0027) return obj?.[path] ?? null;\r\n if (!path?.length) return null;\r\n\r\n const parts = path?.split?.(\u0027.\u0027) || path;\r\n\r\n let current = obj;\r\n\r\n for (let i = 0; i \u003C parts?.length; i\u002B\u002B) {\r\n if (!current?.hasOwnProperty?.(parts[i])) return null;\r\n current = current[parts[i]];\r\n }\r\n\r\n return current;\r\n}\r\n\r\n\r\nvar person = {name: \u0027Frederick\u0027, lastName: \u0027Corcino Alejo\u0027, level1: {level2: {level3: \u0027level3 val\u0027}}, \u0027dot.notation.key\u0027: {nested: {}}}","TestCases":[{"Name":"Lodash get","Code":"_.get(person, \u0027name\u0027);","IsDeferred":false},{"Name":"Native","Code":"person.name;","IsDeferred":false},{"Name":"Nested (lodash)","Code":"_.get(person, \u0027level1.level2.level3\u0027);","IsDeferred":false},{"Name":"Nested (native, dot)","Code":"person.level1.level2.level3;","IsDeferred":false},{"Name":"Nested (optional chaining)","Code":"person?.level1?.level2?.level3;","IsDeferred":false},{"Name":"Nested (custom implementation)","Code":"getByPathCustom(person, \u0027level1.level2.level3\u0027);","IsDeferred":false},{"Name":"Non-existent (optional chaining)","Code":"person?.level1?.level2?.level3?.nonExistent?.foo","IsDeferred":false},{"Name":"Non-existent (lodash)","Code":"_.get(person, \u0027level1.level2.level3.nonExistent.foo\u0027);","IsDeferred":false},{"Name":"Non-existent (custom implementation)","Code":"getByPathCustom(person, \u0027level1.level2.level3.nonExistent.foo\u0027);","IsDeferred":false},{"Name":"No path (lodash)","Code":"_.get(person, \u0027\u0027);","IsDeferred":false},{"Name":"No path (custom)","Code":"getByPathCustom(person, \u0027\u0027);","IsDeferred":false},{"Name":"Not nested (custom)","Code":"getByPathCustom(person, \u0027name\u0027);","IsDeferred":false},{"Name":"Top level dot notation key (lodash)","Code":"_.get(person, \u0027dot.notation.key\u0027);","IsDeferred":false},{"Name":"Top level dot notation key (custom)","Code":"getByPathCustom(person, \u0027dot.notation.key\u0027);","IsDeferred":false}]}