{"ScriptPreparationCode":"var arr = [];\r\nvar object = { \r\n\ttype: \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) { arr.push(object); }","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\n\r\nfunction pick(element, props) {\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}\r\n\r\narr.map((element) =\u003E pick(element, props));","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":"compiled pick function","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\nfunction pickBuilder(props) {\r\n \tconst obj = props.map((prop) =\u003E \u0060if (has.call(el, \u0027${prop}\u0027)) res.${prop} = el.${prop}\u0060).join(\u0027;\u0027);\r\n\treturn new Function(\u0027el\u0027, \u0060const has = Object.prototype.hasOwnProperty; const res = {}; ${obj}; return res;\u0060);\r\n}\r\n\r\nconst pick = pickBuilder(props)\r\n\r\narr.map((element) =\u003E pick(element));","IsDeferred":false}]}