mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
547 B
19 lines
547 B
10 years ago
|
var baseToString = require('./baseToString'),
|
||
|
createPadding = require('./createPadding');
|
||
|
|
||
|
/**
|
||
|
* Creates a function for `_.padLeft` or `_.padRight`.
|
||
|
*
|
||
|
* @private
|
||
|
* @param {boolean} [fromRight] Specify padding from the right.
|
||
|
* @returns {Function} Returns the new pad function.
|
||
|
*/
|
||
|
function createPadDir(fromRight) {
|
||
|
return function(string, length, chars) {
|
||
|
string = baseToString(string);
|
||
|
return (fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string);
|
||
|
};
|
||
|
}
|
||
|
|
||
|
module.exports = createPadDir;
|