Naming conventions #65
Replies: 2 comments 3 replies
-
I'll start with my own opinions.
|
Beta Was this translation helpful? Give feedback.
-
Generally I agree with what you've proposed. I'm probably the most opinionated about 2), as I don't really like the Obviously it means we'd have to support an alias for the functions that already exist, and then probably deprecate usage of |
Beta Was this translation helpful? Give feedback.
-
For the next major version, we should consider renaming some of the existing functions whose names can be confusing or hard to remember. Of course, such a breaking change is not to be taken lightly, and we need to be sure it's worth the migration effort (or provide a codemod for automatic migration).
Some examples include:
objectify
boil
partob
upperize
In the comments, please mention any other functions you think might need to be renamed. If you have ideas about what these functions could be named instead, please share your thoughts.
I also want to take this moment to establish naming conventions that will lead to an API that's more intuitive and readable. That leads us to some questions:
to
prefix for functions that convert a value from one type to another (e.g.toArray
for a function that wraps a value in an array if it's not already an array)? Or do we like theify
suffix better?arrayToObject
andmapToObject
or is there a better solution?Feel free to propose any other naming-related questions in the comments below.
Beta Was this translation helpful? Give feedback.
All reactions