{"ScriptPreparationCode":null,"TestCases":[{"Name":"reducing-to-value","Code":"const arr = [\r\n {\r\n \ttype: \u0022element\u0022,\r\n attributes: [\r\n {\r\n key: \u0022aid\u0022,\r\n\t\tvalue: \u0022215-001-01\u0022\r\n },\r\n {\r\n \tkey: \u0022class\u0022,\r\n\t\tvalue: \u0022mug-card-4\u0022\r\n }\r\n ]\r\n },\r\n {\r\n \ttype: \u0022element\u0022,\r\n attributes: [\r\n {\r\n \tkey: \u0022aid\u0022,\r\n\t\tvalue: \u0022215-001-02\u0022\r\n },\r\n {\r\n \tkey: \u0022class\u0022,\r\n\t\tvalue: \u0022mug-card-4\u0022\r\n }\r\n ]\r\n },\r\n];\r\n\r\nlet reduced = arr.reduce((prev,curr) =\u003E {\r\n\treturn curr.key === \u0022aid\u0022 ? curr : prev\r\n}, null)\r\n","IsDeferred":false},{"Name":"find-value","Code":"const arr = [\r\n {\r\n \ttype: \u0022element\u0022,\r\n attributes: [\r\n {\r\n key: \u0022aid\u0022,\r\n\t\tvalue: \u0022215-001-01\u0022\r\n },\r\n {\r\n \tkey: \u0022class\u0022,\r\n\t\tvalue: \u0022mug-card-4\u0022\r\n }\r\n ]\r\n },\r\n {\r\n \ttype: \u0022element\u0022,\r\n attributes: [\r\n {\r\n \tkey: \u0022aid\u0022,\r\n\t\tvalue: \u0022215-001-02\u0022\r\n },\r\n {\r\n \tkey: \u0022class\u0022,\r\n\t\tvalue: \u0022mug-card-4\u0022\r\n }\r\n ]\r\n },\r\n];\r\n\r\nlet found = arr.find((ele) =\u003E {\r\n\treturn ele.key === \u0022aid\u0022 ? ele : null\r\n})\r\n","IsDeferred":false}]}