Options
All
  • Public
  • Public/Protected
  • All
Menu

A particular scenario.

Hierarchy

Implements

Index

Constructors

constructor

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

Properties

Private Optional #temporal

#temporal: Temporal<Scenario> = ...

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 categories

categories: Category[]

Readonly data

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

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: 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<"scenario" | "incomeStream" | "asset" | "liability" | "income" | "expense" | "incomeTax" | "person" | "text">, b: ItemImpl<"scenario" | "incomeStream" | "asset" | "liability" | "income" | "expense" | "incomeTax" | "person" | "text">) => number) => ItemImpl<"scenario" | "incomeStream" | "asset" | "liability" | "income" | "expense" | "incomeTax" | "person" | "text">[]

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: Scenario | RowType<"scenario" | "incomeStream" | "asset" | "liability" | "income" | "expense" | "incomeTax" | "person" | "text">[], end_year: Year) => ItemType<T>

Type declaration

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

      Type parameters

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

      Parameters

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

        The type of item (defaulted from the item)

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

      Returns ItemType<T>

      the constructed instance.

Static scenarios

scenarios: NamedIndex<Scenario> = {}

Accessors

[toStringTag]

  • get [toStringTag](): string

final

net_assets

  • get net_assets(): number

net_assets_final

  • get net_assets_final(): number

person_list

snapshots

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)[]

sourcesFlat

temporal

timeline

total_expenses

  • get total_expenses(): number

total_retirement_income

  • get total_retirement_income(): number

total_retirement_income_with_fixed

  • get total_retirement_income_with_fixed(): number

Methods

Private #construct_item

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

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

    Parameters

    • name: string
    • type: T
    • all: boolean = false

    Returns null | ItemType<T>

Private #construct_items

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

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

    Parameters

    • type: T
    • all: boolean = false

    Returns ItemType<T>[]

Private #construct_spouse

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

[iterator]

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

asArray

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

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<"scenario" | "incomeStream" | "asset" | "liability" | "income" | "expense" | "incomeTax" | "person" | "text">, 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<"scenario" | "incomeStream" | "asset" | "liability" | "income" | "expense" | "incomeTax" | "person" | "text">, idx: number) => boolean

      predicate to apply to each yielded value.

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

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

          Returns boolean

    • Optional thisArg: any

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

    Returns boolean

filter

  • filter(f: (v: ItemImpl<"scenario" | "incomeStream" | "asset" | "liability" | "income" | "expense" | "incomeTax" | "person" | "text">, idx: number) => boolean, thisArg?: any): EnhancedGenerator<ItemImpl<"scenario" | "incomeStream" | "asset" | "liability" | "income" | "expense" | "incomeTax" | "person" | "text">, 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<"scenario" | "incomeStream" | "asset" | "liability" | "income" | "expense" | "incomeTax" | "person" | "text">, idx: number) => boolean
        • (v: ItemImpl<"scenario" | "incomeStream" | "asset" | "liability" | "income" | "expense" | "incomeTax" | "person" | "text">, idx: number): boolean
        • Parameters

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

          Returns boolean

    • Optional thisArg: any

      Optional context to be passed as this to the predicate.

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

findItem

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

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

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

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

          Returns any

    • Optional depth: D

    Returns any

forEach

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

          • v: ItemImpl<"scenario" | "incomeStream" | "asset" | "liability" | "income" | "expense" | "incomeTax" | "person" | "text">
          • 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

items

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

join

  • join(sep?: string): string

limit

  • limit(max: number): EnhancedGenerator<ItemImpl<"scenario" | "incomeStream" | "asset" | "liability" | "income" | "expense" | "incomeTax" | "person" | "text">, 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<"scenario" | "incomeStream" | "asset" | "liability" | "income" | "expense" | "incomeTax" | "person" | "text">, any, undefined>

map

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

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

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

          Returns A

    • Optional init: A

    Returns A

repeat

  • repeat<N>(value: N, repetitions?: number): EnhancedGenerator<ItemImpl<"scenario" | "incomeStream" | "asset" | "liability" | "income" | "expense" | "incomeTax" | "person" | "text"> | 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<"scenario" | "incomeStream" | "asset" | "liability" | "income" | "expense" | "incomeTax" | "person" | "text"> | N, void, undefined>

repeatLast

  • repeatLast(max?: number): EnhancedGenerator<ItemImpl<"scenario" | "incomeStream" | "asset" | "liability" | "income" | "expense" | "incomeTax" | "person" | "text">, any, undefined>

run

slice

  • slice(start?: number, end?: number): EnhancedGenerator<ItemImpl<"scenario" | "incomeStream" | "asset" | "liability" | "income" | "expense" | "incomeTax" | "person" | "text">, 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

states

  • states(): Generator<never, void, unknown>

Generated using TypeDoc