Skip to content

"domain" should be a function. And should be called something else #1

@tfga

Description

@tfga
const dictionary = async () => ({
  'X':      { field: '', domain: { '2': 2, '-2': -2, '0': 0 } },
  'Y':      { field: '', domain: { '2': 2, '-2': -2, '0': 0 } },
  'result': { field: '', domain: { '4': 4, '-4': -4, '0': 0 } }
})

The value

The value should be a function. Look at your example. You have an entry for each number! 🤦🏻‍♂️ This doesn't make sense. What I'd like to do is:

'X': { field: '', domain: parseInt },

There might be cases where a map makes sense, but you have to come up with a better example for that.

The name

domain should be called "parser". Or, at least, "fromString". "domain" means nothing to us.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions