Noncommital Premarital Mischief

    just-right-pad
    TypeScript icon, indicating that this package has built-in type declarations

    2.1.0 • Public • Published

    just-right-pad

    Part of a library of zero-dependency npm modules that do just do one thing. Guilt-free utilities for every occasion.

    import rightPad from 'just-right-pad';
    
    rightPad('hello', 9); // 'hello    '
    rightPad('hello', 3); // 'hello'
    rightPad('hello', 9, '.'); // 'hello....'
    rightPad('hello', 9, '..'); // 'hello....'
    rightPad('hello', 10, 'ab'); // 'helloababa'
    rightPad('hello', 9, '\uD83D\uDC04'); // 'hello🐄🐄🐄🐄'
    rightPad('hello', 10, '\uD83D\uDC11\uD83D\uDC04'), // 'hello🐑🐄🐑🐄🐑'
    rightPad('hello', 7, '🐄'), // 'hello🐄🐄'
    rightPad(null, 7); // throws
    rightPad([], 4, '*'); // throws
    rightPad('hello', 4, true); // throws
    rightPad('hello', -4, true); // throws  
    rightPad('hello', 2.3, true); // throws    
    

    Install

    npm i just-right-pad@2.1.0

    Version

    2.1.0

    License

    MIT

    Unpacked Size

    4.17 kB

    Total Files

    4

    Last publish

    Collaborators

    • angus-c