{"ScriptPreparationCode":"var key = \u0027key\u0027;\r\n\r\nvar object = {\r\n \u0027a\u0027: {\r\n \u0027key\u0027: \u0027a\u0027,\r\n \u0027foo\u0027: 123123,\r\n \u0027bar\u0027: 123,\r\n \u0027fobar\u0027: 456\r\n }\r\n};\r\n\r\nvar array = [\r\n {\r\n \u0027key\u0027: \u0027b\u0027,\r\n \u0027foo\u0027: 67563,\r\n \u0027bar\u0027: 6345,\r\n \u0027fobar\u0027: 3425\r\n },\r\n {\r\n \u0027key\u0027: \u0027c\u0027,\r\n \u0027foo\u0027: 34532,\r\n \u0027bar\u0027: 123412,\r\n \u0027fobar\u0027: 534532\r\n },\r\n {\r\n \u0027key\u0027: \u0027d\u0027,\r\n \u0027foo\u0027: 1234321,\r\n \u0027bar\u0027: 435234,\r\n \u0027fobar\u0027: 346457\r\n },\r\n {\r\n \u0027key\u0027: \u0027e\u0027,\r\n \u0027foo\u0027: 23523,\r\n \u0027bar\u0027: 124325,\r\n \u0027fobar\u0027: 2134235\r\n },\r\n {\r\n \u0027key\u0027: \u0027f\u0027,\r\n \u0027foo\u0027: 1235213,\r\n \u0027bar\u0027: 346346,\r\n \u0027fobar\u0027: 213423\r\n }\r\n];","TestCases":[{"Name":"Array.prototype.reduce()","Code":"// This code can\u0027t find dot-notations key and nested property.\r\narray.reduce(function(acc, cur) {\r\n acc[cur[key]] = cur;\r\n return acc;\r\n}, Object.assign({}, object));","IsDeferred":false},{"Name":"_.reduce()","Code":"// This code can\u0027t find dot-notations key and nested property.\r\n_.reduce(array, function(acc, cur) {\r\n acc[cur[key]] = cur;\r\n return acc;\r\n}, Object.assign({}, object));","IsDeferred":false},{"Name":"_.reduce() with _.get()","Code":"_.reduce(array, function(acc, cur) {\r\n acc[_.get(cur, key)] = cur;\r\n return acc;\r\n}, Object.assign({}, object));","IsDeferred":false},{"Name":"_.keyBy()","Code":"Object.assign({}, object, _.keyBy(array, key));","IsDeferred":false}]}