{"ScriptPreparationCode":"var pick = (obj, keys) =\u003E {\r\n return keys\r\n .filter((key) =\u003E key in obj)\r\n .reduce((res, key) =\u003E ({\r\n ...res,\r\n [key]: obj[key]\r\n }), {});\r\n};\r\n\r\nvar arr = [];\r\nvar object = {\r\n type: \u0027aaa\u0027,\r\n subtype: \u0027bbb\u0027,\r\n card_last4: \u0027bbb\u0027,\r\n card_type: \u0027bbb\u0027,\r\n card_exp_month: \u0027bbb\u0027,\r\n card_exp_year: \u0027bbb\u0027,\r\n card_country: \u0027bbb\u0027,\r\n foo: \u0027bar\u0027\r\n};\r\nfor (var i = 0; i \u003C= 100000; i\u002B\u002B) {\r\n arr.push(object);\r\n}","TestCases":[{"Name":"Lodash","Code":"arr.map(function (element) {\r\n\treturn _.pick(\r\n \telement,\r\n \t\u0027type\u0027,\r\n \u0027subtype\u0027,\r\n \u0027card_last4\u0027,\r\n \u0027card_type\u0027,\r\n \u0027card_exp_month\u0027,\r\n \u0027card_exp_year\u0027,\r\n \u0027card_country\u0027,\r\n \u0027something\u0027\r\n );\r\n});","IsDeferred":false},{"Name":"Native","Code":"arr.map(function (element) {\r\n\tconst {\r\n type,\r\n subtype,\r\n card_last4,\r\n card_type,\r\n card_exp_month,\r\n card_exp_year,\r\n card_country,\r\n something\r\n } = element;\r\n\r\n return {\r\n type,\r\n subtype,\r\n card_last4,\r\n card_type,\r\n card_exp_month,\r\n card_exp_year,\r\n card_country,\r\n something\r\n };\r\n});","IsDeferred":false},{"Name":"Manual pick with property names","Code":"const props = [\r\n \u0022type\u0022,\r\n \u0022subtype\u0022,\r\n \u0022card_last4\u0022,\r\n \u0022card_type\u0022,\r\n \u0022card_exp_month\u0022,\r\n \u0022card_exp_year\u0022,\r\n \u0022card_country\u0022,\r\n \u0022something\u0022\r\n];\r\narr.map(function (element) {\r\n const res = {};\r\n for(let prop of props){\r\n res[prop] = element[prop]\r\n }\r\n return res;\r\n});","IsDeferred":false},{"Name":"Manual pick","Code":"arr.map(function (element) {\r\n\treturn {\r\n type: element.type,\r\n subtype: element.subtype,\r\n card_last4: element.card_last4,\r\n card_type: element.card_type,\r\n card_exp_month: element.card_exp_month,\r\n card_exp_year: element.card_exp_year,\r\n card_country: element.card_country,\r\n something: element.something\r\n };\r\n});","IsDeferred":false},{"Name":"Filter","Code":"const props = [\r\n \u0022type\u0022,\r\n \u0022subtype\u0022,\r\n \u0022card_last4\u0022,\r\n \u0022card_type\u0022,\r\n \u0022card_exp_month\u0022,\r\n \u0022card_exp_year\u0022,\r\n \u0022card_country\u0022,\r\n \u0022something\u0022\r\n];\r\n\r\narr.map(function (element) {\r\n\treturn pick(element,props)\r\n});","IsDeferred":false}]}