ng-zorro-antd-yj
Version:
An enterprise-class UI components based on Ant Design and Angular
41 lines • 2.92 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* Much like lodash.
* @param {?} toPad
* @param {?} length
* @param {?} element
* @return {?}
*/
export function padStart(toPad, length, element) {
if (toPad.length > length) {
return toPad;
}
/** @type {?} */
var joined = "" + getRepeatedElement(length, element) + toPad;
return joined.slice(joined.length - length, joined.length);
}
/**
* @param {?} toPad
* @param {?} length
* @param {?} element
* @return {?}
*/
export function padEnd(toPad, length, element) {
/** @type {?} */
var joined = "" + toPad + getRepeatedElement(length, element);
return joined.slice(0, length);
}
/**
* @param {?} length
* @param {?} element
* @return {?}
*/
export function getRepeatedElement(length, element) {
return Array(length)
.fill(element)
.join('');
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3RyaW5nLmpzIiwic291cmNlUm9vdCI6Im5nOi8vbmctem9ycm8tYW50ZC15ai8iLCJzb3VyY2VzIjpbImNvcmUvdXRpbC9zdHJpbmcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7QUFHQSxNQUFNLFVBQVUsUUFBUSxDQUFDLEtBQWEsRUFBRSxNQUFjLEVBQUUsT0FBZTtJQUNyRSxJQUFJLEtBQUssQ0FBQyxNQUFNLEdBQUcsTUFBTSxFQUFFO1FBQ3pCLE9BQU8sS0FBSyxDQUFDO0tBQ2Q7O1FBRUssTUFBTSxHQUFHLEtBQUcsa0JBQWtCLENBQUMsTUFBTSxFQUFFLE9BQU8sQ0FBQyxHQUFHLEtBQU87SUFDL0QsT0FBTyxNQUFNLENBQUMsS0FBSyxDQUFDLE1BQU0sQ0FBQyxNQUFNLEdBQUcsTUFBTSxFQUFFLE1BQU0sQ0FBQyxNQUFNLENBQUMsQ0FBQztBQUM3RCxDQUFDOzs7Ozs7O0FB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