{"ScriptPreparationCode":"function destructuringFn(input) {\r\n const { contextMenu: { data: { documents = [] } = {} } = {} } = input;\r\n return documents;\r\n}\r\n\r\nfunction destructuringFnDynamic(input, key) {\r\n const { contextMenu: { data: { [key]: documents = [] } = {} } = {} } = input;\r\n return documents;\r\n}\r\n\r\nfunction lodashFn(input) {\r\n const documents = _.get(input, \u0027contextMenu.data.documents\u0027, []);\r\n return documents;\r\n}\r\n\r\nfunction lodashFnDynamic(input, key) {\r\n const documents = _.get(input, \u0060contextMenu.data.${key}\u0060, []);\r\n return documents;\r\n}\r\n\r\nfunction lodashFnDynamicArray(input, key) {\r\n const documents = _.get(input, [\u0027contextMenu\u0027, \u0027data\u0027, \u0027key\u0027], []);\r\n return documents;\r\n}\r\n\r\nlet paths = {};\r\nfunction lodashFnDynamicCachedArray(input, key) {\r\n paths[key] = paths[key] || _.toPath(\u0060contextMenu.data.${key}\u0060);\r\n const documents = _.get(input, paths[key], []);\r\n return documents;\r\n}\r\n\r\nfunction test(fn, input, key) {\r\n fn(input, key);\r\n}","TestCases":[{"Name":"destructuring with defaults, empty input","Code":"test(destructuringFn, {});","IsDeferred":false},{"Name":"lodash get, empty input","Code":"test(lodashFn, {});","IsDeferred":false},{"Name":"destructuring with defaults, find item","Code":"const input = { contextMenu: { data: { documents: [{ id: \u0027doc\u0027 }] } } };\r\ntest(destructuringFn, input);","IsDeferred":false},{"Name":"lodash get, find item","Code":"const input = { contextMenu: { data: { documents: [{ id: \u0027doc\u0027 }] } } };\r\ntest(lodashFn, input);","IsDeferred":false},{"Name":"destructuring dynamic key","Code":"const input = { contextMenu: { data: { documents: [{ id: \u0027doc\u0027 }] } } };\r\ntest(destructuringFn, input, \u0027documents\u0027);","IsDeferred":false},{"Name":"lodash dynamic key","Code":"const input = { contextMenu: { data: { documents: [{ id: \u0027doc\u0027 }] } } };\r\ntest(lodashFnDynamic, input, \u0027documents\u0027);","IsDeferred":false},{"Name":"lodash dynamic key using array","Code":"const input = { contextMenu: { data: { documents: [{ id: \u0027doc\u0027 }] } } };\r\ntest(lodashFnDynamicArray, input, \u0027documents\u0027);","IsDeferred":false},{"Name":"lodash dynamic key using manually cached array","Code":"const input = { contextMenu: { data: { documents: [{ id: \u0027doc\u0027 }] } } };\r\ntest(lodashFnDynamicCachedArray, input, \u0027documents\u0027);","IsDeferred":false}]}