Options
All
  • Public
  • Public/Protected
  • All
Menu

A particular scenario.

Hierarchy

Implements

Index

Constructors

constructor

  • new Scenario(row: IScenario, dataset: RowType<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">[], end_year: Year): Scenario

Properties

Private Optional #temporal

#temporal?: Temporal<ItemImpl<"scenario">> = undefined

allItems

allItems: AllItems

asset_list

asset_list: IFAsset[]

A list of Asset. See also assets.

assets

A lookup table of Asset for convenient lookup by name. See also asset_list.

Readonly byId

byId: {} = {}

Type declaration

Readonly categories

categories: Category[]

Readonly data

data: RowType<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">[]

Optional Readonly end

end?: boolean

expense_list

expense_list: IFExpense[]

A list of Expense. See also expenses.

expenses

A lookup table of Expense for convenient lookup by name. See also expense_list.

Readonly id

id: `scenario/${string}`

incomeStream_list

incomeStream_list: IFIncomeStream[]

A list of IncomeStream. See also incomeStreams.

incomeStreams

incomeStreams: NamedIndex<IFIncomeStream>

A lookup table of IncomeStream for convenient lookup by name. See also incomeStream_list.

income_list

income_list: IFIncome[]

A list of Income. See also incomes.

incomes

A lookup table of Income for convenient lookup by name. See also income_list.

liabilities

liabilities: NamedIndex<IFLiability>

A lookup table of {@link Loan} for convenient lookup by name. See also {@link loan_list}.

liability_list

liability_list: IFLiability[]

A list of {@link Loan}. See also {@link loans}.

Readonly name

name: string

Optional notes

notes?: string

Readonly people

A lookup table of Person by name.

prettyName

prettyName: string

Readonly scenario

scenario: IFScenario

Readonly scenarios

scenarios: string[]

sort

sort: number & ((cmp?: (a: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, b: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">) => number) => ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">[])

Sort order

spouse1

spouse1: IFPerson

spouse2

spouse2: null | IFPerson

Readonly start

start: Date

tax_list

tax_list: IFIncomeTax[]

A list of IncomeTax. See also taxes.

taxes

A lookup table of IncomeTax for convenient lookup by name. See also tax_list.

text_list

text_list: IFText[]

List of text messages

texts

A lookup table of IncomeTax for convenient lookup by name. See also tax_list.

Readonly type

type: "scenario"

Static construct

construct: <T>(items: RowType<T>[], type: T, dataset: RowType<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">[] | Scenario, end_year: Year) => ItemType<T>

Type declaration

    • <T>(items: RowType<T>[], type: T, dataset: RowType<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">[] | Scenario, end_year: Year): ItemType<T>
    • Construct an item from a row object

      Type parameters

      • T: "asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario"

      Parameters

      • items: RowType<T>[]
      • type: T

        The type of item (defaulted from the item)

      • dataset: RowType<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">[] | Scenario
      • end_year: Year

      Returns ItemType<T>

      the constructed instance.

Static scenarios

scenarios: NamedIndex<Scenario> = {}

Accessors

[toStringTag]

  • get [toStringTag](): string

dateRange

  • get dateRange(): [start: Date, end: Date]
  • Returns [start: Date, end: Date]

net_assets

person_list

sources

  • Get the sources of income for potential income streams. This does not include loans; if borrowing is part of the strategy, as in a revolving line of credit or a reverse mortgage, use an Asset with negative balance.

    Returns (IFAsset | IFIncome)[]

temporal

total_expenses

  • get total_expenses(): Money

total_retirement_income

  • get total_retirement_income(): Money

total_retirement_income_with_fixed

  • get total_retirement_income_with_fixed(): Money

Methods

Private #construct_item

  • #construct_item<T>(name: string, type: T): null | ItemType<T>
  • Type parameters

    • T: "asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario"

    Parameters

    • name: string
    • type: T

    Returns null | ItemType<T>

Private #construct_items

  • #construct_items<T>(type: T, all?: boolean): ItemType<T>[]
  • Type parameters

    • T: "asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario"

    Parameters

    • type: T
    • all: boolean = false

    Returns ItemType<T>[]

Private #construct_spouse

  • #construct_spouse(name: string): null | IFPerson

[iterator]

  • [iterator](): EnhancedGenerator<ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, unknown, unknown>

asArray

  • asArray(): ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">[]
  • Return all of the values from this generator as an array. You do not want to call this on an infinite generator (for obvious reasons); consider using IEnhancements.slice or IEnhancements.limit to limit the size before calling this.

    Returns ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">[]

concat

  • concat<T, TReturn, TNext>(...gens: (Generator<T, TReturn, TNext> | Iterator<T, TReturn, TNext> | Iterable<T> | Enhancements<T, TReturn, TNext, "sync">)[]): EnhancedGenerator<T, void | TReturn, TNext>
  • Concatenates generators (or iterators or iterables).

    Ensures that any supplied generators are terminated when this is terminated.

    Type parameters

    • T

    • TReturn

    • TNext

    Parameters

    • Rest ...gens: (Generator<T, TReturn, TNext> | Iterator<T, TReturn, TNext> | Iterable<T> | Enhancements<T, TReturn, TNext, "sync">)[]

      zero or more additional Genable to provide values.

    Returns EnhancedGenerator<T, void | TReturn, TNext>

every

  • every(p: (v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, idx: number) => boolean, thisArg?: any): boolean
  • Returns false and terminates this generator if the predicate is false for any of the generator's yielded values.

    If the generator terminates without having failed the predicate, true is returned.

    Parameters

    • p: (v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, idx: number) => boolean

      predicate to apply to each yielded value.

        • (v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, idx: number): boolean
        • Parameters

          • v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">
          • idx: number

          Returns boolean

    • Optional thisArg: any

      Optional value to supply as context (this) for the predicate

    Returns boolean

expenseItems

  • expenseItems(): EnhancedGenerator<ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, unknown, unknown>

filter

  • filter(f: (v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, idx: number) => boolean, thisArg?: any): EnhancedGenerator<ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, any, undefined>
  • Return a new EnhancedGenerator that yields only the values that satisfy the predicate f.

    f receives the value and a sequential index.

    Parameters

    • f: (v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, idx: number) => boolean
        • (v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, idx: number): boolean
        • Parameters

          • v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">
          • idx: number

          Returns boolean

    • Optional thisArg: any

      Optional context to be passed as this to the predicate.

    Returns EnhancedGenerator<ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, any, undefined>

findItem

  • findItem<T>(name: string, type: T): undefined | ItemImpl<T>
  • Type parameters

    • T: "asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario"

    Parameters

    • name: string
    • type: T

    Returns undefined | ItemImpl<T>

findItems

  • findItems<T, R>(type: T): R

findText

  • findText(name: string): string

flat

  • flat<D>(depth?: D): any
  • Flatten the values yielded by this generator to level depth. Produces a generator that yields the individual values at each level in depth-first order. Any iterable (including Array) or iterator will be traversed and its values yielded.

    The return type is currently over-broad

    Type parameters

    • D: number = 1

    Parameters

    • Optional depth: D

      (default = 1)

    Returns any

flatMap

  • flatMap<D>(f: (v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, idx: number) => any, depth?: D): any
  • Flatten the values yielded by applying the function to the values yielded by the generator to level depth. Produces a generator that yields the individual values at each level in depth-first order. Any iterable (including Array) or iterator will be traversed and its values yielded.

    The return type is currently over-broad

    Type parameters

    • D: number = 1

    Parameters

    • f: (v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, idx: number) => any
        • (v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, idx: number): any
        • Parameters

          • v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">
          • idx: number

          Returns any

    • Optional depth: D

    Returns any

forEach

  • forEach(f: (v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, idx: number) => void, thisArg?: any): void
  • Operate on each value produced by this generator. The function f is called with two values, the value yielded by this generator and a sequential index.

    Parameters

    • f: (v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, idx: number) => void
        • (v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, idx: number): void
        • Parameters

          • v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">
          • idx: number

          Returns void

    • Optional thisArg: any

      Value to be supplied as context this for function f.

    Returns void

hasCategory

  • hasCategory(category: Category): boolean

inScenario

  • inScenario(scenario: string): boolean

incomeItems

  • incomeItems(): EnhancedGenerator<ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, unknown, unknown>

items

  • items(): EnhancedGenerator<ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, unknown, unknown>

join

  • join(sep?: string): string
  • Trivial, but handy, same as Array.prototype.join.

    Parameters

    Returns string

limit

  • limit(max: number): EnhancedGenerator<ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, any, undefined>
  • Limit the number of values that can be generated. A RangeError is thrown if this limit is exceeded. This is useful when you wish to abort an excessively large computation.

    Use with 0 as the first argument if you want to truncate.

    Parameters

    • max: number

    Returns EnhancedGenerator<ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, any, undefined>

map

  • map<V>(f: (v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, idx: number) => V, thisArg?: any): EnhancedGenerator<V, any, undefined>
  • Apply the function to each value yielded by this generator. It is called with two arguments, the value yielded, and a sequential index. The return value is a generator that yields the values produced by the function.

    Type parameters

    • V

    Parameters

    • f: (v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, idx: number) => V
        • (v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, idx: number): V
        • Parameters

          • v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">
          • idx: number

          Returns V

    • Optional thisArg: any

      Optional value to be supplied as context this for function f.

    Returns EnhancedGenerator<V, any, undefined>

reduce

  • reduce<A, T, TReturn, TNext>(f: (acc: A | T, v: T) => A): A
  • reduce<A, T, TReturn, TNext>(f: (acc: A, v: T) => A, init: A): A
  • reduce<A>(f: (acc: A, v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">) => A, init?: A): A
  • Like Array.prototype.reduce, but the 3rd argument to the reducing function ("array") is omitted because there is no array.

    Type parameters

    • A

    • T

    • TReturn

    • TNext

    Parameters

    • f: (acc: A | T, v: T) => A
        • (acc: A | T, v: T): A
        • Parameters

          • acc: A | T
          • v: T

          Returns A

    Returns A

  • Like Array.prototype.reduce, but the 3rd argument to the reducing function ("array") is omitted because there is no array.

    Type parameters

    • A

    • T

    • TReturn = T

    • TNext = T

    Parameters

    • f: (acc: A, v: T) => A
        • (acc: A, v: T): A
        • Parameters

          • acc: A
          • v: T

          Returns A

    • init: A

    Returns A

  • Type parameters

    • A

    Parameters

    • f: (acc: A, v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">) => A
        • (acc: A, v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">): A
        • Parameters

          • acc: A
          • v: ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">

          Returns A

    • Optional init: A

    Returns A

repeat

  • repeat<N>(value: N, repetitions?: number): EnhancedGenerator<ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario"> | N, void, undefined>
  • Returns a new generator that repeats the supplied value after this generator completes.

    Type parameters

    • N

    Parameters

    • value: N

      the value to repeat

    • Optional repetitions: number

      The number repetitions; the default is infinite.

    Returns EnhancedGenerator<ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario"> | N, void, undefined>

repeatLast

  • repeatLast(max?: number): EnhancedGenerator<ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, any, undefined>
  • Returns a new generator that repeats the last value returned by this (or undefined if this did not return any values).

    Parameters

    • Optional max: number

    Returns EnhancedGenerator<ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, any, undefined>

slice

  • slice(start?: number, end?: number): EnhancedGenerator<ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, any, undefined>
  • Return a new EnhancedGenerator that only yields the indicated values, skipping start initial values and continuing until the end.

    Parameters

    • Optional start: number
    • Optional end: number

    Returns EnhancedGenerator<ItemImpl<"asset" | "liability" | "income" | "expense" | "incomeStream" | "incomeTax" | "person" | "text" | "scenario">, any, undefined>

some

  • some<T>(p: (v: T, idx: number) => boolean, thisArg?: any): boolean
  • Returns true and terminates the generator if the predicate is true for any of the generator's yielded values.

    If the generator terminates without having satisfied the predicate, false is returned.

    Type parameters

    • T

    Parameters

    • p: (v: T, idx: number) => boolean

      predicate to apply to each yielded value.

        • (v: T, idx: number): boolean
        • Parameters

          • v: T
          • idx: number

          Returns boolean

    • Optional thisArg: any

      Optional value to supply as context (this) for the predicate

    Returns boolean

stepper

Generated using TypeDoc