Closed koriroys closed 7 years ago
If for example I have a title that has no spaces in it, aka var title = 'MY_SUPER_AMAZING_TITLE', and I call truncate like so:
var title = 'MY_SUPER_AMAZING_TITLE'
{{title | truncate(15, '...')}} my output is just '...'
{{title | truncate(15, '...')}}
I added
if (last === 0) last = length - clamp.length
basically if it gets to the start and didn't find any spaces, just default back to the full string and cut it at the max.
I think this should be the standard behavior (I expect that if there is some title at all, it will show something, not just '...'). What do you think?
Thanks for your idea. I will dig into it ASAP.
And you're welcome to contribute a PR to make this package better :)
Fixed https://github.com/imcvampire/vue-truncate-filter/releases/tag/1.1.6
If for example I have a title that has no spaces in it, aka
var title = 'MY_SUPER_AMAZING_TITLE'
, and I call truncate like so:{{title | truncate(15, '...')}}
my output is just '...'I added
basically if it gets to the start and didn't find any spaces, just default back to the full string and cut it at the max.
I think this should be the standard behavior (I expect that if there is some title at all, it will show something, not just '...'). What do you think?