UNPKG

compound-ex4

Version:

Compound-ex4 - MVC framework for NodeJS (ExpressJs 4 version), fork compoundjs(https://github.com/1602/compound)

19 lines (16 loc) 559 B
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 string && ((fromRight ? string : '') + createPadding(string, length, chars) + (fromRight ? '' : string)); }; } module.exports = createPadDir;