430a5a13068510c7be2729ce76d45623e02e6b54
[platform/framework/web/crosswalk-tizen.git] /
1 var baseToString = require('./baseToString'),
2     createPadding = require('./createPadding');
3
4 /**
5  * Creates a function for `_.padLeft` or `_.padRight`.
6  *
7  * @private
8  * @param {boolean} [fromRight] Specify padding from the right.
9  * @returns {Function} Returns the new pad function.
10  */
11 function createPadDir(fromRight) {
12   return function(string, length, chars) {
13     string = baseToString(string);
14     return string && ((fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string));
15   };
16 }
17
18 module.exports = createPadDir;