Skip to content

Key solution for primitives #1

@chrants

Description

@chrants

There are many types of things in lists that you might want to generate keys for, not just objects -- primitives like string or integer as well. Right now it's possible to use the string or integer as a key because they are primitives BUT in something like a to-do list or list of text messages, you must first wrap it in an object if you want the lists to have duplicate values, which in these cases they very well might.

An idea is to add a wrapper or something over a primitive list to generate keys or something for primitive list items. One solution might be to have a key as a string with something dumb like ${value}${indexInList} but that kinda defeats the whole purpose of handling keys properly. Another solution that might work is to wrap the primitives in an object with its valueOf() returning the primitive value, and then adding a _key property.

Primitive support should include at least:

  • Strings
  • Numbers

Optional support could be added for:

  • Booleans

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions