@cubedelement.com/realty-investor-timeline 5.5.0 → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/src/account/i-user-goal.d.ts +5 -0
  3. package/dist/src/account/user.d.ts +20 -1
  4. package/dist/src/account/user.js +21 -0
  5. package/dist/src/caching/value-cache.js +3 -1
  6. package/dist/src/ledger/ledger-collection.d.ts +4 -0
  7. package/dist/src/ledger/ledger-collection.js +44 -1
  8. package/dist/src/ledger/ledger-item.d.ts +5 -0
  9. package/dist/src/ledger/ledger-item.js +19 -0
  10. package/dist/src/time/default-has-met-goal-or-max-time.js +1 -1
  11. package/dist/src/time/looper.js +1 -1
  12. package/dist/src/utils/data-clone-date.js +1 -1
  13. package/dist/src/utils/get-date-quarter.d.ts +1 -0
  14. package/dist/src/utils/get-date-quarter.js +5 -0
  15. package/package.json +1 -1
  16. package/.github/dependabot.yml +0 -10
  17. package/docs/_media/badge.svg +0 -1
  18. package/docs/account/i-user-goal/index.md +0 -11
  19. package/docs/account/i-user-goal/interfaces/IUserGoal.md +0 -47
  20. package/docs/account/i-user-investor-check/index.md +0 -11
  21. package/docs/account/i-user-investor-check/interfaces/IUserInvestorCheck.md +0 -206
  22. package/docs/account/index.md +0 -31
  23. package/docs/account/user/classes/User.md +0 -312
  24. package/docs/account/user/index.md +0 -15
  25. package/docs/account/user/interfaces/IUser.md +0 -282
  26. package/docs/caching/index.md +0 -19
  27. package/docs/caching/value-cache/classes/ValueCache.md +0 -194
  28. package/docs/caching/value-cache/index.md +0 -15
  29. package/docs/caching/value-cache/interfaces/IValueCache.md +0 -104
  30. package/docs/calculations/can-invest-by-user/functions/canInvestByUser.md +0 -35
  31. package/docs/calculations/can-invest-by-user/index.md +0 -11
  32. package/docs/calculations/cash-on-cash-return/functions/cashOnCashReturn.md +0 -29
  33. package/docs/calculations/cash-on-cash-return/index.md +0 -11
  34. package/docs/calculations/get-cost-down/functions/getCostDown.md +0 -27
  35. package/docs/calculations/get-cost-down/index.md +0 -11
  36. package/docs/calculations/get-cost-down-user-investment-results/functions/getCostDownUserInvestmentResults.md +0 -33
  37. package/docs/calculations/get-cost-down-user-investment-results/index.md +0 -11
  38. package/docs/calculations/get-equity-capture-amount/functions/getEquityCaptureAmount.md +0 -31
  39. package/docs/calculations/get-equity-capture-amount/index.md +0 -11
  40. package/docs/calculations/get-equity-capture-user-investment-results/functions/getEquityCaptureUserInvestmentResults.md +0 -33
  41. package/docs/calculations/get-equity-capture-user-investment-results/index.md +0 -11
  42. package/docs/calculations/get-investment-percent/functions/getInvestmentPercent.md +0 -27
  43. package/docs/calculations/get-investment-percent/index.md +0 -11
  44. package/docs/calculations/get-min-cost-down-by-rule/functions/getMinCostDownByRule.md +0 -25
  45. package/docs/calculations/get-min-cost-down-by-rule/index.md +0 -11
  46. package/docs/calculations/get-monthly-mortgage/functions/getMonthlyMortgage.md +0 -43
  47. package/docs/calculations/get-monthly-mortgage/index.md +0 -11
  48. package/docs/calculations/get-monthly-principal-interest-tax-interest/functions/getMonthlyPrincipalInterestTaxInterest.md +0 -43
  49. package/docs/calculations/get-monthly-principal-interest-tax-interest/index.md +0 -11
  50. package/docs/calculations/get-sell-price-estimate/functions/getSellPriceEstimate.md +0 -33
  51. package/docs/calculations/get-sell-price-estimate/index.md +0 -11
  52. package/docs/calculations/index.md +0 -73
  53. package/docs/calculations/return-on-capital-gain/functions/returnOnCapitalGain.md +0 -31
  54. package/docs/calculations/return-on-capital-gain/index.md +0 -11
  55. package/docs/formatters/currency/functions/default.md +0 -21
  56. package/docs/formatters/currency/index.md +0 -11
  57. package/docs/formatters/index.md +0 -7
  58. package/docs/generators/factory-passive-apartment/functions/generateRentalPassiveApartment.md +0 -35
  59. package/docs/generators/factory-passive-apartment/index.md +0 -11
  60. package/docs/generators/factory-single-family/functions/generateSingleFamily.md +0 -35
  61. package/docs/generators/factory-single-family/index.md +0 -11
  62. package/docs/generators/generate-property/index.md +0 -11
  63. package/docs/generators/generate-property/type-aliases/GenerateProperty.md +0 -37
  64. package/docs/generators/generic-generate-property/functions/genericGenerateProperty.md +0 -35
  65. package/docs/generators/generic-generate-property/index.md +0 -11
  66. package/docs/generators/i-property-entity-options/index.md +0 -11
  67. package/docs/generators/i-property-entity-options/interfaces/IPropertyEntityOptions.md +0 -113
  68. package/docs/generators/index.md +0 -49
  69. package/docs/generators/rental-generator/classes/RentalGenerator.md +0 -248
  70. package/docs/generators/rental-generator/index.md +0 -15
  71. package/docs/generators/rental-generator/interfaces/IRentalGenerator.md +0 -65
  72. package/docs/index/index.md +0 -487
  73. package/docs/index.md +0 -258
  74. package/docs/investments/index.md +0 -85
  75. package/docs/investments/investment-reasons/enumerations/InvestmentReasons.md +0 -119
  76. package/docs/investments/investment-reasons/index.md +0 -11
  77. package/docs/investments/investment-reasons-decorator/functions/InvestmentReasonForHoldRuleTypes.md +0 -25
  78. package/docs/investments/investment-reasons-decorator/functions/InvestmentReasonForPurchaseRuleTypes.md +0 -25
  79. package/docs/investments/investment-reasons-decorator/functions/getInvestmentReasons.md +0 -33
  80. package/docs/investments/investment-reasons-decorator/functions/getInvestmentReasonsForPurchaseTypes.md +0 -25
  81. package/docs/investments/investment-reasons-decorator/index.md +0 -18
  82. package/docs/investments/investment-reasons-decorator/type-aliases/PropertyDecoratorType.md +0 -29
  83. package/docs/investments/reason-to-rule/classes/ReasonToRule.md +0 -263
  84. package/docs/investments/reason-to-rule/index.md +0 -16
  85. package/docs/investments/reason-to-rule/interfaces/IReasonToRule.md +0 -189
  86. package/docs/investments/reason-to-rule/interfaces/IReasonToRuleMeta.md +0 -33
  87. package/docs/investments/rental-investor-validator/classes/RentalInvestorValidator.md +0 -53
  88. package/docs/investments/rental-investor-validator/index.md +0 -15
  89. package/docs/investments/rental-investor-validator/interfaces/IRentalInvestorValidator.md +0 -25
  90. package/docs/investments/user-invest-result/classes/UserInvestResult.md +0 -65
  91. package/docs/investments/user-invest-result/index.md +0 -15
  92. package/docs/investments/user-invest-result/interfaces/IUserInvestResult.md +0 -25
  93. package/docs/investments/user-result-estimates/index.md +0 -11
  94. package/docs/investments/user-result-estimates/type-aliases/UserResultEstimates.md +0 -33
  95. package/docs/ledger/i-ledger-summary/index.md +0 -11
  96. package/docs/ledger/i-ledger-summary/interfaces/ILedgerSummary.md +0 -57
  97. package/docs/ledger/index.md +0 -43
  98. package/docs/ledger/ledger-collection/classes/LedgerCollection.md +0 -425
  99. package/docs/ledger/ledger-collection/index.md +0 -19
  100. package/docs/ledger/ledger-collection/interfaces/ILedgerCollection.md +0 -313
  101. package/docs/ledger/ledger-collection/type-aliases/LedgerItemPredicate.md +0 -25
  102. package/docs/ledger/ledger-item/classes/LedgerItem.md +0 -211
  103. package/docs/ledger/ledger-item/index.md +0 -11
  104. package/docs/ledger/ledger-item-type/enumerations/LedgerItemType.md +0 -57
  105. package/docs/ledger/ledger-item-type/index.md +0 -11
  106. package/docs/loans/i-loan-settings/index.md +0 -11
  107. package/docs/loans/i-loan-settings/interfaces/ILoanSetting.md +0 -33
  108. package/docs/loans/index.md +0 -19
  109. package/docs/loans/loan-settings/enumerations/LoanSettings.md +0 -41
  110. package/docs/loans/loan-settings/index.md +0 -11
  111. package/docs/modules.md +0 -88
  112. package/docs/properties/i-entity-existence/index.md +0 -11
  113. package/docs/properties/i-entity-existence/interfaces/IEntityExistence.md +0 -33
  114. package/docs/properties/i-property-entity/index.md +0 -11
  115. package/docs/properties/i-property-entity/interfaces/IPropertyEntity.md +0 -159
  116. package/docs/properties/i-rental-property-entity/index.md +0 -11
  117. package/docs/properties/i-rental-property-entity/interfaces/IRentalPropertyEntity.md +0 -416
  118. package/docs/properties/index.md +0 -43
  119. package/docs/properties/property-sort/functions/default.md +0 -35
  120. package/docs/properties/property-sort/index.md +0 -11
  121. package/docs/properties/property-type/enumerations/PropertyType.md +0 -33
  122. package/docs/properties/property-type/index.md +0 -11
  123. package/docs/properties/rental-passive-apartment/classes/RentalPassiveApartment.md +0 -558
  124. package/docs/properties/rental-passive-apartment/index.md +0 -11
  125. package/docs/properties/rental-single-family/classes/RentalSingleFamily.md +0 -639
  126. package/docs/properties/rental-single-family/index.md +0 -11
  127. package/docs/rules/eval-type/index.md +0 -11
  128. package/docs/rules/eval-type/type-aliases/EvalType.md +0 -25
  129. package/docs/rules/eval-types/functions/AtLeastOrMore.md +0 -25
  130. package/docs/rules/eval-types/functions/NoMoreThan.md +0 -25
  131. package/docs/rules/eval-types/index.md +0 -12
  132. package/docs/rules/get-enum-type-by-value/functions/getEnumTypeByValue.md +0 -23
  133. package/docs/rules/get-enum-type-by-value/index.md +0 -11
  134. package/docs/rules/get-rules/functions/getRules.md +0 -27
  135. package/docs/rules/get-rules/index.md +0 -11
  136. package/docs/rules/hold-rule-types/enumerations/HoldRuleTypes.md +0 -49
  137. package/docs/rules/hold-rule-types/index.md +0 -11
  138. package/docs/rules/i-rule/index.md +0 -11
  139. package/docs/rules/i-rule/interfaces/IRule.md +0 -41
  140. package/docs/rules/index.md +0 -67
  141. package/docs/rules/purchase-rule-types/enumerations/PurchaseRuleTypes.md +0 -78
  142. package/docs/rules/purchase-rule-types/index.md +0 -11
  143. package/docs/rules/rule-evaluation/classes/RuleEvaluation.md +0 -103
  144. package/docs/rules/rule-evaluation/index.md +0 -15
  145. package/docs/rules/rule-evaluation/interfaces/IRuleEvaluation.md +0 -73
  146. package/docs/time/default-has-met-goal-or-max-time/functions/defaultHasMetGoalOrMaxTime.md +0 -39
  147. package/docs/time/default-has-met-goal-or-max-time/index.md +0 -11
  148. package/docs/time/has-met-goal-or-max-time/index.md +0 -11
  149. package/docs/time/has-met-goal-or-max-time/type-aliases/HasMetGoalOrMaxTime.md +0 -39
  150. package/docs/time/i-historical-property/index.md +0 -11
  151. package/docs/time/i-historical-property/interfaces/IHistoricalProperty.md +0 -25
  152. package/docs/time/i-historical-reason/index.md +0 -11
  153. package/docs/time/i-historical-reason/interfaces/IHistoricalReason.md +0 -25
  154. package/docs/time/i-loop-options/index.md +0 -11
  155. package/docs/time/i-loop-options/interfaces/ILoopOptions.md +0 -71
  156. package/docs/time/i-loop-recursive-options/index.md +0 -11
  157. package/docs/time/i-loop-recursive-options/interfaces/ILoopRecursiveOptions.md +0 -33
  158. package/docs/time/index.md +0 -85
  159. package/docs/time/looper/functions/looper.md +0 -25
  160. package/docs/time/looper/index.md +0 -15
  161. package/docs/time/looper/type-aliases/LooperType.md +0 -25
  162. package/docs/time/movement/functions/movement.md +0 -27
  163. package/docs/time/movement/index.md +0 -11
  164. package/docs/time/simulate/functions/simulate.md +0 -23
  165. package/docs/time/simulate/index.md +0 -16
  166. package/docs/time/simulate/interfaces/IGenOptions.md +0 -163
  167. package/docs/time/simulate/interfaces/ISimulateOptions.md +0 -115
  168. package/docs/time/timeline/classes/Timeline.md +0 -175
  169. package/docs/time/timeline/index.md +0 -15
  170. package/docs/time/timeline/interfaces/ITimeline.md +0 -83
  171. package/docs/time/update-historical-rentals/functions/updateHistoricalRentals.md +0 -41
  172. package/docs/time/update-historical-rentals/index.md +0 -11
  173. package/docs/utils/data-are-same-date/functions/default.md +0 -25
  174. package/docs/utils/data-are-same-date/index.md +0 -11
  175. package/docs/utils/data-clone-date/functions/cloneDateUtc.md +0 -27
  176. package/docs/utils/data-clone-date/index.md +0 -11
  177. package/docs/utils/data-compare-date/functions/default.md +0 -28
  178. package/docs/utils/data-compare-date/index.md +0 -11
  179. package/docs/utils/data-number/functions/randomNumberBetween.md +0 -25
  180. package/docs/utils/data-number/index.md +0 -11
  181. package/docs/utils/data-property-entity/functions/randomPropertyEntity.md +0 -23
  182. package/docs/utils/data-property-entity/index.md +0 -15
  183. package/docs/utils/data-property-entity/type-aliases/RandomPropertyEntity.md +0 -21
  184. package/docs/utils/ensure/functions/ensureArray.md +0 -39
  185. package/docs/utils/ensure/index.md +0 -15
  186. package/docs/utils/ensure/type-aliases/EnsureArrayPredicate.md +0 -29
  187. package/docs/utils/index.md +0 -43
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [5.6.0](https://github.com/kvernon/realty-investor-timeline/compare/v5.5.1...v5.6.0) (2026-01-13)
2
+
3
+
4
+ ### Features
5
+
6
+ * quarterly cash flow ([#74](https://github.com/kvernon/realty-investor-timeline/issues/74)) ([8700a3c](https://github.com/kvernon/realty-investor-timeline/commit/8700a3c889d865cc6f31a61c4a230b046606602c))
7
+
8
+ ## [5.5.1](https://github.com/kvernon/realty-investor-timeline/compare/v5.5.0...v5.5.1) (2026-01-02)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * boundary, date ([#73](https://github.com/kvernon/realty-investor-timeline/issues/73)) ([1ce43db](https://github.com/kvernon/realty-investor-timeline/commit/1ce43db993397760d2e41e207481f7999158282a))
14
+
1
15
  # [5.5.0](https://github.com/kvernon/realty-investor-timeline/compare/v5.4.0...v5.5.0) (2025-12-21)
2
16
 
3
17
 
@@ -8,4 +8,9 @@ export interface IUserGoal {
8
8
  * @param today
9
9
  */
10
10
  metMonthlyGoal(today: Date): boolean;
11
+ /**
12
+ * takes data from a quarterly average cash flow and compares it to the monthly goal. The reason on quarterly is that apartments do distributions quarterly, so you have to spread those out monthly
13
+ * @param today
14
+ */
15
+ metAverageQuarterlyGoal(today: Date): boolean;
11
16
  }
@@ -14,10 +14,15 @@ export interface IUser extends IUserInvestorCheck {
14
14
  */
15
15
  monthlySavedAmount: number;
16
16
  /**
17
- * method used to help determine if you have met your expenses
17
+ * returns your passive income for the year + month date supplied
18
18
  * @param today
19
19
  */
20
20
  getCashFlowMonth(today: Date): number;
21
+ /**
22
+ * returns the cash flow by a quarter. This is ideal when evaluating your distributions that are not monthly.
23
+ * @param today
24
+ */
25
+ getCashFlowQuarter(today: Date): number;
21
26
  clone(): IUser;
22
27
  }
23
28
  export declare class User implements IUser {
@@ -38,6 +43,20 @@ export declare class User implements IUser {
38
43
  * @param today
39
44
  */
40
45
  metMonthlyGoal(today: Date): boolean;
46
+ /**
47
+ * takes data from a quarterly average cash flow and compares it to the monthly goal. The reason on quarterly is that apartments do distributions quarterly, so you have to spread those out monthly
48
+ * @param today
49
+ */
50
+ metAverageQuarterlyGoal(today: Date): boolean;
51
+ /**
52
+ * returns the cash flow by a quarter. This is ideal when evaluating your distributions that are not monthly.
53
+ * @param today
54
+ */
55
+ getCashFlowQuarter(today: Date): number;
56
+ /**
57
+ * returns your passive income for the year + month date supplied
58
+ * @param today
59
+ */
41
60
  getCashFlowMonth(today: Date): number;
42
61
  /**
43
62
  * an amount which the user can save per month after expenses, like, after my pay check I could put this amount into savings
@@ -28,6 +28,27 @@ class User {
28
28
  metMonthlyGoal(today) {
29
29
  return this.getCashFlowMonth(today) >= this.monthlyIncomeAmountGoal;
30
30
  }
31
+ /**
32
+ * takes data from a quarterly average cash flow and compares it to the monthly goal. The reason on quarterly is that apartments do distributions quarterly, so you have to spread those out monthly
33
+ * @param today
34
+ */
35
+ metAverageQuarterlyGoal(today) {
36
+ return this.getCashFlowQuarter(today) >= this.monthlyIncomeAmountGoal;
37
+ }
38
+ /**
39
+ * returns the cash flow by a quarter. This is ideal when evaluating your distributions that are not monthly.
40
+ * @param today
41
+ */
42
+ getCashFlowQuarter(today) {
43
+ if (!this.ledgerCollection) {
44
+ return 0;
45
+ }
46
+ return (0, currency_1.default)(this.ledgerCollection.getAverageCashFlowMonthByQuarter(today));
47
+ }
48
+ /**
49
+ * returns your passive income for the year + month date supplied
50
+ * @param today
51
+ */
31
52
  getCashFlowMonth(today) {
32
53
  if (!this.ledgerCollection) {
33
54
  return 0;
@@ -5,7 +5,9 @@ const getNextExpire = (current, cacheExpireDate, advanceInMonths) => {
5
5
  if (!current) {
6
6
  return cacheExpireDate;
7
7
  }
8
- return new Date(Date.UTC(current.getUTCFullYear(), current.getUTCMonth() + advanceInMonths, 1));
8
+ const date = new Date(Date.UTC(current.getUTCFullYear(), current.getUTCMonth(), 1));
9
+ date.setUTCMonth(date.getUTCMonth() + advanceInMonths);
10
+ return date;
9
11
  };
10
12
  class ValueCache {
11
13
  renewalInMonths;
@@ -11,6 +11,8 @@ export interface ILedgerCollection {
11
11
  filter(pred?: LedgerItemPredicate): LedgerItem[];
12
12
  add(item: LedgerItem | Iterable<LedgerItem>): void;
13
13
  getCashFlowMonth(date?: Date): number;
14
+ getAverageCashFlowMonthByQuarter(date?: Date): number;
15
+ getCashFlowQuarter(date?: Date): number;
14
16
  /**
15
17
  * This method gets the total of savings needed for all properties by x amount of months.
16
18
  * @example
@@ -103,6 +105,8 @@ export declare class LedgerCollection implements ILedgerCollection {
103
105
  */
104
106
  getCashFlowYearAverage(date?: Date): number;
105
107
  getCashFlowMonth(date?: Date): number;
108
+ getAverageCashFlowMonthByQuarter(date?: Date): number;
109
+ getCashFlowQuarter(date?: Date): number;
106
110
  getSummaryMonth(date: Date): ILedgerSummary;
107
111
  getSummaryAnnual(year?: number): ILedgerSummary;
108
112
  getSummariesAnnual(year?: number): ILedgerSummary[];
@@ -10,6 +10,7 @@ const properties_1 = require("../properties");
10
10
  const currency_1 = __importDefault(require("../formatters/currency"));
11
11
  const data_clone_date_1 = require("../utils/data-clone-date");
12
12
  const date_fns_1 = require("date-fns");
13
+ const get_date_quarter_1 = require("../utils/get-date-quarter");
13
14
  class LedgerCollection {
14
15
  collection;
15
16
  getSummaryByType(collection, type) {
@@ -124,6 +125,48 @@ class LedgerCollection {
124
125
  }
125
126
  return this.getSummaryByType(boundary, ledger_item_type_1.LedgerItemType.CashFlow);
126
127
  }
128
+ getAverageCashFlowMonthByQuarter(date) {
129
+ if (this.isEmpty()) {
130
+ return 0;
131
+ }
132
+ if (!date) {
133
+ date = this.collection.last().created;
134
+ }
135
+ const quarter = Math.floor(date.getUTCMonth() / 3);
136
+ const year = date.getUTCFullYear();
137
+ const boundary = this.filter((li) => {
138
+ return li.dateMatchesYearAndQuarter(year, quarter);
139
+ });
140
+ if (boundary.length === 0) {
141
+ return 0;
142
+ }
143
+ const cashFlowItems = boundary.filter((x) => x.typeMatches(ledger_item_type_1.LedgerItemType.CashFlow));
144
+ if (cashFlowItems.length === 0) {
145
+ return 0;
146
+ }
147
+ if (cashFlowItems.length === 0) {
148
+ return 0;
149
+ }
150
+ const firstMonth = cashFlowItems[0].created.getUTCMonth();
151
+ const lastMonth = cashFlowItems[cashFlowItems.length - 1].created.getUTCMonth();
152
+ const monthsWithData = lastMonth - firstMonth + 1;
153
+ const totalCashFlow = this.getCashFlowQuarter(date);
154
+ return totalCashFlow / monthsWithData;
155
+ }
156
+ getCashFlowQuarter(date) {
157
+ if (this.isEmpty()) {
158
+ return 0;
159
+ }
160
+ if (!date) {
161
+ date = this.collection.last().created;
162
+ }
163
+ const quarter = (0, get_date_quarter_1.getDateQuarter)(date);
164
+ const year = date.getUTCFullYear();
165
+ const boundary = this.filter((li) => {
166
+ return li.dateMatchesYearAndQuarter(year, quarter);
167
+ });
168
+ return this.getSummaryByType(boundary, ledger_item_type_1.LedgerItemType.CashFlow);
169
+ }
127
170
  getSummaryMonth(date) {
128
171
  if (!date) {
129
172
  throw new Error('no date supplied');
@@ -181,7 +224,7 @@ class LedgerCollection {
181
224
  return [];
182
225
  }
183
226
  const boundary = year ? this.filter((li) => li.dateMatchesYear(year)) : this.filter();
184
- if (!boundary) {
227
+ if (!boundary || boundary.length === 0) {
185
228
  return [];
186
229
  }
187
230
  const collection = [];
@@ -9,11 +9,16 @@ export declare class LedgerItem {
9
9
  note?: string;
10
10
  constructor(amount?: number, type?: LedgerItemType, created?: Date, note?: string);
11
11
  getMonth(): number;
12
+ /**
13
+ * if one is found, a zero based quarter number, otherwise you'll get -1
14
+ */
15
+ getQuarter(): number;
12
16
  isAmountGreaterThanZero(): boolean;
13
17
  dateMatchesYearAndMonth(today: Date): boolean;
14
18
  dateLessThanOrEqualTo(today: Date): boolean;
15
19
  dateNotGreaterThan(today: Date): boolean;
16
20
  dateMatchesYear(year: number): boolean;
21
+ dateMatchesYearAndQuarter(year: number, quarter: number): boolean;
17
22
  typeMatches(itemType: LedgerItemType): boolean;
18
23
  getYear(): number;
19
24
  clone(): LedgerItem;
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.LedgerItem = void 0;
7
7
  const ledger_item_type_1 = require("./ledger-item-type");
8
8
  const data_compare_date_1 = __importDefault(require("../utils/data-compare-date"));
9
+ const get_date_quarter_1 = require("../utils/get-date-quarter");
9
10
  /**
10
11
  * this is an entry into the account. Think of it as a checking account, and it's simply a transaction line.
11
12
  */
@@ -30,6 +31,15 @@ class LedgerItem {
30
31
  }
31
32
  return this.created.getUTCMonth();
32
33
  }
34
+ /**
35
+ * if one is found, a zero based quarter number, otherwise you'll get -1
36
+ */
37
+ getQuarter() {
38
+ if (!this.created) {
39
+ return -1;
40
+ }
41
+ return (0, get_date_quarter_1.getDateQuarter)(this.created);
42
+ }
33
43
  isAmountGreaterThanZero() {
34
44
  return this.amount > 0;
35
45
  }
@@ -60,6 +70,15 @@ class LedgerItem {
60
70
  }
61
71
  return year === this.created.getUTCFullYear();
62
72
  }
73
+ dateMatchesYearAndQuarter(year, quarter) {
74
+ if (!this.created) {
75
+ return false;
76
+ }
77
+ if (!this.dateMatchesYear(year)) {
78
+ return false;
79
+ }
80
+ return this.getQuarter() === quarter;
81
+ }
63
82
  typeMatches(itemType) {
64
83
  return this.type === itemType;
65
84
  }
@@ -14,7 +14,7 @@ const defaultHasMetGoalOrMaxTime = (start, today, user, maxYears) => {
14
14
  if ((0, date_fns_1.isEqual)(start, today) && !user) {
15
15
  return false;
16
16
  }
17
- if (user && user.metMonthlyGoal(today)) {
17
+ if (user && user.metAverageQuarterlyGoal(today)) {
18
18
  return true;
19
19
  }
20
20
  const maxDate = (0, data_clone_date_1.cloneDateUtc)(start, (date) => {
@@ -42,7 +42,7 @@ const looper = (options, timeline) => {
42
42
  }
43
43
  }
44
44
  }
45
- if (result.user.metMonthlyGoal(result.endDate)) {
45
+ if (result.user.metAverageQuarterlyGoal(result.endDate)) {
46
46
  return result;
47
47
  }
48
48
  //step 3: sell properties
@@ -7,7 +7,7 @@ exports.cloneDateUtc = void 0;
7
7
  * @param [datePredicate]
8
8
  */
9
9
  function cloneDateUtc(date, datePredicate) {
10
- const result = new Date(Date.parse(date.toUTCString()));
10
+ const result = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), 1));
11
11
  result.setUTCDate(1);
12
12
  result.setUTCHours(0);
13
13
  result.setUTCMinutes(0);
@@ -0,0 +1 @@
1
+ export declare const getDateQuarter: (date: Date) => number;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getDateQuarter = void 0;
4
+ const getDateQuarter = (date) => Math.floor(date.getUTCMonth() / 3);
5
+ exports.getDateQuarter = getDateQuarter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cubedelement.com/realty-investor-timeline",
3
- "version": "5.5.0",
3
+ "version": "5.6.0",
4
4
  "description": "A way to determine if and when your expenses would be covered",
5
5
  "main": "./dist/src/index.js",
6
6
  "types": "./dist/src/index.d.ts",
@@ -1,10 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: "npm"
4
- directory: "/"
5
- schedule:
6
- interval: "weekly"
7
- pull-request-branch-name:
8
- separator: "-"
9
- prefix: "feature/"
10
- version: "patch"
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="116" height="20" role="img" aria-label="Coverage: 89.34%"><title>Coverage: 89.34%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="116" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="63" height="20" fill="#555"/><rect x="63" width="53" height="20" fill="#dfb317"/><rect width="116" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="325" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="530">Coverage</text><text x="325" y="140" transform="scale(.1)" fill="#fff" textLength="530">Coverage</text><text aria-hidden="true" x="885" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="430">89.34%</text><text x="885" y="140" transform="scale(.1)" fill="#fff" textLength="430">89.34%</text></g></svg>
@@ -1,11 +0,0 @@
1
- [**@cubedelement.com/realty-investor-timeline**](../../index.md)
2
-
3
- ---
4
-
5
- [@cubedelement.com/realty-investor-timeline](../../modules.md) / account/i-user-goal
6
-
7
- # account/i-user-goal
8
-
9
- ## Interfaces
10
-
11
- - [IUserGoal](interfaces/IUserGoal.md)
@@ -1,47 +0,0 @@
1
- [**@cubedelement.com/realty-investor-timeline**](../../../index.md)
2
-
3
- ---
4
-
5
- [@cubedelement.com/realty-investor-timeline](../../../modules.md) / [account/i-user-goal](../index.md) / IUserGoal
6
-
7
- # Interface: IUserGoal
8
-
9
- Defined in: [account/i-user-goal.ts:3](https://github.com/kvernon/realty-investor-timeline/blob/c7446a8a5576468ac5874a2dd8323180fa97a55b/src/account/i-user-goal.ts#L3)
10
-
11
- ## Extended by
12
-
13
- - [`IUserInvestorCheck`](../../i-user-investor-check/interfaces/IUserInvestorCheck.md)
14
-
15
- ## Properties
16
-
17
- ### monthlyIncomeAmountGoal
18
-
19
- > **monthlyIncomeAmountGoal**: `number`
20
-
21
- Defined in: [account/i-user-goal.ts:7](https://github.com/kvernon/realty-investor-timeline/blob/c7446a8a5576468ac5874a2dd8323180fa97a55b/src/account/i-user-goal.ts#L7)
22
-
23
- used to determine how much you need want for monthly expenses
24
-
25
- ## Methods
26
-
27
- ### metMonthlyGoal()
28
-
29
- > **metMonthlyGoal**(`today`, `properties`): `boolean`
30
-
31
- Defined in: [account/i-user-goal.ts:14](https://github.com/kvernon/realty-investor-timeline/blob/c7446a8a5576468ac5874a2dd8323180fa97a55b/src/account/i-user-goal.ts#L14)
32
-
33
- method used to help determine if you have met your expenses
34
-
35
- #### Parameters
36
-
37
- ##### today
38
-
39
- `Date`
40
-
41
- ##### properties
42
-
43
- [`IRentalPropertyEntity`](../../../properties/i-rental-property-entity/interfaces/IRentalPropertyEntity.md)[]
44
-
45
- #### Returns
46
-
47
- `boolean`
@@ -1,11 +0,0 @@
1
- [**@cubedelement.com/realty-investor-timeline**](../../index.md)
2
-
3
- ---
4
-
5
- [@cubedelement.com/realty-investor-timeline](../../modules.md) / account/i-user-investor-check
6
-
7
- # account/i-user-investor-check
8
-
9
- ## Interfaces
10
-
11
- - [IUserInvestorCheck](interfaces/IUserInvestorCheck.md)
@@ -1,206 +0,0 @@
1
- [**@cubedelement.com/realty-investor-timeline**](../../../index.md)
2
-
3
- ---
4
-
5
- [@cubedelement.com/realty-investor-timeline](../../../modules.md) / [account/i-user-investor-check](../index.md) / IUserInvestorCheck
6
-
7
- # Interface: IUserInvestorCheck
8
-
9
- Defined in: [account/i-user-investor-check.ts:9](https://github.com/kvernon/realty-investor-timeline/blob/c7446a8a5576468ac5874a2dd8323180fa97a55b/src/account/i-user-investor-check.ts#L9)
10
-
11
- ## Extends
12
-
13
- - [`IUserGoal`](../../i-user-goal/interfaces/IUserGoal.md)
14
-
15
- ## Extended by
16
-
17
- - [`IUser`](../../user/interfaces/IUser.md)
18
-
19
- ## Properties
20
-
21
- ### holdRules
22
-
23
- > **holdRules**: [`IRuleEvaluation`](../../../rules/rule-evaluation/interfaces/IRuleEvaluation.md)\<[`HoldRuleTypes`](../../../rules/hold-rule-types/enumerations/HoldRuleTypes.md)\>[]
24
-
25
- Defined in: [account/i-user-investor-check.ts:23](https://github.com/kvernon/realty-investor-timeline/blob/c7446a8a5576468ac5874a2dd8323180fa97a55b/src/account/i-user-investor-check.ts#L23)
26
-
27
- a system to determine how to hold onto the properties the longest. This scenario says as long as it meets 1 rule
28
-
29
- ---
30
-
31
- ### ledgerCollection
32
-
33
- > `readonly` **ledgerCollection**: [`ILedgerCollection`](../../../ledger/ledger-collection/interfaces/ILedgerCollection.md)
34
-
35
- Defined in: [account/i-user-investor-check.ts:13](https://github.com/kvernon/realty-investor-timeline/blob/c7446a8a5576468ac5874a2dd8323180fa97a55b/src/account/i-user-investor-check.ts#L13)
36
-
37
- the collection which is used to keep a balance sheet.
38
-
39
- ---
40
-
41
- ### loanSettings
42
-
43
- > **loanSettings**: [`ILoanSetting`](../../../loans/i-loan-settings/interfaces/ILoanSetting.md)[]
44
-
45
- Defined in: [account/i-user-investor-check.ts:18](https://github.com/kvernon/realty-investor-timeline/blob/c7446a8a5576468ac5874a2dd8323180fa97a55b/src/account/i-user-investor-check.ts#L18)
46
-
47
- a collection of loan settings for how to get a loan for single family or some other kind of property
48
-
49
- ---
50
-
51
- ### monthlyIncomeAmountGoal
52
-
53
- > **monthlyIncomeAmountGoal**: `number`
54
-
55
- Defined in: [account/i-user-goal.ts:7](https://github.com/kvernon/realty-investor-timeline/blob/c7446a8a5576468ac5874a2dd8323180fa97a55b/src/account/i-user-goal.ts#L7)
56
-
57
- used to determine how much you need want for monthly expenses
58
-
59
- #### Inherited from
60
-
61
- [`IUserGoal`](../../i-user-goal/interfaces/IUserGoal.md).[`monthlyIncomeAmountGoal`](../../i-user-goal/interfaces/IUserGoal.md#monthlyincomeamountgoal)
62
-
63
- ---
64
-
65
- ### purchaseRules
66
-
67
- > **purchaseRules**: [`IRuleEvaluation`](../../../rules/rule-evaluation/interfaces/IRuleEvaluation.md)\<[`PurchaseRuleTypes`](../../../rules/purchase-rule-types/enumerations/PurchaseRuleTypes.md)\>[]
68
-
69
- Defined in: [account/i-user-investor-check.ts:60](https://github.com/kvernon/realty-investor-timeline/blob/c7446a8a5576468ac5874a2dd8323180fa97a55b/src/account/i-user-investor-check.ts#L60)
70
-
71
- a system to weed out the properties you don't want. This scenario says as long as it meets 1 rule
72
-
73
- ## Methods
74
-
75
- ### getAvailableSavings()
76
-
77
- > **getAvailableSavings**(`date`, `properties`): `number`
78
-
79
- Defined in: [account/i-user-investor-check.ts:55](https://github.com/kvernon/realty-investor-timeline/blob/c7446a8a5576468ac5874a2dd8323180fa97a55b/src/account/i-user-investor-check.ts#L55)
80
-
81
- should be the total balance - savings, using [getMinimumSavings](IUserInvestorCheck.md#getminimumsavings), for determining monthly cash to save for single family properties
82
-
83
- #### Parameters
84
-
85
- ##### date
86
-
87
- `Date`
88
-
89
- ##### properties
90
-
91
- [`IRentalPropertyEntity`](../../../properties/i-rental-property-entity/interfaces/IRentalPropertyEntity.md)[]
92
-
93
- #### Returns
94
-
95
- `number`
96
-
97
- ---
98
-
99
- ### getMinimumSavings()
100
-
101
- > **getMinimumSavings**(`date`, `properties`): `number`
102
-
103
- Defined in: [account/i-user-investor-check.ts:48](https://github.com/kvernon/realty-investor-timeline/blob/c7446a8a5576468ac5874a2dd8323180fa97a55b/src/account/i-user-investor-check.ts#L48)
104
-
105
- used to retrieve the amount required to keep in savings
106
-
107
- #### Parameters
108
-
109
- ##### date
110
-
111
- `Date`
112
-
113
- ##### properties
114
-
115
- [`IRentalPropertyEntity`](../../../properties/i-rental-property-entity/interfaces/IRentalPropertyEntity.md)[]
116
-
117
- #### Returns
118
-
119
- `number`
120
-
121
- ---
122
-
123
- ### hasMinimumSavings()
124
-
125
- > **hasMinimumSavings**(`date`, `properties`): `boolean`
126
-
127
- Defined in: [account/i-user-investor-check.ts:41](https://github.com/kvernon/realty-investor-timeline/blob/c7446a8a5576468ac5874a2dd8323180fa97a55b/src/account/i-user-investor-check.ts#L41)
128
-
129
- a way to determine if the user has enough money. This is different because with
130
- single family homes, you would have to save a certain amount of monthly mortgage
131
-
132
- #### Parameters
133
-
134
- ##### date
135
-
136
- `Date`
137
-
138
- ##### properties
139
-
140
- [`IRentalPropertyEntity`](../../../properties/i-rental-property-entity/interfaces/IRentalPropertyEntity.md)[]
141
-
142
- #### Returns
143
-
144
- `boolean`
145
-
146
- ---
147
-
148
- ### hasMoneyToInvest()
149
-
150
- > **hasMoneyToInvest**(`date`, `properties`, `contribution`?): `boolean`
151
-
152
- Defined in: [account/i-user-investor-check.ts:33](https://github.com/kvernon/realty-investor-timeline/blob/c7446a8a5576468ac5874a2dd8323180fa97a55b/src/account/i-user-investor-check.ts#L33)
153
-
154
- based upon [getMinimumSavings](IUserInvestorCheck.md#getminimumsavings), it checks to see if there is an amount remaining that can be used along with the [contribution](IUserInvestorCheck.md#contribution).
155
-
156
- #### Parameters
157
-
158
- ##### date
159
-
160
- `Date`
161
-
162
- ##### properties
163
-
164
- [`IRentalPropertyEntity`](../../../properties/i-rental-property-entity/interfaces/IRentalPropertyEntity.md)[]
165
-
166
- ##### contribution?
167
-
168
- `number`
169
-
170
- #### Returns
171
-
172
- `boolean`
173
-
174
- #### Example
175
-
176
- ```ts
177
- availableSavings - contribution >= 0;
178
- ```
179
-
180
- ---
181
-
182
- ### metMonthlyGoal()
183
-
184
- > **metMonthlyGoal**(`today`, `properties`): `boolean`
185
-
186
- Defined in: [account/i-user-goal.ts:14](https://github.com/kvernon/realty-investor-timeline/blob/c7446a8a5576468ac5874a2dd8323180fa97a55b/src/account/i-user-goal.ts#L14)
187
-
188
- method used to help determine if you have met your expenses
189
-
190
- #### Parameters
191
-
192
- ##### today
193
-
194
- `Date`
195
-
196
- ##### properties
197
-
198
- [`IRentalPropertyEntity`](../../../properties/i-rental-property-entity/interfaces/IRentalPropertyEntity.md)[]
199
-
200
- #### Returns
201
-
202
- `boolean`
203
-
204
- #### Inherited from
205
-
206
- [`IUserGoal`](../../i-user-goal/interfaces/IUserGoal.md).[`metMonthlyGoal`](../../i-user-goal/interfaces/IUserGoal.md#metmonthlygoal)
@@ -1,31 +0,0 @@
1
- [**@cubedelement.com/realty-investor-timeline**](../index.md)
2
-
3
- ---
4
-
5
- [@cubedelement.com/realty-investor-timeline](../modules.md) / account
6
-
7
- # account
8
-
9
- ## References
10
-
11
- ### IUser
12
-
13
- Re-exports [IUser](user/interfaces/IUser.md)
14
-
15
- ---
16
-
17
- ### IUserGoal
18
-
19
- Re-exports [IUserGoal](i-user-goal/interfaces/IUserGoal.md)
20
-
21
- ---
22
-
23
- ### IUserInvestorCheck
24
-
25
- Re-exports [IUserInvestorCheck](i-user-investor-check/interfaces/IUserInvestorCheck.md)
26
-
27
- ---
28
-
29
- ### User
30
-
31
- Re-exports [User](user/classes/User.md)