Skip to content

Feature: toEllipsis / truncate / fit #77

Description

@vorillaz

Truncates the input text to the desired length.

Example usage

import toEllipsis from '@plexis/to-ellipsis';

toEllipsis('foo');
// => 'foo'

toEllipsis('foo', 1);
// => '...'

toEllipsis('foo', 3);
// => 'foo'

toEllipsis('As Gregor Samsa awoke one morning from uneasy dreams he found himself transformed in his bed into a monstrous vermin.', 20);
// => 'As Gregor Samsa a...'

toEllipsis('In a hole in the ground there lived a hobbit.', Infinity)
// => 'In a hole in the ground there lived a hobbit.'

toEllipsis('Last night I dreamt I went to Manderley again.', 5);
// => Last...

Aliases

import toEllipsis from '@plexis/to-ellipsis';
import {toEllipsis, truncate, fit} from 'plexis';

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions