shortfield

    1.0.0 • Public • Published
    CI / CD Status
    NPM npm version
    Semaphore CI Build Status
    Circle CI CircleCI
    Coverall Coverage Status

    shortfield returns a string truncated after X characters (default 10), concatenated with "..." (three dots).

    Useful in tables with long strings.

    E.g. "This is a long string" will return "This is a ..."

    Installation

    npm install shortfield

    Usage

    var shortener = require('shortfield');
    var shorted = shortener("This is a long string"); // default length is 10
    console.log(shorted); // returns This is a ...
    
    var shorted = shortener("This is a long string", 4);
    console.log(shorted); // returns This...

    Tests

    npm run test for simple test

    npm run cover for coverage

    Install

    npm i shortfield

    DownloadsWeekly Downloads

    2

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    11.8 kB

    Total Files

    12

    Last publish

    Collaborators

    • sineverba