Skip to content

Strict conversion functions? #38

@gfredericks

Description

@gfredericks

I personally rather like bijections more than coercions.

E.g., if I have a web API that is supposed to accept snake case query params and I use ->kebab-case to translate them to the codebase's internal format, then what I really have is an API that accepts snake case and kebab case and arbitrary combinations of the two. And this bothers me a bit.

Would it be welcome to add functions to this library that convert from one format to another and perhaps throw exceptions if the input is not in the expected format?

Problems

  • n² new functions, which is a lot
  • is this even well defined enough to implement reliably?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions