$ cnpm install pad-start
ES spec-compliant String.prototype.padStart shim.
$ npm install --save pad-start
For more use-cases see the tests
// a polyfill that doesn't overwrite the native method
var padStart = require('pad-start');
padStart('x', 4, 'ab'); // => 'abax'
padStart('x', 4); // => ' x'
padStart('abcd', 2, '#'); // => 'abcd'
padStart('abcd', 6, '123456'); // => '12abcd'
Pull requests and stars are highly welcome.
For bugs and feature requests, please create an issue.
Copyright 2013 - present © cnpmjs.org | Home |