{"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 oldWay(input, key) {\r\n const documents = _.get(input, \u0060contextMenu.data.${key}\u0060, []);\r\n return input \u0026\u0026 input.contextMenu \u0026\u0026 input.contextMenu.data \u0026\u0026 input.contextMenu.data[key];\r\n}\r\n\r\nfunction test(fn, input, key) {\r\n fn(input, key);\r\n}","TestCases":[{"Name":"destructuring with defaults, empty inputa","Code":"test(destructuringFn, {});","IsDeferred":false},{"Name":"lodash get, empty inputb","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 null input","Code":"test(destructuringFn, null);","IsDeferred":false},{"Name":"lodash null input","Code":"test(lodashFn, null);","IsDeferred":false},{"Name":"destructuring undefined input","Code":"let input;\r\ntest(destructuringFn, input);","IsDeferred":false},{"Name":"lodash undefined input","Code":"let input;\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(lodashFn, input, \u0027documents\u0027);","IsDeferred":false},{"Name":"oldway","Code":"const input = { contextMenu: { data: { documents: [{ id: \u0027doc\u0027 }] } } };\r\ntest(oldWay, input, \u0027documents\u0027);","IsDeferred":false}]}