3.2.0 β€’ Published 1 year ago

just-right-pad v3.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
1 year ago

just-right-pad

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

🍦 Try it

npm install just-right-pad
yarn add just-right-pad

Add characters to the right of a string such that its total length is n

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    
3.2.0

1 year ago

3.1.1

2 years ago

3.1.0

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.0

3 years ago

2.3.0

3 years ago

2.2.1

3 years ago

2.2.0

3 years ago

2.1.0

6 years ago

2.0.0

7 years ago

1.0.0

7 years ago