Skip to content

Truncate a bit too aggressive #3

@koriroys

Description

@koriroys

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

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions