The output string seems a bit not logical when spaces == False: if spaces are not counted, the truncated output should contain mx characters AND all the spaces before that limit.
That would make the kata a bit more interesting... ;) (of course, this would invalidate lots of solutions. You could write a new verison this way and link the two between themselves, in their descriptions).
Overall, cool kata! I'm still a little confused about when to delete spaces from the input text though. That should be explained better in the description. Is the second example-response in the description correct?
charCheck("Cara Hertz", 9, false) should return [ true, "Cara Hertz" ]
Seems like it should return [ true, "CaraHertz" ] according to the actual test cases.
I'm still not sure though, more clarification in the description would be helpful.
Returning inconsistent datatypes is ++Ungood™ and should be avoided.
You could just as easily have the function return [ true, "original string" ], [ true, "" ] or even just [ true ] instead of true. That would enable you to always process the Boolean return value as answer[0]. As it is, the function always returns a truthy value and you need to Array.isArray() (or equivalent) the return value to find out whether or not to further process it. Which is senseless.
snake case +1
fixed in latest fork
Approved
python new test framework + snake_case is required. updated in this fork
The function name in Python should be in snake_case.
thanks for the feedback - and the suggestion for a future kata. Will get working on it!
The output string seems a bit not logical when
spaces == False
: if spaces are not counted, the truncated output should containmx
characters AND all the spaces before that limit.That would make the kata a bit more interesting... ;) (of course, this would invalidate lots of solutions. You could write a new verison this way and link the two between themselves, in their descriptions).
done - thanks again :)
I enjoyed this, thanks.
Yes, the description is better now! Couple of suggestions to clarify things even more:
spaces
argument isFalse
, you should remove spaces from the"Answer"
.Good spot - thanks! I've updated the examples, hope the description makes more sense now.
Overall, cool kata! I'm still a little confused about when to delete spaces from the input text though. That should be explained better in the description. Is the second example-response in the description correct?
charCheck("Cara Hertz", 9, false) should return [ true, "Cara Hertz" ]
Seems like it should return
[ true, "CaraHertz" ]
according to the actual test cases.I'm still not sure though, more clarification in the description would be helpful.
I had to update my solution and only now actually read the test cases. Great! :]
Also, changed vote and approved. Make more!
Thank-you for taking the time to explain this. I've updated the kata according to your suggestion.
Returning inconsistent datatypes is ++Ungood™ and should be avoided.
You could just as easily have the function return
[ true, "original string" ]
,[ true, "" ]
or even just[ true ]
instead oftrue
. That would enable you to always process the Boolean return value asanswer[0]
. As it is, the function always returns a truthy value and you need toArray.isArray()
(or equivalent) the return value to find out whether or not to further process it. Which is senseless.Loading more items...