Добрый день,
У меня есть два массива.Один с всеми значениями , а другой с идентификаторами , который я хочу отфильтровать в первом массиве и отделить значения в объекте.
Пример:
Массив со всеми значениями
const ArrayTodosOsValores = [
{
"ric": "B3SA3.SA",
"category": 3,
"categoryString": "Equity",
"arcCode": "",
"description": "B3 BRASIL BALCAO ORD BAG",
"ticker": "B3SA3",
"isin": "BRB3SAACNOR6",
"cusip": "",
"exchange": "BOV",
"country": "BR",
"instrType": 12,
"ricRoot": "0 # .BVSP",
"hasChain": true,
"useChain": false,
"identifierTypeFound": "Ric",
"historyMonths": 3
},
{
"ric": "BBAS3.SA",
"category": 3,
"categoryString": "Equity",
"arcCode": "",
"description": "BANCO DO BRASIL ORD",
"ticker": "BBAS3",
"isin": "BRBBASACNOR3",
"cusip": "",
"exchange": "BOV",
"country": "BR",
"instrType": 12,
"ricRoot": "0 # .BVSP",
"hasChain": true,
"useChain": false,
"identifierTypeFound": "Ric",
"historyMonths": 3
},
{
"ric": "1ZEG1",
"category": 1,
"categoryString": "Derivatives",
"arcCode": "",
"description": "ETHANOL FEB1",
"ticker": "EH",
"isin": "",
"cusip": "",
"exchange": "CBT",
"country": "US",
"instrType": 9,
"ricRoot": "0 # 1ZE:",
"hasChain": true,
"useChain": false,
"identifierTypeFound": "Ric",
"historyMonths": 3
},
{
"ric": "1ZEG9",
"category": 1,
"categoryString": "Derivatives",
"arcCode": "",
"description": "ETHANOL FEB9",
"ticker": "EH",
"isin": "",
"cusip": "",
"exchange": "CBT",
"country": "US",
"instrType": 9,
"ricRoot": "0 # 1ZE:",
"hasChain": true,
"useChain": false,
"identifierTypeFound": "Ric",
"historyMonths": 3
},
]
Массив идентификаторов
const arrayIdentifiers = ["0 # .BVSP", "0 # 1ZE:"]
Как сделать ArrayAllSettings для фильтрации через свойство ricRoot со значениями arrayIdentifiers , что приводит кследующий объект:
const result = {
0 # .BVSP: [
{
"ric": "B3SA3.SA",
"category": 3,
"categoryString": "Equity",
"arcCode": "",
"description": "B3 BRASIL BALCAO ORD BAG",
"ticker": "B3SA3",
"isin": "BRB3SAACNOR6",
"cusip": "",
"exchange": "BOV",
"country": "BR",
"instrType": 12,
"ricRoot": "0 # .BVSP",
"hasChain": true,
"useChain": false,
"identifierTypeFound": "Ric",
"historyMonths": 3
},
{
"ric": "BBAS3.SA",
"category": 3,
"categoryString": "Equity",
"arcCode": "",
"description": "BANCO DO BRASIL ORD",
"ticker": "BBAS3",
"isin": "BRBBASACNOR3",
"cusip": "",
"exchange": "BOV",
"country": "BR",
"instrType": 12,
"ricRoot": "0 # .BVSP",
"hasChain": true,
"useChain": false,
"identifierTypeFound": "Ric",
"historyMonths": 3
}],
0 # 1ZE: [
{
"ric": "1ZEG1",
"category": 1,
"categoryString": "Derivatives",
"arcCode": "",
"description": "ETHANOL FEB1",
"ticker": "EH",
"isin": "",
"cusip": "",
"exchange": "CBT",
"country": "US",
"instrType": 9,
"ricRoot": "0 # 1ZE:",
"hasChain": true,
"useChain": false,
"identifierTypeFound": "Ric",
"historyMonths": 3
},
{
"ric": "1ZEG9",
"category": 1,
"categoryString": "Derivatives",
"arcCode": "",
"description": "ETHANOL FEB9",
"ticker": "EH",
"isin": "",
"cusip": "",
"exchange": "CBT",
"country": "US",
"instrType": 9,
"ricRoot": "0 # 1ZE:",
"hasChain": true,
"useChain": false,
"identifierTypeFound": "Ric",
"historyMonths": 3
},
]
}
Как я могу это сделать?Спасибо.