遍历对象数组的对象并搜索值

时间:2019-06-21 09:48:38

标签: angular

在我的angular 7应用程序中,我试图遍历对象数组并在找到任何设置为true的HurdleRate时返回true,否则返回false。如果找到第一个真值,则无需进一步迭代

AllTerms对象包含一个LegalFundClassCommercialViewModel和LegalFundClassSideLetterViewModel数组。

我正在尝试遍历对象,但是注意到它没有遍历整个对象集合。有人可以指出正确的方法

代码

  checkVisibility() {
        let columnCheck: boolean = true;
        for (var i = 0; i < this.LegalFundClasses.AllTerms.length; i++) {
          if (this.LegalFundClasses.AllTerms[i].LegalFundClassCommercialViewModel.HurdleRate === false) {
            return false;
          }
        }
        return columnCheck;
      }

JSON

[{"LegalFundClassCommercialViewModel":{"Description":"Class A (Soft Closed)","AuditSummary":"dmukerji Apr 26, 2019","FeesReviewSummary":"dmukerji Apr 26, 2019","TermsReviewSummary":"dmukerji Nov 29, 2018","ChildRecordExist":true,"Id":10651,"FundId":3640,"FundClassType":1,"CurrencyId":3,"PrimaryCurrencyName":"EUR","OtherCurrencyIds":[{"Id":2,"Name":"Test"}],"OtherCurrencyNames":["USD"],"ManagerStrategyId":null,"ManagerStrategyName":null,"SubVotingId":2,"SubVotingName":"Yes","SubHotIssueId":4,"SubHotIssueName":"No Capital","RedsFrqncyId":11,"RedsFrqncyName":"3rd Anniversary","RedsNoticeDays":90,"NoticeTypeOfDaysId":2,"NoticeTypeOfDaysName":"Calendar","RedemptionComments":null,"LockupTypeId":1,"LockupTypeName":"Rolling","HardDurationMonthsId":null,"HardDurationMonthsName":null,"SoftDurationMonthsId":8,"SoftDurationMonthsName":"36","LockupFees0To12Pct":0,"LockupFees12To24Pct":0,"LockupFees24To36Pct":0,"WebfolioRedsFee":null,"LockupComments":"Following the expiration of the initial Class A Shares lockup, absent a redemption or exchange of such Class A Shares, such Shares will be subject to a new Class A Shares lock-up which will immediately commence on a rolling basis, in each case ending on the redemption day falling in the month of the three-year anniversary of the commencement of such Class A Shares lock up. Class A Shares may be redeemed on the first redemption days falling on the expiration of each New Class A shares lock up without being subject to a redemption fee. Special Redemption Rights where shareholder is permitted to redeem up to 5% of their holding of Shares. See key fund disclosures.                                                                                                    * Investors can redeem upto 5% of their holding at the first anniversary date and thereafter an additional 5% on one of the four redemption dates falling on- January, April, July or October during each 12 month period (i.e year 2 and year 3 of investment). No redemption penalties are applicable. ","ApplyGateDecliningBalance":false,"GateInvestorPct":0,"GateSourceId":1,"GateSourceName":"Fund Gate","GateFundClassPct":50,"IntialProceeds":95,"PaymentInDays":14,"PaymentTypeOfDaysId":1,"PaymentTypeOfDaysName":"Business","HoldbackPercentage":5,"HoldbackPayment":30,"HoldbackTypeOfDaysId":2,"HoldbackTypeOfDaysName":"Calendar","ManagementFeeRate":1.5,"IncentiveFeeRate":18,"RealizationFrequencyId":22,"RealizationFrequencyName":"Every third anniversary","HighWaterMarkId":1,"HighWaterMarkName":"Standard","HurdleRate":false,"HurdleRateBasisId":null,"HurdleRateBasisName":null,"HurdleRatePct":null,"HurdleRateIndexId":null,"HurdleRateIndexName":null,"PreferredReturnRatePct":null,"GpCatchUp":null,"PreferredReturnComments":null,"Clawback":false,"ClawbackPercentage":null,"AssetFeeDiscountTypeId":null,"AssetFeeDiscountTypeName":null,"FeeComments":"The incentive fee is payable at the end of the investor lock-up period. \n","FeeReductionsNegotiated":null,"InvestmentStatusId":1,"LegalParentClassId":null},"LegalFundClassSideLetterViewModel":null},{"LegalFundClassCommercialViewModel":{"Description":"Class B (Soft-Closed)","AuditSummary":"dmukerji Mar 11, 2019","FeesReviewSummary":"dmukerji Mar 11, 2019","TermsReviewSummary":"dmukerji Nov 29, 2018","ChildRecordExist":true,"Id":10656,"FundId":3640,"FundClassType":1,"CurrencyId":3,"PrimaryCurrencyName":"EUR","OtherCurrencyIds":[{"Id":2,"Name":"Test"}],"OtherCurrencyNames":["USD"],"ManagerStrategyId":null,"ManagerStrategyName":null,"SubVotingId":2,"SubVotingName":"Yes","SubHotIssueId":4,"SubHotIssueName":"No Capital","RedsFrqncyId":10,"RedsFrqncyName":"2nd Anniversary","RedsNoticeDays":90,"NoticeTypeOfDaysId":2,"NoticeTypeOfDaysName":"Calendar","RedemptionComments":null,"LockupTypeId":1,"LockupTypeName":"Rolling","HardDurationMonthsId":null,"HardDurationMonthsName":null,"SoftDurationMonthsId":7,"SoftDurationMonthsName":"24","LockupFees0To12Pct":0,"LockupFees12To24Pct":0,"LockupFees24To36Pct":4,"WebfolioRedsFee":null,"LockupComments":"Class B Shares may first be redeemed on redemption day falling in the month of the two-year anniversary of the issue of Class B Shares. In the event that a shareholder requests redemption of Class B Shares on the first redemption day falling on the expiration of the initial Class B Shares, the Fund will charge a redemption fee of 4.00% of the redemption proceeds. Following the expiration of Class B lock-up, absent a redemption or exchange of such Class B Shares, such Shares will be subject to a new Class B lock up which will immediately commence on a rolling basis, in each case ending on the redemption day falling in the month of the two year anniversary of the commencement of such Class B lock-up. Class B may be redeemed on the redemption day failing on the expiration of each New Class B lock-up without being subject to a redemption fee. Special Redemption Rights where shareholder is permitted to redeem up to 5% of their holding of Shares. See key fund disclosures. ","ApplyGateDecliningBalance":false,"GateInvestorPct":0,"GateSourceId":1,"GateSourceName":"Fund Gate","GateFundClassPct":50,"IntialProceeds":95,"PaymentInDays":14,"PaymentTypeOfDaysId":1,"PaymentTypeOfDaysName":"Business","HoldbackPercentage":5,"HoldbackPayment":30,"HoldbackTypeOfDaysId":2,"HoldbackTypeOfDaysName":"Calendar","ManagementFeeRate":1.75,"IncentiveFeeRate":20,"RealizationFrequencyId":21,"RealizationFrequencyName":"Every second anniversary ","HighWaterMarkId":1,"HighWaterMarkName":"Standard","HurdleRate":false,"HurdleRateBasisId":null,"HurdleRateBasisName":null,"HurdleRatePct":null,"HurdleRateIndexId":null,"HurdleRateIndexName":null,"PreferredReturnRatePct":null,"GpCatchUp":null,"PreferredReturnComments":null,"Clawback":false,"ClawbackPercentage":null,"AssetFeeDiscountTypeId":null,"AssetFeeDiscountTypeName":null,"FeeComments":"The incentive fee is payable at the end of the investor lock-up period. \n","FeeReductionsNegotiated":null,"InvestmentStatusId":1,"LegalParentClassId":null},"LegalFundClassSideLetterViewModel":null},{"LegalFundClassCommercialViewModel":{"Description":"Class C (Soft Closed)","AuditSummary":"dmukerji Apr 26, 2019","FeesReviewSummary":"dmukerji Apr 26, 2019","TermsReviewSummary":"","ChildRecordExist":true,"Id":10658,"FundId":3640,"FundClassType":1,"CurrencyId":3,"PrimaryCurrencyName":"EUR","OtherCurrencyIds":[{"Id":2,"Name":"Test"}],"OtherCurrencyNames":["USD"],"ManagerStrategyId":null,"ManagerStrategyName":null,"SubVotingId":2,"SubVotingName":"Yes","SubHotIssueId":4,"SubHotIssueName":"No Capital","RedsFrqncyId":9,"RedsFrqncyName":"Anniversary","RedsNoticeDays":90,"NoticeTypeOfDaysId":2,"NoticeTypeOfDaysName":"Calendar","RedemptionComments":null,"LockupTypeId":1,"LockupTypeName":"Rolling","HardDurationMonthsId":null,"HardDurationMonthsName":null,"SoftDurationMonthsId":5,"SoftDurationMonthsName":"12","LockupFees0To12Pct":6,"LockupFees12To24Pct":4,"LockupFees24To36Pct":null,"WebfolioRedsFee":"12 M,0.06|24 M,0.04|","LockupComments":"Class C Shares may first be redeemed on the redemption day falling in the month of the one-year anniversary of the issue of such shares. In the event the shareholder requests redemption of Class C Shares falling on the expiration of the initial Class C lock-up, the Fund will charge a redemption fee of 6% of the redemption proceeds. Following the expiration of the initial Class C lock-up, absent a redemption or exchange of such Class C Shares, such shares will be subject to a new Class C lock-up which will immediately commence on a rolling basis, in each case ending on the redemption day falling in the month of the anniversary of the commencement of such Class C lock-up. If Class C Shares are redeemed on the redemption day falling on the expiration of the first new Class C lock-up, the Fund will charge a redemption fee of 4% of the redemption proceeds. If Class C Shares are redeemed on the first redemption day falling on the expiration of the second new Class C Shares lock-up or any subsequent new Class C lock-up such Shares may be redeemed without a redemption fee. Special Redemption Rights where shareholder is permitted to redeem up to 5% of their holding of Shares. See key fund disclosures. ","ApplyGateDecliningBalance":false,"GateInvestorPct":0,"GateSourceId":1,"GateSourceName":"Fund Gate","GateFundClassPct":50,"IntialProceeds":95,"PaymentInDays":14,"PaymentTypeOfDaysId":1,"PaymentTypeOfDaysName":"Business","HoldbackPercentage":5,"HoldbackPayment":30,"HoldbackTypeOfDaysId":2,"HoldbackTypeOfDaysName":"Calendar","ManagementFeeRate":2,"IncentiveFeeRate":22,"RealizationFrequencyId":7,"RealizationFrequencyName":"Yearly","HighWaterMarkId":1,"HighWaterMarkName":"Standard","HurdleRate":false,"HurdleRateBasisId":null,"HurdleRateBasisName":null,"HurdleRatePct":null,"HurdleRateIndexId":null,"HurdleRateIndexName":null,"PreferredReturnRatePct":null,"GpCatchUp":null,"PreferredReturnComments":null,"Clawback":false,"ClawbackPercentage":null,"AssetFeeDiscountTypeId":null,"AssetFeeDiscountTypeName":null,"FeeComments":"The incentive fee is payable at the end of the investor lock-up.","FeeReductionsNegotiated":null,"InvestmentStatusId":1,"LegalParentClassId":null},"LegalFundClassSideLetterViewModel":null},{"LegalFundClassCommercialViewModel":{"Description":"Class C Interests (Soft Closed)","AuditSummary":"rmenon Jun 21, 2019","FeesReviewSummary":"","TermsReviewSummary":"","ChildRecordExist":true,"Id":11812,"FundId":7069,"FundClassType":1,"CurrencyId":2,"PrimaryCurrencyName":"USD","OtherCurrencyIds":[{"Id":3,"Name":"Test"}],"OtherCurrencyNames":["EUR"],"ManagerStrategyId":null,"ManagerStrategyName":null,"SubVotingId":3,"SubVotingName":"No","SubHotIssueId":2,"SubHotIssueName":"Investor Discretion","RedsFrqncyId":9,"RedsFrqncyName":"Anniversary","RedsNoticeDays":90,"NoticeTypeOfDaysId":2,"NoticeTypeOfDaysName":"Calendar","RedemptionComments":null,"LockupTypeId":1,"LockupTypeName":"Rolling","HardDurationMonthsId":null,"HardDurationMonthsName":null,"SoftDurationMonthsId":5,"SoftDurationMonthsName":"12","LockupFees0To12Pct":6,"LockupFees12To24Pct":4,"LockupFees24To36Pct":null,"WebfolioRedsFee":"12 M,0.06|24 M,0.04|","LockupComments":"In the event that a Limited Partner requests withdrawal of a Class C Capital Account on the Withdrawal Date falling on the expiration of the Initial Class C Lock-Up, the Partnership will retain an amount equal to 6 per cent of the withdrawal proceeds. Following the expiry of the Initial Class C Lock-Up, absent a withdrawal or exchange of such Class C Capital Account, such Class C Capital Account will be subject to a new Class C Lock-Up which will immediately commence on a rolling basis ending on the Withdrawal Date falling in the month of the anniversary of the commencement of such Initial Class C Lock-Up (each, a \"New Class C Lock-Up\"). If a Class C Capital Account is withdrawn on the Withdrawal Date falling on the expiration of the first New Class C Lock-Up, the Partnership will retain an amount equal to 4 per cent of the withdrawal proceeds. If a Class C Capital Account is withdrawn on the Withdrawal Date falling on the expiration of the second New Class C Lock-Up or any subsequent New Class C Lock-Up, such Capital Account may be withdrawn without being subject to a withdrawal charge.","ApplyGateDecliningBalance":false,"GateInvestorPct":0,"GateSourceId":1,"GateSourceName":"Fund Gate","GateFundClassPct":50,"IntialProceeds":95,"PaymentInDays":14,"PaymentTypeOfDaysId":1,"PaymentTypeOfDaysName":"Business","HoldbackPercentage":5,"HoldbackPayment":30,"HoldbackTypeOfDaysId":2,"HoldbackTypeOfDaysName":"Calendar","ManagementFeeRate":2,"IncentiveFeeRate":22,"RealizationFrequencyId":7,"RealizationFrequencyName":"Yearly","HighWaterMarkId":1,"HighWaterMarkName":"Standard","HurdleRate":true,"HurdleRateBasisId":null,"HurdleRateBasisName":null,"HurdleRatePct":null,"HurdleRateIndexId":null,"HurdleRateIndexName":null,"PreferredReturnRatePct":null,"GpCatchUp":null,"PreferredReturnComments":null,"Clawback":true,"ClawbackPercentage":null,"AssetFeeDiscountTypeId":null,"AssetFeeDiscountTypeName":null,"FeeComments":"The incentive fee is payable at the end of the investor lock-up period. \n","FeeReductionsNegotiated":null,"InvestmentStatusId":1,"LegalParentClassId":null},"LegalFundClassSideLetterViewModel":null},{"LegalFundClassCommercialViewModel":{"Description":"Class A Interests (Soft Closed)","AuditSummary":"dmukerji Apr 26, 2019","FeesReviewSummary":"dmukerji Apr 26, 2019","TermsReviewSummary":"dmukerji Nov 29, 2018","ChildRecordExist":true,"Id":11815,"FundId":7069,"FundClassType":1,"CurrencyId":2,"PrimaryCurrencyName":"USD","OtherCurrencyIds":[{"Id":3,"Name":"Test"}],"OtherCurrencyNames":["EUR"],"ManagerStrategyId":null,"ManagerStrategyName":null,"SubVotingId":3,"SubVotingName":"No","SubHotIssueId":2,"SubHotIssueName":"Investor Discretion","RedsFrqncyId":11,"RedsFrqncyName":"3rd Anniversary","RedsNoticeDays":90,"NoticeTypeOfDaysId":2,"NoticeTypeOfDaysName":"Calendar","RedemptionComments":null,"LockupTypeId":1,"LockupTypeName":"Rolling","HardDurationMonthsId":null,"HardDurationMonthsName":null,"SoftDurationMonthsId":8,"SoftDurationMonthsName":"36","LockupFees0To12Pct":0,"LockupFees12To24Pct":0,"LockupFees24To36Pct":0,"WebfolioRedsFee":null,"LockupComments":" Following the expiration of the initial Class A Shares lockup, absent a redemption or exchange of such Class A Shares, such Shares will be subject to a new Class A Shares lock-up which will immediately commence on a rolling basis, in each case ending on the redemption day falling in the month of the three-year anniversary of the commencement of such Class A Shares lock up. Class A Shares may be redeemed on the first redemption days falling on the expiration of each New Class A shares lock up without being subject to a redemption fee. Special Redemption Rights where shareholder is permitted to redeem up to 5% of their holding of Shares. See key fund disclosures.                                                                                                    * Investors can redeem upto 5% of their holding at the first anniversary date and thereafter an additional 5% on one of the four redemption dates falling on- January, April, July or October during each 12 month period (i.e year 2 and year 3 of investment). No redemption penalties are applicable. ","ApplyGateDecliningBalance":false,"GateInvestorPct":0,"GateSourceId":1,"GateSourceName":"Fund Gate","GateFundClassPct":50,"IntialProceeds":100,"PaymentInDays":14,"PaymentTypeOfDaysId":1,"PaymentTypeOfDaysName":"Business","HoldbackPercentage":5,"HoldbackPayment":30,"HoldbackTypeOfDaysId":2,"HoldbackTypeOfDaysName":"Calendar","ManagementFeeRate":1.5,"IncentiveFeeRate":18,"RealizationFrequencyId":22,"RealizationFrequencyName":"Every third anniversary","HighWaterMarkId":1,"HighWaterMarkName":"Standard","HurdleRate":false,"HurdleRateBasisId":null,"HurdleRateBasisName":null,"HurdleRatePct":null,"HurdleRateIndexId":null,"HurdleRateIndexName":null,"PreferredReturnRatePct":null,"GpCatchUp":null,"PreferredReturnComments":null,"Clawback":false,"ClawbackPercentage":null,"AssetFeeDiscountTypeId":null,"AssetFeeDiscountTypeName":null,"FeeComments":"The incentive fee is payable at the end of the investor lock-up period. \n","FeeReductionsNegotiated":null,"InvestmentStatusId":1,"LegalParentClassId":null},"LegalFundClassSideLetterViewModel":null}]

4 个答案:

答案 0 :(得分:0)

当然,它不会遍历整个对象集合,因为遇到第一个false(y)项时,您的实现将返回false ...

c1$group <- cut(c1$interval, c(seq(min(c1$interval), max(c1$interval), 50), Inf), labels = seq(min(c1$interval), max(c1$interval), 50), include.lowest = TRUE) aggregate(steps~group, c1, sum) 我们检查您提供的JSON时不正确。 this.LegalFundClasses.AllTerms[i].LegalFundClassCommercialViewModel.HurdleRate是集合中项目的类类型,而不是集合中项目的属性。

我可以建议这样:

LegalFundClassCommercialViewModel

遍历checkVisibility() { for (var i = 0; i < this.LegalFundClasses.AllTerms.length; i++) { const term = this.LegalFundClasses.AllTerms[i]; if (term && term.HurdleRate === true) { return true; } } return false; } 集合,并在遇到第一个AllTerms设置为true的项目时立即返回true。否则,当迭代complete集合但尚未执行返回时,将返回false。就像根据您的请求 “如果找到任何设置为true的HurdleRate否则返回true”,否则返回false”

您还可以使用[some] [1]。

HurdleRate

答案 1 :(得分:0)

尝试一下:

const obj = [{"LegalFundClassCommercialViewModel":{"Description":"Class A (Soft Closed)","AuditSummary":"dmukerji Apr 26, 2019","FeesReviewSummary":"dmukerji Apr 26, 2019","TermsReviewSummary":"dmukerji Nov 29, 2018","ChildRecordExist":true,"Id":10651,"FundId":3640,"FundClassType":1,"CurrencyId":3,"PrimaryCurrencyName":"EUR","OtherCurrencyIds":[{"Id":2,"Name":"Test"}],"OtherCurrencyNames":["USD"],"ManagerStrategyId":null,"ManagerStrategyName":null,"SubVotingId":2,"SubVotingName":"Yes","SubHotIssueId":4,"SubHotIssueName":"No Capital","RedsFrqncyId":11,"RedsFrqncyName":"3rd Anniversary","RedsNoticeDays":90,"NoticeTypeOfDaysId":2,"NoticeTypeOfDaysName":"Calendar","RedemptionComments":null,"LockupTypeId":1,"LockupTypeName":"Rolling","HardDurationMonthsId":null,"HardDurationMonthsName":null,"SoftDurationMonthsId":8,"SoftDurationMonthsName":"36","LockupFees0To12Pct":0,"LockupFees12To24Pct":0,"LockupFees24To36Pct":0,"WebfolioRedsFee":null,"LockupComments":"Following the expiration of the initial Class A Shares lockup, absent a redemption or exchange of such Class A Shares, such Shares will be subject to a new Class A Shares lock-up which will immediately commence on a rolling basis, in each case ending on the redemption day falling in the month of the three-year anniversary of the commencement of such Class A Shares lock up. Class A Shares may be redeemed on the first redemption days falling on the expiration of each New Class A shares lock up without being subject to a redemption fee. Special Redemption Rights where shareholder is permitted to redeem up to 5% of their holding of Shares. See key fund disclosures.                                                                                                    * Investors can redeem upto 5% of their holding at the first anniversary date and thereafter an additional 5% on one of the four redemption dates falling on- January, April, July or October during each 12 month period (i.e year 2 and year 3 of investment). No redemption penalties are applicable. ","ApplyGateDecliningBalance":false,"GateInvestorPct":0,"GateSourceId":1,"GateSourceName":"Fund Gate","GateFundClassPct":50,"IntialProceeds":95,"PaymentInDays":14,"PaymentTypeOfDaysId":1,"PaymentTypeOfDaysName":"Business","HoldbackPercentage":5,"HoldbackPayment":30,"HoldbackTypeOfDaysId":2,"HoldbackTypeOfDaysName":"Calendar","ManagementFeeRate":1.5,"IncentiveFeeRate":18,"RealizationFrequencyId":22,"RealizationFrequencyName":"Every third anniversary","HighWaterMarkId":1,"HighWaterMarkName":"Standard","HurdleRate":false,"HurdleRateBasisId":null,"HurdleRateBasisName":null,"HurdleRatePct":null,"HurdleRateIndexId":null,"HurdleRateIndexName":null,"PreferredReturnRatePct":null,"GpCatchUp":null,"PreferredReturnComments":null,"Clawback":false,"ClawbackPercentage":null,"AssetFeeDiscountTypeId":null,"AssetFeeDiscountTypeName":null,"FeeComments":"The incentive fee is payable at the end of the investor lock-up period. \n","FeeReductionsNegotiated":null,"InvestmentStatusId":1,"LegalParentClassId":null},"LegalFundClassSideLetterViewModel":null},{"LegalFundClassCommercialViewModel":{"Description":"Class B (Soft-Closed)","AuditSummary":"dmukerji Mar 11, 2019","FeesReviewSummary":"dmukerji Mar 11, 2019","TermsReviewSummary":"dmukerji Nov 29, 2018","ChildRecordExist":true,"Id":10656,"FundId":3640,"FundClassType":1,"CurrencyId":3,"PrimaryCurrencyName":"EUR","OtherCurrencyIds":[{"Id":2,"Name":"Test"}],"OtherCurrencyNames":["USD"],"ManagerStrategyId":null,"ManagerStrategyName":null,"SubVotingId":2,"SubVotingName":"Yes","SubHotIssueId":4,"SubHotIssueName":"No Capital","RedsFrqncyId":10,"RedsFrqncyName":"2nd Anniversary","RedsNoticeDays":90,"NoticeTypeOfDaysId":2,"NoticeTypeOfDaysName":"Calendar","RedemptionComments":null,"LockupTypeId":1,"LockupTypeName":"Rolling","HardDurationMonthsId":null,"HardDurationMonthsName":null,"SoftDurationMonthsId":7,"SoftDurationMonthsName":"24","LockupFees0To12Pct":0,"LockupFees12To24Pct":0,"LockupFees24To36Pct":4,"WebfolioRedsFee":null,"LockupComments":"Class B Shares may first be redeemed on redemption day falling in the month of the two-year anniversary of the issue of Class B Shares. In the event that a shareholder requests redemption of Class B Shares on the first redemption day falling on the expiration of the initial Class B Shares, the Fund will charge a redemption fee of 4.00% of the redemption proceeds. Following the expiration of Class B lock-up, absent a redemption or exchange of such Class B Shares, such Shares will be subject to a new Class B lock up which will immediately commence on a rolling basis, in each case ending on the redemption day falling in the month of the two year anniversary of the commencement of such Class B lock-up. Class B may be redeemed on the redemption day failing on the expiration of each New Class B lock-up without being subject to a redemption fee. Special Redemption Rights where shareholder is permitted to redeem up to 5% of their holding of Shares. See key fund disclosures. ","ApplyGateDecliningBalance":false,"GateInvestorPct":0,"GateSourceId":1,"GateSourceName":"Fund Gate","GateFundClassPct":50,"IntialProceeds":95,"PaymentInDays":14,"PaymentTypeOfDaysId":1,"PaymentTypeOfDaysName":"Business","HoldbackPercentage":5,"HoldbackPayment":30,"HoldbackTypeOfDaysId":2,"HoldbackTypeOfDaysName":"Calendar","ManagementFeeRate":1.75,"IncentiveFeeRate":20,"RealizationFrequencyId":21,"RealizationFrequencyName":"Every second anniversary ","HighWaterMarkId":1,"HighWaterMarkName":"Standard","HurdleRate":false,"HurdleRateBasisId":null,"HurdleRateBasisName":null,"HurdleRatePct":null,"HurdleRateIndexId":null,"HurdleRateIndexName":null,"PreferredReturnRatePct":null,"GpCatchUp":null,"PreferredReturnComments":null,"Clawback":false,"ClawbackPercentage":null,"AssetFeeDiscountTypeId":null,"AssetFeeDiscountTypeName":null,"FeeComments":"The incentive fee is payable at the end of the investor lock-up period. \n","FeeReductionsNegotiated":null,"InvestmentStatusId":1,"LegalParentClassId":null},"LegalFundClassSideLetterViewModel":null},{"LegalFundClassCommercialViewModel":{"Description":"Class C (Soft Closed)","AuditSummary":"dmukerji Apr 26, 2019","FeesReviewSummary":"dmukerji Apr 26, 2019","TermsReviewSummary":"","ChildRecordExist":true,"Id":10658,"FundId":3640,"FundClassType":1,"CurrencyId":3,"PrimaryCurrencyName":"EUR","OtherCurrencyIds":[{"Id":2,"Name":"Test"}],"OtherCurrencyNames":["USD"],"ManagerStrategyId":null,"ManagerStrategyName":null,"SubVotingId":2,"SubVotingName":"Yes","SubHotIssueId":4,"SubHotIssueName":"No Capital","RedsFrqncyId":9,"RedsFrqncyName":"Anniversary","RedsNoticeDays":90,"NoticeTypeOfDaysId":2,"NoticeTypeOfDaysName":"Calendar","RedemptionComments":null,"LockupTypeId":1,"LockupTypeName":"Rolling","HardDurationMonthsId":null,"HardDurationMonthsName":null,"SoftDurationMonthsId":5,"SoftDurationMonthsName":"12","LockupFees0To12Pct":6,"LockupFees12To24Pct":4,"LockupFees24To36Pct":null,"WebfolioRedsFee":"12 M,0.06|24 M,0.04|","LockupComments":"Class C Shares may first be redeemed on the redemption day falling in the month of the one-year anniversary of the issue of such shares. In the event the shareholder requests redemption of Class C Shares falling on the expiration of the initial Class C lock-up, the Fund will charge a redemption fee of 6% of the redemption proceeds. Following the expiration of the initial Class C lock-up, absent a redemption or exchange of such Class C Shares, such shares will be subject to a new Class C lock-up which will immediately commence on a rolling basis, in each case ending on the redemption day falling in the month of the anniversary of the commencement of such Class C lock-up. If Class C Shares are redeemed on the redemption day falling on the expiration of the first new Class C lock-up, the Fund will charge a redemption fee of 4% of the redemption proceeds. If Class C Shares are redeemed on the first redemption day falling on the expiration of the second new Class C Shares lock-up or any subsequent new Class C lock-up such Shares may be redeemed without a redemption fee. Special Redemption Rights where shareholder is permitted to redeem up to 5% of their holding of Shares. See key fund disclosures. ","ApplyGateDecliningBalance":false,"GateInvestorPct":0,"GateSourceId":1,"GateSourceName":"Fund Gate","GateFundClassPct":50,"IntialProceeds":95,"PaymentInDays":14,"PaymentTypeOfDaysId":1,"PaymentTypeOfDaysName":"Business","HoldbackPercentage":5,"HoldbackPayment":30,"HoldbackTypeOfDaysId":2,"HoldbackTypeOfDaysName":"Calendar","ManagementFeeRate":2,"IncentiveFeeRate":22,"RealizationFrequencyId":7,"RealizationFrequencyName":"Yearly","HighWaterMarkId":1,"HighWaterMarkName":"Standard","HurdleRate":false,"HurdleRateBasisId":null,"HurdleRateBasisName":null,"HurdleRatePct":null,"HurdleRateIndexId":null,"HurdleRateIndexName":null,"PreferredReturnRatePct":null,"GpCatchUp":null,"PreferredReturnComments":null,"Clawback":false,"ClawbackPercentage":null,"AssetFeeDiscountTypeId":null,"AssetFeeDiscountTypeName":null,"FeeComments":"The incentive fee is payable at the end of the investor lock-up.","FeeReductionsNegotiated":null,"InvestmentStatusId":1,"LegalParentClassId":null},"LegalFundClassSideLetterViewModel":null},{"LegalFundClassCommercialViewModel":{"Description":"Class C Interests (Soft Closed)","AuditSummary":"rmenon Jun 21, 2019","FeesReviewSummary":"","TermsReviewSummary":"","ChildRecordExist":true,"Id":11812,"FundId":7069,"FundClassType":1,"CurrencyId":2,"PrimaryCurrencyName":"USD","OtherCurrencyIds":[{"Id":3,"Name":"Test"}],"OtherCurrencyNames":["EUR"],"ManagerStrategyId":null,"ManagerStrategyName":null,"SubVotingId":3,"SubVotingName":"No","SubHotIssueId":2,"SubHotIssueName":"Investor Discretion","RedsFrqncyId":9,"RedsFrqncyName":"Anniversary","RedsNoticeDays":90,"NoticeTypeOfDaysId":2,"NoticeTypeOfDaysName":"Calendar","RedemptionComments":null,"LockupTypeId":1,"LockupTypeName":"Rolling","HardDurationMonthsId":null,"HardDurationMonthsName":null,"SoftDurationMonthsId":5,"SoftDurationMonthsName":"12","LockupFees0To12Pct":6,"LockupFees12To24Pct":4,"LockupFees24To36Pct":null,"WebfolioRedsFee":"12 M,0.06|24 M,0.04|","LockupComments":"In the event that a Limited Partner requests withdrawal of a Class C Capital Account on the Withdrawal Date falling on the expiration of the Initial Class C Lock-Up, the Partnership will retain an amount equal to 6 per cent of the withdrawal proceeds. Following the expiry of the Initial Class C Lock-Up, absent a withdrawal or exchange of such Class C Capital Account, such Class C Capital Account will be subject to a new Class C Lock-Up which will immediately commence on a rolling basis ending on the Withdrawal Date falling in the month of the anniversary of the commencement of such Initial Class C Lock-Up (each, a \"New Class C Lock-Up\"). If a Class C Capital Account is withdrawn on the Withdrawal Date falling on the expiration of the first New Class C Lock-Up, the Partnership will retain an amount equal to 4 per cent of the withdrawal proceeds. If a Class C Capital Account is withdrawn on the Withdrawal Date falling on the expiration of the second New Class C Lock-Up or any subsequent New Class C Lock-Up, such Capital Account may be withdrawn without being subject to a withdrawal charge.","ApplyGateDecliningBalance":false,"GateInvestorPct":0,"GateSourceId":1,"GateSourceName":"Fund Gate","GateFundClassPct":50,"IntialProceeds":95,"PaymentInDays":14,"PaymentTypeOfDaysId":1,"PaymentTypeOfDaysName":"Business","HoldbackPercentage":5,"HoldbackPayment":30,"HoldbackTypeOfDaysId":2,"HoldbackTypeOfDaysName":"Calendar","ManagementFeeRate":2,"IncentiveFeeRate":22,"RealizationFrequencyId":7,"RealizationFrequencyName":"Yearly","HighWaterMarkId":1,"HighWaterMarkName":"Standard","HurdleRate":true,"HurdleRateBasisId":null,"HurdleRateBasisName":null,"HurdleRatePct":null,"HurdleRateIndexId":null,"HurdleRateIndexName":null,"PreferredReturnRatePct":null,"GpCatchUp":null,"PreferredReturnComments":null,"Clawback":true,"ClawbackPercentage":null,"AssetFeeDiscountTypeId":null,"AssetFeeDiscountTypeName":null,"FeeComments":"The incentive fee is payable at the end of the investor lock-up period. \n","FeeReductionsNegotiated":null,"InvestmentStatusId":1,"LegalParentClassId":null},"LegalFundClassSideLetterViewModel":null},{"LegalFundClassCommercialViewModel":{"Description":"Class A Interests (Soft Closed)","AuditSummary":"dmukerji Apr 26, 2019","FeesReviewSummary":"dmukerji Apr 26, 2019","TermsReviewSummary":"dmukerji Nov 29, 2018","ChildRecordExist":true,"Id":11815,"FundId":7069,"FundClassType":1,"CurrencyId":2,"PrimaryCurrencyName":"USD","OtherCurrencyIds":[{"Id":3,"Name":"Test"}],"OtherCurrencyNames":["EUR"],"ManagerStrategyId":null,"ManagerStrategyName":null,"SubVotingId":3,"SubVotingName":"No","SubHotIssueId":2,"SubHotIssueName":"Investor Discretion","RedsFrqncyId":11,"RedsFrqncyName":"3rd Anniversary","RedsNoticeDays":90,"NoticeTypeOfDaysId":2,"NoticeTypeOfDaysName":"Calendar","RedemptionComments":null,"LockupTypeId":1,"LockupTypeName":"Rolling","HardDurationMonthsId":null,"HardDurationMonthsName":null,"SoftDurationMonthsId":8,"SoftDurationMonthsName":"36","LockupFees0To12Pct":0,"LockupFees12To24Pct":0,"LockupFees24To36Pct":0,"WebfolioRedsFee":null,"LockupComments":" Following the expiration of the initial Class A Shares lockup, absent a redemption or exchange of such Class A Shares, such Shares will be subject to a new Class A Shares lock-up which will immediately commence on a rolling basis, in each case ending on the redemption day falling in the month of the three-year anniversary of the commencement of such Class A Shares lock up. Class A Shares may be redeemed on the first redemption days falling on the expiration of each New Class A shares lock up without being subject to a redemption fee. Special Redemption Rights where shareholder is permitted to redeem up to 5% of their holding of Shares. See key fund disclosures.                                                                                                    * Investors can redeem upto 5% of their holding at the first anniversary date and thereafter an additional 5% on one of the four redemption dates falling on- January, April, July or October during each 12 month period (i.e year 2 and year 3 of investment). No redemption penalties are applicable. ","ApplyGateDecliningBalance":false,"GateInvestorPct":0,"GateSourceId":1,"GateSourceName":"Fund Gate","GateFundClassPct":50,"IntialProceeds":100,"PaymentInDays":14,"PaymentTypeOfDaysId":1,"PaymentTypeOfDaysName":"Business","HoldbackPercentage":5,"HoldbackPayment":30,"HoldbackTypeOfDaysId":2,"HoldbackTypeOfDaysName":"Calendar","ManagementFeeRate":1.5,"IncentiveFeeRate":18,"RealizationFrequencyId":22,"RealizationFrequencyName":"Every third anniversary","HighWaterMarkId":1,"HighWaterMarkName":"Standard","HurdleRate":false,"HurdleRateBasisId":null,"HurdleRateBasisName":null,"HurdleRatePct":null,"HurdleRateIndexId":null,"HurdleRateIndexName":null,"PreferredReturnRatePct":null,"GpCatchUp":null,"PreferredReturnComments":null,"Clawback":false,"ClawbackPercentage":null,"AssetFeeDiscountTypeId":null,"AssetFeeDiscountTypeName":null,"FeeComments":"The incentive fee is payable at the end of the investor lock-up period. \n","FeeReductionsNegotiated":null,"InvestmentStatusId":1,"LegalParentClassId":null},"LegalFundClassSideLetterViewModel":null}]

for(let o of obj) {
      let LegalFundClassCommercialViewModel = o['LegalFundClassCommercialViewModel'];

      let LegalFundClassSideLetterViewModel = o['LegalFundClassSideLetterViewModel'];

     if(check(LegalFundClassSideLetterViewModel) === true || check(LegalFundClassCommercialViewModel) === true){ 
        return true
     }



}


check(obj) {
    for(let prop in obj){
       if(prop == "HurdleRate" && obj[prop] === true) {
           return true
       }
    }

答案 2 :(得分:0)

也许您正在寻找类似的东西?

if(typeof(this.LegalFundClasses.AllTerms.find(item => item.LegalFundClassCommercialViewModel.HurdleRate === true)) === 'undefined'){
      console.log("nothing found");
    } else {
      console.log("found true value");
    }

答案 3 :(得分:0)

代码的问题是,一旦发现数组中元素之一的import os mydir = os.getcwd() # would be the MAIN folder mydir_tmp = mydir + "\Experiment_1 - 40kmh" # add the first experiment folder name mydir_new = os.chdir(mydir_tmp) # change the current working directory mydir = os.getcwd() # set the main directory again import Run_file mydir = os.getcwd() # would be the MAIN folder mydir_tmp = mydir + "/Experiment_1 - 60kmh" # add the second experiment folder name mydir_new = os.chdir(mydir_tmp) # change the current working directory mydir = os.getcwd() # set the main directory again import Run_file 为假,就立即返回false。正确的方法就是这样。

HurdleRate

可以使用checkVisibility() { for (var i = 0; i < this.LegalFundClasses.AllTerms.length; i++) { if ((this.LegalFundClasses.AllTerms[i].LegalFundClassCommercialViewModel || this.LegalFundClasses.AllTerms[i].LegalFundClassSideLetterViewModel).HurdleRate) { return true; } } return false; } 这样的方法进一步简化此代码。代码的作用是找到find为真的元素,如果有任何匹配条件的函数返回HurdleRate,如果没有匹配条件的函数返回true

false

希望这可以解决您的问题。