Open jfroelich opened 5 years ago
Similar concerns for the min_title_length parameter. In fact, it is more general than just this function, it is a general design decision regarding how the majority of the functions in the code should perform sanity checks.
Being overly paranoid is bad.
Being too accepting of garbage leads to ambiguity and bad habits of passing around garbage.
Being inconsistent just leads to confusion.
The objective is to remove all anxiety from calling a function. Calling the function should be simple, and clear.
Who knows, maybe the smell surrounding the need for sanity checks is the problem itself. Maybe this should be a function that takes something other than a string, like more specific types, where I have sentinel-like values for nulls.
Maybe this should be a stricter sanity check. |delims| should be either null, undefined, or an array. Anything else should be a type error.