Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 2, 2019. It is now read-only.
/ leftpad-i18n Public archive

Internationalized leftPad

License

Airblader/leftpad-i18n

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leftpad-i18n npm version

What is this?

A version of the popular and infamous leftPad function wich properly supports internationalization.

How do I use this?

After installing the package via npm install leftpad-i18n you can use it as follows:

const leftPad = require('leftpad-i18n');

leftPad('Foo', 5);      // '  Foo'
leftPad('Foo', 5, 'x'); // 'xxFoo'
leftPad(12, 3, 0);      // '012'

Of course, the true power of leftpad-i18n comes into play with the additional rtl flag:

leftPad('Foo', 5, ' ', true); // 'Foo  '
leftPad('Foo', 5, null, true); // 'Foo  '

Is this serious?

Yes.

License

See LICENSE file.

About

Internationalized leftPad

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •