[英]Destructure nested object with array
StripeId{
customAttributes[{
0: {customAttributeId: '1', dataType: 'text', id: null, name: "test", typeName: 'VALUE'}
1: {customAttributeId: '2', dataType: 'text', id: null, name: testing, typeName: 'VALUE'}
2: {customAttributeId: '3', dataType: 'text', id: null, name: test over, typeName: 'VALUE'}
}]
}
我想解构上面的对象,我需要拉出名称为“test over”的数组对象。
const {customAttributes} = StripeId;
const [firstItem: {customAttributeId, dataType, id, name, typeName}, secondItem, ...remainingItemsArr] = customAttributes;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.