{"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":"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},{"Name":"loop","Code":" const has = Object.prototype.hasOwnProperty;\r\nconst 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\tconst res = {};\r\n \r\n \tfor (const prop of props) {\r\n \tif (has.call(element, prop)) res[prop] = element[prop];\r\n }\r\n \r\n \treturn res;\r\n}\r\n\r\narr.map((element) =\u003E pick(element, props));","IsDeferred":false}]}