ExLedger.Parser.Helpers (ex_ledger v0.6.1)
Shared helper functions used across parser modules.
Summary
Functions
Returns all postings from a list of transactions.
Ensures a numeric string has exactly two decimal places.
Formats an amount value for a given currency.
Extracts the value from a posting's amount.
Extracts the currency from a posting's amount.
Returns all postings from regular transactions only.
Checks if a transaction is a regular transaction (has a date and is not automated/periodic).
Filters transactions to only include regular transactions (not automated/periodic).
Converts a value to Decimal.
Returns a sorted list of unique items.
Functions
Returns all postings from a list of transactions.
Ensures a numeric string has exactly two decimal places.
Examples
iex> ensure_two_decimals("42")
"42.00"
iex> ensure_two_decimals("42.5")
"42.50"
iex> ensure_two_decimals("42.50")
"42.50"
@spec format_amount_for_currency( Decimal.t() | number(), String.t() | nil, atom() | nil ) :: String.t()
Formats an amount value for a given currency.
Extracts the value from a posting's amount.
Extracts the currency from a posting's amount.
Returns all postings from regular transactions only.
Checks if a transaction is a regular transaction (has a date and is not automated/periodic).
Filters transactions to only include regular transactions (not automated/periodic).
Converts a value to Decimal.
Accepts Decimal, float, or integer values.
Returns a sorted list of unique items.