mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 00:57:48 +00:00
Bump to v3.6.0.
This commit is contained in:
18
internal/createPadDir.js
Normal file
18
internal/createPadDir.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import baseToString from './baseToString';
|
||||
import createPadding from './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 string && ((fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string));
|
||||
};
|
||||
}
|
||||
|
||||
export default createPadDir;
|
||||
Reference in New Issue
Block a user