Websites v4 docs v5.2.5
    Preparing search index...

    Function groupedByKey

    • Data from dbapi comes as an array of objects sorted by id.

      [
      {
      "id": 20,
      "country_name": "Scotland",
      ...
      ...
      ...
      "tax_type": "base",
      ...
      },
      {
      "id": 21,
      "country_name": "Wales",
      ...
      ...
      ...
      "tax_type": "base",
      ...
      },

      This function helps to organise the data by grouping said objects under the key passed as an argument (country name or tax type in this case). Then useStampDutyCalculator can use only the type of data required for the current calculation under the circunstances and location selected.

      rates: {
      Scotland: {
      {
      "id": 20,
      "country_name": "Scotland",
      ...
      ...
      ...
      "tax_type": "base",
      ...
      },
      ...
      },
      Wales: {
      {
      "id": 21,
      "country_name": "Wales",
      ...
      ...
      ...
      "tax_type": "base",
      ...
      },
      ...
      },

      or

      rates: {
      base: {
      {
      "id": 20,
      "country_name": "Scotland",
      ...
      ...
      ...
      "tax_type": "base",
      ...
      },
      ...
      },
      first_time_buyer: {
      {
      "id": 27,
      "country_name": "Scotland",
      ...
      ...
      ...
      "tax_type": "first_time_buyer",
      ...
      },
      ...
      },

      Parameters

      • rates: SerializableStampDutyRate[]
      • key: keyof SerializableStampDutyRate

      Returns any