react-hexgrid icon indicating copy to clipboard operation
react-hexgrid copied to clipboard

toString functions on models

Open IcculusC opened this issue 6 years ago • 2 comments

it would be extremely useful if the Hex model had a toString function, so that it can be used as the key in a hash map

the default behavior is [object Object], which makes it pretty useless, and a hash map is the recommended storage method on the red blob post!

thoughts?

IcculusC avatar Oct 11 '18 17:10 IcculusC

Can you elaborate on this? Do you mean something like the following?

  toString(){
    return JSON.stringify( `{ q: ${ this.q }, r: ${ this.r }, s: ${this.s} }` );
  }

luisfrocha avatar Apr 19 '20 18:04 luisfrocha

@IcculusC can you link the blogpost?

jannikbuschke avatar Aug 06 '22 15:08 jannikbuschke