Skip to content

2022 03 19 Use Map instead of Object

Sebastien edited this page Mar 19, 2022 · 1 revision

Use Map instead of Object

  • Status: accepted
  • Date: 2022-03-19

Technical Story: {description | ticket/issue URL}

Context and Problem Statement

Javascript has evolved and now propose a Map data structure It can replace the Object for data structure manipulated by algorithm

Decision Drivers

  • Purpose, Map is dedicated to what we want to do
  • Performance, Map allow better performance
  • Implementation, Map does not come with the Object drawbacks (property intersection, object redefinition, etc)

Considered Options

  • Migrate from Object to Map
  • Stay on object

Decision Outcome

Chosen option: "Migrate from Object to Map", because of all the gain and for the right purpose of using it.

Positive Consequences

  • Better performance
  • Data structure tailored to our needs

Negative Consequences

  • No jest matcher for Map

Links