complete-string
v2.2.3
Published
Complete string by any char. This repo is some kind of polyfill for ES2017 padStart.
Downloads
11
Readme
complete-string (npm)
:hammer: Complete string by any char. This repo is some kind of polyfill for ES2017 padStart.
Install
npm install complete-string
API
withChar(string: string, length: number, char: string)
Complete with any char:
CompleteString.withChar(' batman', 10, 'a') // => 'aaa batman'
withZero(string: string, length: number)
Complete with 0
:
var date = new Date();
CompleteString.withZero(date.getMonth(), 2) // => '05'
Unit tests
npm test
Code coverage
npm run coverage
License
The MIT License @ 2014