{"ScriptPreparationCode":"var testData = {\r\n a: {\r\n b: {\r\n c: {\r\n d: [{\r\n e: {\r\n f: {\r\n g: {\r\n h: [{},\r\n {\r\n i: {},\r\n },\r\n ],\r\n },\r\n },\r\n },\r\n }, ],\r\n },\r\n },\r\n },\r\n};\r\nvar testPath = [\u0027a\u0027, \u0027b\u0027, \u0027c\u0027, \u0027d\u0027, 1, \u0027e\u0027, \u0027f\u0027, \u0027g\u0027, \u0027h\u0027, 1, \u0027i\u0027];\r\n\r\nfunction isObject(input) {\r\n if (input === null) return false;\r\n\r\n return typeof input === \u0027object\u0027 || typeof input === \u0027function\u0027;\r\n}\r\n\r\nvar myGet = (input, path, defaultValue) =\u003E {\r\n if (!input || !path.length) {\r\n return defaultValue;\r\n }\r\n \r\n let result = input;\r\n\r\n for (let i = 0; i \u003C path.length - 1; i \u002B= 1) {\r\n const nextResult = result[path[i]];\r\n \r\n if (typeof nextResult !== \u0027undefined\u0027) {\r\n result = nextResult;\r\n } else {\r\n return defaultValue;\r\n }\r\n }\r\n \r\n result = result[path[path.length - 1]];\r\n\r\n \r\n return typeof result === \u0027undefined\u0027 ? defaultValue : result;\r\n};","TestCases":[{"Name":"My Get","Code":"myGet(testData, testPath);","IsDeferred":false},{"Name":"Lodash Get","Code":"_.get(testData, testPath);","IsDeferred":false},{"Name":"Empty myGet","Code":"myGet(null, testPath);","IsDeferred":false},{"Name":"Empty Lodash Get","Code":"_.get(null, testPath);","IsDeferred":false}]}