mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
react app
This commit is contained in:
29
react-app/node_modules/lodash/internal/createPadding.js
generated
vendored
Normal file
29
react-app/node_modules/lodash/internal/createPadding.js
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
var repeat = require('../string/repeat');
|
||||
|
||||
/* Native method references for those with the same name as other `lodash` methods. */
|
||||
var nativeCeil = Math.ceil,
|
||||
nativeIsFinite = global.isFinite;
|
||||
|
||||
/**
|
||||
* Creates the padding required for `string` based on the given `length`.
|
||||
* The `chars` string is truncated if the number of characters exceeds `length`.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string to create padding for.
|
||||
* @param {number} [length=0] The padding length.
|
||||
* @param {string} [chars=' '] The string used as padding.
|
||||
* @returns {string} Returns the pad for `string`.
|
||||
*/
|
||||
function createPadding(string, length, chars) {
|
||||
var strLength = string.length;
|
||||
length = +length;
|
||||
|
||||
if (strLength >= length || !nativeIsFinite(length)) {
|
||||
return '';
|
||||
}
|
||||
var padLength = length - strLength;
|
||||
chars = chars == null ? ' ' : (chars + '');
|
||||
return repeat(chars, nativeCeil(padLength / chars.length)).slice(0, padLength);
|
||||
}
|
||||
|
||||
module.exports = createPadding;
|
Reference in New Issue
Block a user