-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is not working #7
Comments
You're trying to truncate a word. There are no spaces in there. This library truncate strings, meaning text with spaces. |
eh, ok thanks.
Was going to leave it at OK but...that's pretty annoying for you to say something so snarky TBH because: Your README talks nothing about spaces being a requirement for this behavior to work. While your examples show spaces, it's pretty easy to infer that a space is just part of chars that you can cut. Hence the actual helper itself Also had read the Readme already before posting this, and the fact that your future features show: inferred to me again that whatever is in that string, whether there are space are not is a string! So really your lib is missing a use case / edge case with a string, a string without spaces, not a "word". So in other words your library supports only "words" not "strings" :). Here I'll write the test, you can make it pass, lets play ping pong 🏓: it('truncates text without spaces ', () => {
const parameters = {
measurements: {
text: 5
},
text: 'lookitsastring'
}
expect(truncateString(parameters)).toEqual('looki')
}) |
I realized the last sentence sounded snarky. Apologies. To be honest I don't think that dealing with the truncation of strings without spaces would be that interesting. This library, let me attempt a better definition, has the purpose to truncate sentences. If you think this feature could be useful and want to contribute, feel free to open a PR and I'll review it. |
@dschinkel I updated the README. I make clear that spaces are required for the truncation to happen. |
I was using it to try and truncate full names of people on my site. I had to squeeze people into a grid so being able to truncate would be useful. I would contribute but I'm really focused on getting some new stuff out for the site. |
it's not truncating anything
<TruncateString text="abdctafdafdsfsdddd" truncateAt={10} />
nothing happens. It renders the full string.
The text was updated successfully, but these errors were encountered: