亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何獲取導出數組的值

如何獲取導出數組的值

大話西游666 2022-10-27 10:44:15
我有以下由 DocuSign API 生成的數組:const signers = [  exports {    email: '[email protected]',    name: 'Test Name One',    recipientId: 'signer_1',    routingOrder: '1'  },  exports {    email: '[email protected]',    name: 'Test Name Two',    recipientId: 'signer_2',    routingOrder: '2'  },  exports {    email: '[email protected]',    name: 'Test Name Three',    recipientId: 'signer_3',    routingOrder: '3'  }]我需要在此數組中獲取對象的索引,其中 recipientId === 'signer_2' (例如),并嘗試了以下操作:const signerKey = signers.filter(signerObj => {  console.log(signerObj) // returns "exports { ...email, name, etc }"  console.log(Object.keys[signerObj]) // returns undefined  console.log(signerObj.exports.recipientId) // returns undefined  console.log(typeof signerObj) // returns object  return signerObj.recipientId === 'signer_2' // returns undefined})exports由于它們不是實際對象,我該如何處理在其中查找數據?
查看完整描述

1 回答

?
至尊寶的傳說

TA貢獻1789條經驗 獲得超10個贊

出于某種原因,當我使用 JSON.stringify() 然后 JSON.parse 我能夠正常處理所有內容:


const stringified = JSON.stringify(signers)

const signersObject = JSON.parse(stringified)

@casenonsensitive 推薦使用我還沒有研究過的 lo-dash 框架,但它可能是一個更好的解決方案。


查看完整回答
反對 回復 2022-10-27
  • 1 回答
  • 0 關注
  • 105 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號